media/libvpx/vp8/common/debugmodes.c

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/libvpx/vp8/common/debugmodes.c	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,157 @@
     1.4 +/*
     1.5 + *  Copyright (c) 2010 The WebM project authors. All Rights Reserved.
     1.6 + *
     1.7 + *  Use of this source code is governed by a BSD-style license
     1.8 + *  that can be found in the LICENSE file in the root of the source
     1.9 + *  tree. An additional intellectual property rights grant can be found
    1.10 + *  in the file PATENTS.  All contributing project authors may
    1.11 + *  be found in the AUTHORS file in the root of the source tree.
    1.12 + */
    1.13 +
    1.14 +
    1.15 +#include <stdio.h>
    1.16 +#include "blockd.h"
    1.17 +
    1.18 +
    1.19 +void vp8_print_modes_and_motion_vectors(MODE_INFO *mi, int rows, int cols, int frame)
    1.20 +{
    1.21 +
    1.22 +    int mb_row;
    1.23 +    int mb_col;
    1.24 +    int mb_index = 0;
    1.25 +    FILE *mvs = fopen("mvs.stt", "a");
    1.26 +
    1.27 +    /* print out the macroblock Y modes */
    1.28 +    mb_index = 0;
    1.29 +    fprintf(mvs, "Mb Modes for Frame %d\n", frame);
    1.30 +
    1.31 +    for (mb_row = 0; mb_row < rows; mb_row++)
    1.32 +    {
    1.33 +        for (mb_col = 0; mb_col < cols; mb_col++)
    1.34 +        {
    1.35 +
    1.36 +            fprintf(mvs, "%2d ", mi[mb_index].mbmi.mode);
    1.37 +
    1.38 +            mb_index++;
    1.39 +        }
    1.40 +
    1.41 +        fprintf(mvs, "\n");
    1.42 +        mb_index++;
    1.43 +    }
    1.44 +
    1.45 +    fprintf(mvs, "\n");
    1.46 +
    1.47 +    mb_index = 0;
    1.48 +    fprintf(mvs, "Mb mv ref for Frame %d\n", frame);
    1.49 +
    1.50 +    for (mb_row = 0; mb_row < rows; mb_row++)
    1.51 +    {
    1.52 +        for (mb_col = 0; mb_col < cols; mb_col++)
    1.53 +        {
    1.54 +
    1.55 +            fprintf(mvs, "%2d ", mi[mb_index].mbmi.ref_frame);
    1.56 +
    1.57 +            mb_index++;
    1.58 +        }
    1.59 +
    1.60 +        fprintf(mvs, "\n");
    1.61 +        mb_index++;
    1.62 +    }
    1.63 +
    1.64 +    fprintf(mvs, "\n");
    1.65 +
    1.66 +    /* print out the macroblock UV modes */
    1.67 +    mb_index = 0;
    1.68 +    fprintf(mvs, "UV Modes for Frame %d\n", frame);
    1.69 +
    1.70 +    for (mb_row = 0; mb_row < rows; mb_row++)
    1.71 +    {
    1.72 +        for (mb_col = 0; mb_col < cols; mb_col++)
    1.73 +        {
    1.74 +
    1.75 +            fprintf(mvs, "%2d ", mi[mb_index].mbmi.uv_mode);
    1.76 +
    1.77 +            mb_index++;
    1.78 +        }
    1.79 +
    1.80 +        mb_index++;
    1.81 +        fprintf(mvs, "\n");
    1.82 +    }
    1.83 +
    1.84 +    fprintf(mvs, "\n");
    1.85 +
    1.86 +    /* print out the block modes */
    1.87 +    mb_index = 0;
    1.88 +    fprintf(mvs, "Mbs for Frame %d\n", frame);
    1.89 +    {
    1.90 +        int b_row;
    1.91 +
    1.92 +        for (b_row = 0; b_row < 4 * rows; b_row++)
    1.93 +        {
    1.94 +            int b_col;
    1.95 +            int bindex;
    1.96 +
    1.97 +            for (b_col = 0; b_col < 4 * cols; b_col++)
    1.98 +            {
    1.99 +                mb_index = (b_row >> 2) * (cols + 1) + (b_col >> 2);
   1.100 +                bindex = (b_row & 3) * 4 + (b_col & 3);
   1.101 +
   1.102 +                if (mi[mb_index].mbmi.mode == B_PRED)
   1.103 +                    fprintf(mvs, "%2d ", mi[mb_index].bmi[bindex].as_mode);
   1.104 +                else
   1.105 +                    fprintf(mvs, "xx ");
   1.106 +
   1.107 +            }
   1.108 +
   1.109 +            fprintf(mvs, "\n");
   1.110 +        }
   1.111 +    }
   1.112 +    fprintf(mvs, "\n");
   1.113 +
   1.114 +    /* print out the macroblock mvs */
   1.115 +    mb_index = 0;
   1.116 +    fprintf(mvs, "MVs for Frame %d\n", frame);
   1.117 +
   1.118 +    for (mb_row = 0; mb_row < rows; mb_row++)
   1.119 +    {
   1.120 +        for (mb_col = 0; mb_col < cols; mb_col++)
   1.121 +        {
   1.122 +            fprintf(mvs, "%5d:%-5d", mi[mb_index].mbmi.mv.as_mv.row / 2, mi[mb_index].mbmi.mv.as_mv.col / 2);
   1.123 +
   1.124 +            mb_index++;
   1.125 +        }
   1.126 +
   1.127 +        mb_index++;
   1.128 +        fprintf(mvs, "\n");
   1.129 +    }
   1.130 +
   1.131 +    fprintf(mvs, "\n");
   1.132 +
   1.133 +
   1.134 +    /* print out the block modes */
   1.135 +    mb_index = 0;
   1.136 +    fprintf(mvs, "MVs for Frame %d\n", frame);
   1.137 +    {
   1.138 +        int b_row;
   1.139 +
   1.140 +        for (b_row = 0; b_row < 4 * rows; b_row++)
   1.141 +        {
   1.142 +            int b_col;
   1.143 +            int bindex;
   1.144 +
   1.145 +            for (b_col = 0; b_col < 4 * cols; b_col++)
   1.146 +            {
   1.147 +                mb_index = (b_row >> 2) * (cols + 1) + (b_col >> 2);
   1.148 +                bindex = (b_row & 3) * 4 + (b_col & 3);
   1.149 +                fprintf(mvs, "%3d:%-3d ", mi[mb_index].bmi[bindex].mv.as_mv.row, mi[mb_index].bmi[bindex].mv.as_mv.col);
   1.150 +
   1.151 +            }
   1.152 +
   1.153 +            fprintf(mvs, "\n");
   1.154 +        }
   1.155 +    }
   1.156 +    fprintf(mvs, "\n");
   1.157 +
   1.158 +
   1.159 +    fclose(mvs);
   1.160 +}

mercurial