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 #include "vp9/common/vp9_onyxc_int.h" |
15 | 15 |
16 static void log_frame_info(VP9_COMMON *cm, const char *str, FILE *f) { | 16 static void log_frame_info(VP9_COMMON *cm, const char *str, FILE *f) { |
17 fprintf(f, "%s", str); | 17 fprintf(f, "%s", str); |
18 fprintf(f, "(Frame %d, Show:%d, Q:%d): \n", cm->current_video_frame, | 18 fprintf(f, "(Frame %d, Show:%d, Q:%d): \n", cm->current_video_frame, |
19 cm->show_frame, cm->base_qindex); | 19 cm->show_frame, cm->base_qindex); |
20 } | 20 } |
21 /* This function dereferences a pointer to the mbmi structure | 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 | 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. | 23 * for each mbmi member value in the mi structure. |
24 */ | 24 */ |
25 static void print_mi_data(VP9_COMMON *cm, FILE *file, const char *descriptor, | 25 static void print_mi_data(VP9_COMMON *cm, FILE *file, const char *descriptor, |
26 size_t member_offset) { | 26 size_t member_offset) { |
27 int mi_row, mi_col; | 27 int mi_row, mi_col; |
28 MODE_INFO *mi = cm->mi; | 28 MODE_INFO **mi = cm->mi_grid_visible; |
29 int rows = cm->mi_rows; | 29 int rows = cm->mi_rows; |
30 int cols = cm->mi_cols; | 30 int cols = cm->mi_cols; |
31 char prefix = descriptor[0]; | 31 char prefix = descriptor[0]; |
32 | 32 |
33 log_frame_info(cm, descriptor, file); | 33 log_frame_info(cm, descriptor, file); |
34 for (mi_row = 0; mi_row < rows; mi_row++) { | 34 for (mi_row = 0; mi_row < rows; mi_row++) { |
35 fprintf(file, "%c ", prefix); | 35 fprintf(file, "%c ", prefix); |
36 for (mi_col = 0; mi_col < cols; mi_col++) { | 36 for (mi_col = 0; mi_col < cols; mi_col++) { |
37 fprintf(file, "%2d ", | 37 fprintf(file, "%2d ", |
38 *((int*) ((char *) (&mi->src_mi->mbmi) + | 38 *((int*) ((char *) (&mi[0]->mbmi) + |
39 member_offset))); | 39 member_offset))); |
40 mi++; | 40 mi++; |
41 } | 41 } |
42 fprintf(file, "\n"); | 42 fprintf(file, "\n"); |
43 mi += 8; | 43 mi += 8; |
44 } | 44 } |
45 fprintf(file, "\n"); | 45 fprintf(file, "\n"); |
46 } | 46 } |
47 | 47 |
48 void vp9_print_modes_and_motion_vectors(VP9_COMMON *cm, const char *file) { | 48 void vp9_print_modes_and_motion_vectors(VP9_COMMON *cm, const char *file) { |
49 int mi_row; | 49 int mi_row; |
50 int mi_col; | 50 int mi_col; |
51 FILE *mvs = fopen(file, "a"); | 51 FILE *mvs = fopen(file, "a"); |
52 MODE_INFO *mi = cm->mi; | 52 MODE_INFO **mi = cm->mi_grid_visible; |
53 int rows = cm->mi_rows; | 53 int rows = cm->mi_rows; |
54 int cols = cm->mi_cols; | 54 int cols = cm->mi_cols; |
55 | 55 |
56 print_mi_data(cm, mvs, "Partitions:", offsetof(MB_MODE_INFO, sb_type)); | 56 print_mi_data(cm, mvs, "Partitions:", offsetof(MB_MODE_INFO, sb_type)); |
57 print_mi_data(cm, mvs, "Modes:", offsetof(MB_MODE_INFO, mode)); | 57 print_mi_data(cm, mvs, "Modes:", offsetof(MB_MODE_INFO, mode)); |
58 print_mi_data(cm, mvs, "Ref frame:", offsetof(MB_MODE_INFO, ref_frame[0])); | 58 print_mi_data(cm, mvs, "Ref frame:", offsetof(MB_MODE_INFO, ref_frame[0])); |
59 print_mi_data(cm, mvs, "Transform:", offsetof(MB_MODE_INFO, tx_size)); | 59 print_mi_data(cm, mvs, "Transform:", offsetof(MB_MODE_INFO, tx_size)); |
60 print_mi_data(cm, mvs, "UV Modes:", offsetof(MB_MODE_INFO, uv_mode)); | 60 print_mi_data(cm, mvs, "UV Modes:", offsetof(MB_MODE_INFO, uv_mode)); |
61 | 61 |
62 // output skip infomation. | 62 // output skip infomation. |
63 log_frame_info(cm, "Skips:", mvs); | 63 log_frame_info(cm, "Skips:", mvs); |
64 for (mi_row = 0; mi_row < rows; mi_row++) { | 64 for (mi_row = 0; mi_row < rows; mi_row++) { |
65 fprintf(mvs, "S "); | 65 fprintf(mvs, "S "); |
66 for (mi_col = 0; mi_col < cols; mi_col++) { | 66 for (mi_col = 0; mi_col < cols; mi_col++) { |
67 fprintf(mvs, "%2d ", mi->src_mi->mbmi.skip); | 67 fprintf(mvs, "%2d ", mi[0]->mbmi.skip); |
68 mi++; | 68 mi++; |
69 } | 69 } |
70 fprintf(mvs, "\n"); | 70 fprintf(mvs, "\n"); |
71 mi += 8; | 71 mi += 8; |
72 } | 72 } |
73 fprintf(mvs, "\n"); | 73 fprintf(mvs, "\n"); |
74 | 74 |
75 // output motion vectors. | 75 // output motion vectors. |
76 log_frame_info(cm, "Vectors ", mvs); | 76 log_frame_info(cm, "Vectors ", mvs); |
77 mi = cm->mi; | 77 mi = cm->mi_grid_visible; |
78 for (mi_row = 0; mi_row < rows; mi_row++) { | 78 for (mi_row = 0; mi_row < rows; mi_row++) { |
79 fprintf(mvs, "V "); | 79 fprintf(mvs, "V "); |
80 for (mi_col = 0; mi_col < cols; mi_col++) { | 80 for (mi_col = 0; mi_col < cols; mi_col++) { |
81 fprintf(mvs, "%4d:%4d ", mi->src_mi->mbmi.mv[0].as_mv.row, | 81 fprintf(mvs, "%4d:%4d ", mi[0]->mbmi.mv[0].as_mv.row, |
82 mi->src_mi->mbmi.mv[0].as_mv.col); | 82 mi[0]->mbmi.mv[0].as_mv.col); |
83 mi++; | 83 mi++; |
84 } | 84 } |
85 fprintf(mvs, "\n"); | 85 fprintf(mvs, "\n"); |
86 mi += 8; | 86 mi += 8; |
87 } | 87 } |
88 fprintf(mvs, "\n"); | 88 fprintf(mvs, "\n"); |
89 | 89 |
90 fclose(mvs); | 90 fclose(mvs); |
91 } | 91 } |
OLD | NEW |