debugmodes.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /*
  2. * Copyright (c) 2010 The WebM project authors. All Rights Reserved.
  3. *
  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. */
  10. #include <stdio.h>
  11. #include "blockd.h"
  12. void vp8_print_modes_and_motion_vectors(MODE_INFO *mi, int rows, int cols, int frame)
  13. {
  14. int mb_row;
  15. int mb_col;
  16. int mb_index = 0;
  17. FILE *mvs = fopen("mvs.stt", "a");
  18. /* print out the macroblock Y modes */
  19. mb_index = 0;
  20. fprintf(mvs, "Mb Modes for Frame %d\n", frame);
  21. for (mb_row = 0; mb_row < rows; mb_row++)
  22. {
  23. for (mb_col = 0; mb_col < cols; mb_col++)
  24. {
  25. fprintf(mvs, "%2d ", mi[mb_index].mbmi.mode);
  26. mb_index++;
  27. }
  28. fprintf(mvs, "\n");
  29. mb_index++;
  30. }
  31. fprintf(mvs, "\n");
  32. mb_index = 0;
  33. fprintf(mvs, "Mb mv ref for Frame %d\n", frame);
  34. for (mb_row = 0; mb_row < rows; mb_row++)
  35. {
  36. for (mb_col = 0; mb_col < cols; mb_col++)
  37. {
  38. fprintf(mvs, "%2d ", mi[mb_index].mbmi.ref_frame);
  39. mb_index++;
  40. }
  41. fprintf(mvs, "\n");
  42. mb_index++;
  43. }
  44. fprintf(mvs, "\n");
  45. /* print out the macroblock UV modes */
  46. mb_index = 0;
  47. fprintf(mvs, "UV Modes for Frame %d\n", frame);
  48. for (mb_row = 0; mb_row < rows; mb_row++)
  49. {
  50. for (mb_col = 0; mb_col < cols; mb_col++)
  51. {
  52. fprintf(mvs, "%2d ", mi[mb_index].mbmi.uv_mode);
  53. mb_index++;
  54. }
  55. mb_index++;
  56. fprintf(mvs, "\n");
  57. }
  58. fprintf(mvs, "\n");
  59. /* print out the block modes */
  60. fprintf(mvs, "Mbs for Frame %d\n", frame);
  61. {
  62. int b_row;
  63. for (b_row = 0; b_row < 4 * rows; b_row++)
  64. {
  65. int b_col;
  66. int bindex;
  67. for (b_col = 0; b_col < 4 * cols; b_col++)
  68. {
  69. mb_index = (b_row >> 2) * (cols + 1) + (b_col >> 2);
  70. bindex = (b_row & 3) * 4 + (b_col & 3);
  71. if (mi[mb_index].mbmi.mode == B_PRED)
  72. fprintf(mvs, "%2d ", mi[mb_index].bmi[bindex].as_mode);
  73. else
  74. fprintf(mvs, "xx ");
  75. }
  76. fprintf(mvs, "\n");
  77. }
  78. }
  79. fprintf(mvs, "\n");
  80. /* print out the macroblock mvs */
  81. mb_index = 0;
  82. fprintf(mvs, "MVs for Frame %d\n", frame);
  83. for (mb_row = 0; mb_row < rows; mb_row++)
  84. {
  85. for (mb_col = 0; mb_col < cols; mb_col++)
  86. {
  87. fprintf(mvs, "%5d:%-5d", mi[mb_index].mbmi.mv.as_mv.row / 2, mi[mb_index].mbmi.mv.as_mv.col / 2);
  88. mb_index++;
  89. }
  90. mb_index++;
  91. fprintf(mvs, "\n");
  92. }
  93. fprintf(mvs, "\n");
  94. /* print out the block modes */
  95. fprintf(mvs, "MVs for Frame %d\n", frame);
  96. {
  97. int b_row;
  98. for (b_row = 0; b_row < 4 * rows; b_row++)
  99. {
  100. int b_col;
  101. int bindex;
  102. for (b_col = 0; b_col < 4 * cols; b_col++)
  103. {
  104. mb_index = (b_row >> 2) * (cols + 1) + (b_col >> 2);
  105. bindex = (b_row & 3) * 4 + (b_col & 3);
  106. fprintf(mvs, "%3d:%-3d ", mi[mb_index].bmi[bindex].mv.as_mv.row, mi[mb_index].bmi[bindex].mv.as_mv.col);
  107. }
  108. fprintf(mvs, "\n");
  109. }
  110. }
  111. fprintf(mvs, "\n");
  112. fclose(mvs);
  113. }