Merge "vp8_rd_pick_best_mbsegmentation code restructure"
[libvpx.git] / vp8 / common / debugmodes.c
blob8c03480fa28542624a8ead8e92ee1a3b0fde477a
1 /*
2 * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
12 #include <stdio.h>
13 #include "blockd.h"
16 void vp8_print_modes_and_motion_vectors(MODE_INFO *mi, int rows, int cols, int frame)
19 int mb_row;
20 int mb_col;
21 int mb_index = 0;
22 FILE *mvs = fopen("mvs.stt", "a");
24 /* print out the macroblock Y modes */
25 mb_index = 0;
26 fprintf(mvs, "Mb Modes for Frame %d\n", frame);
28 for (mb_row = 0; mb_row < rows; mb_row++)
30 for (mb_col = 0; mb_col < cols; mb_col++)
33 fprintf(mvs, "%2d ", mi[mb_index].mbmi.mode);
35 mb_index++;
38 fprintf(mvs, "\n");
39 mb_index++;
42 fprintf(mvs, "\n");
44 mb_index = 0;
45 fprintf(mvs, "Mb mv ref for Frame %d\n", frame);
47 for (mb_row = 0; mb_row < rows; mb_row++)
49 for (mb_col = 0; mb_col < cols; mb_col++)
52 fprintf(mvs, "%2d ", mi[mb_index].mbmi.ref_frame);
54 mb_index++;
57 fprintf(mvs, "\n");
58 mb_index++;
61 fprintf(mvs, "\n");
63 /* print out the macroblock UV modes */
64 mb_index = 0;
65 fprintf(mvs, "UV Modes for Frame %d\n", frame);
67 for (mb_row = 0; mb_row < rows; mb_row++)
69 for (mb_col = 0; mb_col < cols; mb_col++)
72 fprintf(mvs, "%2d ", mi[mb_index].mbmi.uv_mode);
74 mb_index++;
77 mb_index++;
78 fprintf(mvs, "\n");
81 fprintf(mvs, "\n");
83 /* print out the block modes */
84 mb_index = 0;
85 fprintf(mvs, "Mbs for Frame %d\n", frame);
87 int b_row;
89 for (b_row = 0; b_row < 4 * rows; b_row++)
91 int b_col;
92 int bindex;
94 for (b_col = 0; b_col < 4 * cols; b_col++)
96 mb_index = (b_row >> 2) * (cols + 1) + (b_col >> 2);
97 bindex = (b_row & 3) * 4 + (b_col & 3);
99 if (mi[mb_index].mbmi.mode == B_PRED)
100 fprintf(mvs, "%2d ", mi[mb_index].bmi[bindex].mode);
101 else
102 fprintf(mvs, "xx ");
106 fprintf(mvs, "\n");
109 fprintf(mvs, "\n");
111 /* print out the macroblock mvs */
112 mb_index = 0;
113 fprintf(mvs, "MVs for Frame %d\n", frame);
115 for (mb_row = 0; mb_row < rows; mb_row++)
117 for (mb_col = 0; mb_col < cols; mb_col++)
119 fprintf(mvs, "%5d:%-5d", mi[mb_index].mbmi.mv.as_mv.row / 2, mi[mb_index].mbmi.mv.as_mv.col / 2);
121 mb_index++;
124 mb_index++;
125 fprintf(mvs, "\n");
128 fprintf(mvs, "\n");
131 /* print out the block modes */
132 mb_index = 0;
133 fprintf(mvs, "MVs for Frame %d\n", frame);
135 int b_row;
137 for (b_row = 0; b_row < 4 * rows; b_row++)
139 int b_col;
140 int bindex;
142 for (b_col = 0; b_col < 4 * cols; b_col++)
144 mb_index = (b_row >> 2) * (cols + 1) + (b_col >> 2);
145 bindex = (b_row & 3) * 4 + (b_col & 3);
146 fprintf(mvs, "%3d:%-3d ", mi[mb_index].bmi[bindex].mv.as_mv.row, mi[mb_index].bmi[bindex].mv.as_mv.col);
150 fprintf(mvs, "\n");
153 fprintf(mvs, "\n");
156 fclose(mvs);