OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include <stdio.h> | 11 #include <stdio.h> |
12 | 12 |
13 #include "vp9/common/vp9_blockd.h" | 13 #include "vp9/common/vp9_blockd.h" |
| 14 #include "vp9/common/vp9_onyxc_int.h" |
14 | 15 |
15 void vp9_print_modes_and_motion_vectors(MODE_INFO *mi, int rows, int cols, | 16 static void log_frame_info(VP9_COMMON *cm, const char *str, FILE *f) { |
16 int frame, char *file) { | 17 fprintf(f, "%s", str); |
| 18 fprintf(f, "(Frame %d, Show:%d, Q:%d): \n", cm->current_video_frame, |
| 19 cm->show_frame, cm->base_qindex); |
| 20 } |
| 21 /* This function dereferences a pointer to the mbmi structure |
| 22 * and uses the passed in member offset to print out the value of an integer |
| 23 * for each mbmi member value in the mi structure. |
| 24 */ |
| 25 static void print_mi_data(VP9_COMMON *common, FILE *file, char *descriptor, |
| 26 int member_offset) { |
| 27 int mi_row; |
| 28 int mi_col; |
| 29 int mi_index = 0; |
| 30 MODE_INFO *mi = common->mi; |
| 31 int rows = common->mi_rows; |
| 32 int cols = common->mi_cols; |
| 33 char prefix = descriptor[0]; |
| 34 |
| 35 log_frame_info(common, descriptor, file); |
| 36 mi_index = 0; |
| 37 for (mi_row = 0; mi_row < rows; mi_row++) { |
| 38 fprintf(file, "%c ", prefix); |
| 39 for (mi_col = 0; mi_col < cols; mi_col++) { |
| 40 fprintf(file, "%2d ", |
| 41 *((int*) ((char *) (&mi[mi_index].mbmi) + member_offset))); |
| 42 mi_index++; |
| 43 } |
| 44 fprintf(file, "\n"); |
| 45 mi_index += 8; |
| 46 } |
| 47 fprintf(file, "\n"); |
| 48 } |
| 49 void vp9_print_modes_and_motion_vectors(VP9_COMMON *cm, char *file) { |
17 int mi_row; | 50 int mi_row; |
18 int mi_col; | 51 int mi_col; |
19 int mi_index = 0; | 52 int mi_index = 0; |
20 FILE *mvs = fopen(file, "a"); | 53 FILE *mvs = fopen(file, "a"); |
| 54 MODE_INFO *mi = cm->mi; |
| 55 int rows = cm->mi_rows; |
| 56 int cols = cm->mi_cols; |
21 | 57 |
22 // Print out the macroblock Y modes | 58 print_mi_data(cm, mvs, "Partitions:", offsetof(MB_MODE_INFO, sb_type)); |
23 fprintf(mvs, "SB Types for Frame %d\n", frame); | 59 print_mi_data(cm, mvs, "Modes:", offsetof(MB_MODE_INFO, mode)); |
| 60 print_mi_data(cm, mvs, "Skips:", offsetof(MB_MODE_INFO, mb_skip_coeff)); |
| 61 print_mi_data(cm, mvs, "Ref frame:", offsetof(MB_MODE_INFO, ref_frame[0])); |
| 62 print_mi_data(cm, mvs, "Transform:", offsetof(MB_MODE_INFO, txfm_size)); |
| 63 print_mi_data(cm, mvs, "UV Modes:", offsetof(MB_MODE_INFO, uv_mode)); |
24 | 64 |
| 65 log_frame_info(cm, "Vectors ",mvs); |
25 for (mi_row = 0; mi_row < rows; mi_row++) { | 66 for (mi_row = 0; mi_row < rows; mi_row++) { |
| 67 fprintf(mvs,"V "); |
26 for (mi_col = 0; mi_col < cols; mi_col++) { | 68 for (mi_col = 0; mi_col < cols; mi_col++) { |
27 fprintf(mvs, "%2d ", mi[mi_index].mbmi.sb_type); | 69 fprintf(mvs, "%4d:%4d ", mi[mi_index].mbmi.mv[0].as_mv.row, |
28 | 70 mi[mi_index].mbmi.mv[0].as_mv.col); |
29 mi_index++; | 71 mi_index++; |
30 } | 72 } |
31 | |
32 fprintf(mvs, "\n"); | |
33 mi_index += 8; | |
34 } | |
35 | |
36 // Print out the macroblock Y modes | |
37 fprintf(mvs, "Mb Modes for Frame %d\n", frame); | |
38 mi_index = 0; | |
39 for (mi_row = 0; mi_row < rows; mi_row++) { | |
40 for (mi_col = 0; mi_col < cols; mi_col++) { | |
41 fprintf(mvs, "%2d ", mi[mi_index].mbmi.mode); | |
42 | |
43 mi_index++; | |
44 } | |
45 | |
46 fprintf(mvs, "\n"); | |
47 mi_index += 8; | |
48 } | |
49 | |
50 fprintf(mvs, "\n"); | |
51 | |
52 mi_index = 0; | |
53 fprintf(mvs, "Mb mv ref for Frame %d\n", frame); | |
54 | |
55 for (mi_row = 0; mi_row < rows; mi_row++) { | |
56 for (mi_col = 0; mi_col < cols; mi_col++) { | |
57 fprintf(mvs, "%2d ", mi[mi_index].mbmi.ref_frame[0]); | |
58 | |
59 mi_index++; | |
60 } | |
61 | |
62 fprintf(mvs, "\n"); | 73 fprintf(mvs, "\n"); |
63 mi_index += 8; | 74 mi_index += 8; |
64 } | 75 } |
65 fprintf(mvs, "\n"); | 76 fprintf(mvs, "\n"); |
66 | 77 |
67 mi_index = 0; | |
68 fprintf(mvs, "Mb mv ref for Frame %d\n", frame); | |
69 | |
70 for (mi_row = 0; mi_row < rows; mi_row++) { | |
71 for (mi_col = 0; mi_col < cols; mi_col++) { | |
72 fprintf(mvs, "%4d:%4d ", mi[mi_index].mbmi.mv[0].as_mv.row, | |
73 mi[mi_index].mbmi.mv[0].as_mv.col); | |
74 | |
75 mi_index++; | |
76 } | |
77 | |
78 fprintf(mvs, "\n"); | |
79 mi_index += 8; | |
80 } | |
81 | |
82 fprintf(mvs, "\n"); | |
83 | |
84 /* print out the macroblock txform sizes */ | |
85 mi_index = 0; | |
86 fprintf(mvs, "TXFM size for Frame %d\n", frame); | |
87 | |
88 for (mi_row = 0; mi_row < rows; mi_row++) { | |
89 for (mi_col = 0; mi_col < cols; mi_col++) { | |
90 fprintf(mvs, "%2d ", mi[mi_index].mbmi.txfm_size); | |
91 | |
92 mi_index++; | |
93 } | |
94 | |
95 mi_index += 8; | |
96 fprintf(mvs, "\n"); | |
97 } | |
98 | |
99 fprintf(mvs, "\n"); | |
100 | |
101 /* print out the macroblock UV modes */ | |
102 mi_index = 0; | |
103 fprintf(mvs, "UV Modes for Frame %d\n", frame); | |
104 | |
105 for (mi_row = 0; mi_row < rows; mi_row++) { | |
106 for (mi_col = 0; mi_col < cols; mi_col++) { | |
107 fprintf(mvs, "%2d ", mi[mi_index].mbmi.uv_mode); | |
108 | |
109 mi_index++; | |
110 } | |
111 | |
112 mi_index += 8; | |
113 fprintf(mvs, "\n"); | |
114 } | |
115 | |
116 fprintf(mvs, "\n"); | |
117 | |
118 /* print out the macroblock mvs */ | |
119 mi_index = 0; | |
120 fprintf(mvs, "MVs for Frame %d\n", frame); | |
121 | |
122 for (mi_row = 0; mi_row < rows; mi_row++) { | |
123 for (mi_col = 0; mi_col < cols; mi_col++) { | |
124 fprintf(mvs, "%5d:%-5d", mi[mi_index].mbmi.mv[0].as_mv.row / 2, | |
125 mi[mi_index].mbmi.mv[0].as_mv.col / 2); | |
126 | |
127 mi_index++; | |
128 } | |
129 | |
130 mi_index += 8; | |
131 fprintf(mvs, "\n"); | |
132 } | |
133 | |
134 fprintf(mvs, "\n"); | |
135 | |
136 fclose(mvs); | 78 fclose(mvs); |
137 } | 79 } |
OLD | NEW |