Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* |
michael@0 | 2 | * Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
michael@0 | 3 | * |
michael@0 | 4 | * Use of this source code is governed by a BSD-style license |
michael@0 | 5 | * that can be found in the LICENSE file in the root of the source |
michael@0 | 6 | * tree. An additional intellectual property rights grant can be found |
michael@0 | 7 | * in the file PATENTS. All contributing project authors may |
michael@0 | 8 | * be found in the AUTHORS file in the root of the source tree. |
michael@0 | 9 | */ |
michael@0 | 10 | |
michael@0 | 11 | #include <stdio.h> |
michael@0 | 12 | |
michael@0 | 13 | #include "vp9/common/vp9_blockd.h" |
michael@0 | 14 | #include "vp9/common/vp9_onyxc_int.h" |
michael@0 | 15 | |
michael@0 | 16 | static void log_frame_info(VP9_COMMON *cm, const char *str, FILE *f) { |
michael@0 | 17 | fprintf(f, "%s", str); |
michael@0 | 18 | fprintf(f, "(Frame %d, Show:%d, Q:%d): \n", cm->current_video_frame, |
michael@0 | 19 | cm->show_frame, cm->base_qindex); |
michael@0 | 20 | } |
michael@0 | 21 | /* This function dereferences a pointer to the mbmi structure |
michael@0 | 22 | * and uses the passed in member offset to print out the value of an integer |
michael@0 | 23 | * for each mbmi member value in the mi structure. |
michael@0 | 24 | */ |
michael@0 | 25 | static void print_mi_data(VP9_COMMON *cm, FILE *file, char *descriptor, |
michael@0 | 26 | size_t member_offset) { |
michael@0 | 27 | int mi_row; |
michael@0 | 28 | int mi_col; |
michael@0 | 29 | int mi_index = 0; |
michael@0 | 30 | MODE_INFO **mi_8x8 = cm->mi_grid_visible; |
michael@0 | 31 | int rows = cm->mi_rows; |
michael@0 | 32 | int cols = cm->mi_cols; |
michael@0 | 33 | char prefix = descriptor[0]; |
michael@0 | 34 | |
michael@0 | 35 | log_frame_info(cm, descriptor, file); |
michael@0 | 36 | mi_index = 0; |
michael@0 | 37 | for (mi_row = 0; mi_row < rows; mi_row++) { |
michael@0 | 38 | fprintf(file, "%c ", prefix); |
michael@0 | 39 | for (mi_col = 0; mi_col < cols; mi_col++) { |
michael@0 | 40 | fprintf(file, "%2d ", |
michael@0 | 41 | *((int*) ((char *) (&mi_8x8[mi_index]->mbmi) + |
michael@0 | 42 | member_offset))); |
michael@0 | 43 | mi_index++; |
michael@0 | 44 | } |
michael@0 | 45 | fprintf(file, "\n"); |
michael@0 | 46 | mi_index += 8; |
michael@0 | 47 | } |
michael@0 | 48 | fprintf(file, "\n"); |
michael@0 | 49 | } |
michael@0 | 50 | void vp9_print_modes_and_motion_vectors(VP9_COMMON *cm, char *file) { |
michael@0 | 51 | int mi_row; |
michael@0 | 52 | int mi_col; |
michael@0 | 53 | int mi_index = 0; |
michael@0 | 54 | FILE *mvs = fopen(file, "a"); |
michael@0 | 55 | MODE_INFO **mi_8x8 = cm->mi_grid_visible; |
michael@0 | 56 | int rows = cm->mi_rows; |
michael@0 | 57 | int cols = cm->mi_cols; |
michael@0 | 58 | |
michael@0 | 59 | print_mi_data(cm, mvs, "Partitions:", offsetof(MB_MODE_INFO, sb_type)); |
michael@0 | 60 | print_mi_data(cm, mvs, "Modes:", offsetof(MB_MODE_INFO, mode)); |
michael@0 | 61 | print_mi_data(cm, mvs, "Skips:", offsetof(MB_MODE_INFO, skip_coeff)); |
michael@0 | 62 | print_mi_data(cm, mvs, "Ref frame:", offsetof(MB_MODE_INFO, ref_frame[0])); |
michael@0 | 63 | print_mi_data(cm, mvs, "Transform:", offsetof(MB_MODE_INFO, tx_size)); |
michael@0 | 64 | print_mi_data(cm, mvs, "UV Modes:", offsetof(MB_MODE_INFO, uv_mode)); |
michael@0 | 65 | |
michael@0 | 66 | log_frame_info(cm, "Vectors ", mvs); |
michael@0 | 67 | for (mi_row = 0; mi_row < rows; mi_row++) { |
michael@0 | 68 | fprintf(mvs, "V "); |
michael@0 | 69 | for (mi_col = 0; mi_col < cols; mi_col++) { |
michael@0 | 70 | fprintf(mvs, "%4d:%4d ", mi_8x8[mi_index]->mbmi.mv[0].as_mv.row, |
michael@0 | 71 | mi_8x8[mi_index]->mbmi.mv[0].as_mv.col); |
michael@0 | 72 | mi_index++; |
michael@0 | 73 | } |
michael@0 | 74 | fprintf(mvs, "\n"); |
michael@0 | 75 | mi_index += 8; |
michael@0 | 76 | } |
michael@0 | 77 | fprintf(mvs, "\n"); |
michael@0 | 78 | |
michael@0 | 79 | fclose(mvs); |
michael@0 | 80 | } |