michael@0: /* michael@0: * Copyright (c) 2010 The WebM project authors. All Rights Reserved. michael@0: * michael@0: * Use of this source code is governed by a BSD-style license michael@0: * that can be found in the LICENSE file in the root of the source michael@0: * tree. An additional intellectual property rights grant can be found michael@0: * in the file PATENTS. All contributing project authors may michael@0: * be found in the AUTHORS file in the root of the source tree. michael@0: */ michael@0: michael@0: #include michael@0: michael@0: #include "vp9/common/vp9_blockd.h" michael@0: #include "vp9/common/vp9_onyxc_int.h" michael@0: michael@0: static void log_frame_info(VP9_COMMON *cm, const char *str, FILE *f) { michael@0: fprintf(f, "%s", str); michael@0: fprintf(f, "(Frame %d, Show:%d, Q:%d): \n", cm->current_video_frame, michael@0: cm->show_frame, cm->base_qindex); michael@0: } michael@0: /* This function dereferences a pointer to the mbmi structure michael@0: * and uses the passed in member offset to print out the value of an integer michael@0: * for each mbmi member value in the mi structure. michael@0: */ michael@0: static void print_mi_data(VP9_COMMON *cm, FILE *file, char *descriptor, michael@0: size_t member_offset) { michael@0: int mi_row; michael@0: int mi_col; michael@0: int mi_index = 0; michael@0: MODE_INFO **mi_8x8 = cm->mi_grid_visible; michael@0: int rows = cm->mi_rows; michael@0: int cols = cm->mi_cols; michael@0: char prefix = descriptor[0]; michael@0: michael@0: log_frame_info(cm, descriptor, file); michael@0: mi_index = 0; michael@0: for (mi_row = 0; mi_row < rows; mi_row++) { michael@0: fprintf(file, "%c ", prefix); michael@0: for (mi_col = 0; mi_col < cols; mi_col++) { michael@0: fprintf(file, "%2d ", michael@0: *((int*) ((char *) (&mi_8x8[mi_index]->mbmi) + michael@0: member_offset))); michael@0: mi_index++; michael@0: } michael@0: fprintf(file, "\n"); michael@0: mi_index += 8; michael@0: } michael@0: fprintf(file, "\n"); michael@0: } michael@0: void vp9_print_modes_and_motion_vectors(VP9_COMMON *cm, char *file) { michael@0: int mi_row; michael@0: int mi_col; michael@0: int mi_index = 0; michael@0: FILE *mvs = fopen(file, "a"); michael@0: MODE_INFO **mi_8x8 = cm->mi_grid_visible; michael@0: int rows = cm->mi_rows; michael@0: int cols = cm->mi_cols; michael@0: michael@0: print_mi_data(cm, mvs, "Partitions:", offsetof(MB_MODE_INFO, sb_type)); michael@0: print_mi_data(cm, mvs, "Modes:", offsetof(MB_MODE_INFO, mode)); michael@0: print_mi_data(cm, mvs, "Skips:", offsetof(MB_MODE_INFO, skip_coeff)); michael@0: print_mi_data(cm, mvs, "Ref frame:", offsetof(MB_MODE_INFO, ref_frame[0])); michael@0: print_mi_data(cm, mvs, "Transform:", offsetof(MB_MODE_INFO, tx_size)); michael@0: print_mi_data(cm, mvs, "UV Modes:", offsetof(MB_MODE_INFO, uv_mode)); michael@0: michael@0: log_frame_info(cm, "Vectors ", mvs); michael@0: for (mi_row = 0; mi_row < rows; mi_row++) { michael@0: fprintf(mvs, "V "); michael@0: for (mi_col = 0; mi_col < cols; mi_col++) { michael@0: fprintf(mvs, "%4d:%4d ", mi_8x8[mi_index]->mbmi.mv[0].as_mv.row, michael@0: mi_8x8[mi_index]->mbmi.mv[0].as_mv.col); michael@0: mi_index++; michael@0: } michael@0: fprintf(mvs, "\n"); michael@0: mi_index += 8; michael@0: } michael@0: fprintf(mvs, "\n"); michael@0: michael@0: fclose(mvs); michael@0: }