2010-05-18 17:58:33 +02:00
|
|
|
/*
|
2010-09-09 14:16:39 +02:00
|
|
|
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
|
2010-05-18 17:58:33 +02:00
|
|
|
*
|
2010-06-18 18:39:21 +02:00
|
|
|
* Use of this source code is governed by a BSD-style license
|
2010-06-04 22:19:40 +02:00
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
2010-06-18 18:39:21 +02:00
|
|
|
* in the file PATENTS. All contributing project authors may
|
2010-06-04 22:19:40 +02:00
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
2010-05-18 17:58:33 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2012-11-28 19:41:40 +01:00
|
|
|
#include "vp9/common/vp9_blockd.h"
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-11-01 00:09:17 +01:00
|
|
|
void vp9_print_modes_and_motion_vectors(MODE_INFO *mi, int rows, int cols,
|
|
|
|
int frame) {
|
2012-07-14 00:21:29 +02:00
|
|
|
int mb_row;
|
|
|
|
int mb_col;
|
|
|
|
int mb_index = 0;
|
|
|
|
FILE *mvs = fopen("mvs.stt", "a");
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
/* print out the macroblock Y modes */
|
|
|
|
mb_index = 0;
|
|
|
|
fprintf(mvs, "Mb Modes for Frame %d\n", frame);
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
for (mb_row = 0; mb_row < rows; mb_row++) {
|
|
|
|
for (mb_col = 0; mb_col < cols; mb_col++) {
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
fprintf(mvs, "%2d ", mi[mb_index].mbmi.mode);
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
mb_index++;
|
2010-05-18 17:58:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
fprintf(mvs, "\n");
|
2012-07-14 00:21:29 +02:00
|
|
|
mb_index++;
|
|
|
|
}
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
fprintf(mvs, "\n");
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
mb_index = 0;
|
|
|
|
fprintf(mvs, "Mb mv ref for Frame %d\n", frame);
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
for (mb_row = 0; mb_row < rows; mb_row++) {
|
|
|
|
for (mb_col = 0; mb_col < cols; mb_col++) {
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
fprintf(mvs, "%2d ", mi[mb_index].mbmi.ref_frame);
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
mb_index++;
|
2010-05-18 17:58:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
fprintf(mvs, "\n");
|
2012-07-14 00:21:29 +02:00
|
|
|
mb_index++;
|
|
|
|
}
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
fprintf(mvs, "\n");
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
/* print out the macroblock UV modes */
|
|
|
|
mb_index = 0;
|
|
|
|
fprintf(mvs, "UV Modes for Frame %d\n", frame);
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
for (mb_row = 0; mb_row < rows; mb_row++) {
|
|
|
|
for (mb_col = 0; mb_col < cols; mb_col++) {
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
fprintf(mvs, "%2d ", mi[mb_index].mbmi.uv_mode);
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
mb_index++;
|
2010-05-18 17:58:33 +02:00
|
|
|
}
|
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
mb_index++;
|
2010-05-18 17:58:33 +02:00
|
|
|
fprintf(mvs, "\n");
|
2012-07-14 00:21:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
fprintf(mvs, "\n");
|
|
|
|
|
|
|
|
/* print out the block modes */
|
|
|
|
mb_index = 0;
|
|
|
|
fprintf(mvs, "Mbs for Frame %d\n", frame);
|
|
|
|
{
|
|
|
|
int b_row;
|
|
|
|
|
|
|
|
for (b_row = 0; b_row < 4 * rows; b_row++) {
|
|
|
|
int b_col;
|
|
|
|
int bindex;
|
|
|
|
|
|
|
|
for (b_col = 0; b_col < 4 * cols; b_col++) {
|
|
|
|
mb_index = (b_row >> 2) * (cols + 1) + (b_col >> 2);
|
|
|
|
bindex = (b_row & 3) * 4 + (b_col & 3);
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
if (mi[mb_index].mbmi.mode == B_PRED) {
|
|
|
|
fprintf(mvs, "%2d ", mi[mb_index].bmi[bindex].as_mode.first);
|
|
|
|
} else
|
|
|
|
fprintf(mvs, "xx ");
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
}
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
fprintf(mvs, "\n");
|
2010-05-18 17:58:33 +02:00
|
|
|
}
|
2012-07-14 00:21:29 +02:00
|
|
|
}
|
|
|
|
fprintf(mvs, "\n");
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
/* print out the macroblock mvs */
|
|
|
|
mb_index = 0;
|
|
|
|
fprintf(mvs, "MVs for Frame %d\n", frame);
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
for (mb_row = 0; mb_row < rows; mb_row++) {
|
|
|
|
for (mb_col = 0; mb_col < cols; mb_col++) {
|
2012-08-10 01:07:41 +02:00
|
|
|
fprintf(mvs, "%5d:%-5d", mi[mb_index].mbmi.mv[0].as_mv.row / 2,
|
|
|
|
mi[mb_index].mbmi.mv[0].as_mv.col / 2);
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
mb_index++;
|
2010-05-18 17:58:33 +02:00
|
|
|
}
|
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
mb_index++;
|
2010-05-18 17:58:33 +02:00
|
|
|
fprintf(mvs, "\n");
|
2012-07-14 00:21:29 +02:00
|
|
|
}
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
fprintf(mvs, "\n");
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
/* print out the block modes */
|
|
|
|
mb_index = 0;
|
|
|
|
fprintf(mvs, "MVs for Frame %d\n", frame);
|
|
|
|
{
|
|
|
|
int b_row;
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
for (b_row = 0; b_row < 4 * rows; b_row++) {
|
|
|
|
int b_col;
|
|
|
|
int bindex;
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
for (b_col = 0; b_col < 4 * cols; b_col++) {
|
|
|
|
mb_index = (b_row >> 2) * (cols + 1) + (b_col >> 2);
|
|
|
|
bindex = (b_row & 3) * 4 + (b_col & 3);
|
|
|
|
fprintf(mvs, "%3d:%-3d ",
|
|
|
|
mi[mb_index].bmi[bindex].as_mv.first.as_mv.row,
|
|
|
|
mi[mb_index].bmi[bindex].as_mv.first.as_mv.col);
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
fprintf(mvs, "\n");
|
2010-05-18 17:58:33 +02:00
|
|
|
}
|
2012-07-14 00:21:29 +02:00
|
|
|
}
|
|
|
|
fprintf(mvs, "\n");
|
2010-05-18 17:58:33 +02:00
|
|
|
|
2012-07-14 00:21:29 +02:00
|
|
|
fclose(mvs);
|
2010-05-18 17:58:33 +02:00
|
|
|
}
|