2 * Copyright © 2008 Intel Corporation
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 * Zhenyu Wang <zhenyu.z.wang@intel.com>
27 #include "intel_xvmc.h"
29 #define DUMPFILE "./intel_xvmc_dump"
31 static int xvmc_dump = 0;
32 static FILE *fp = NULL;
34 void intel_xvmc_dump_open(void)
41 if ((d = getenv("INTEL_XVMC_DUMP")))
45 fp = fopen(DUMPFILE, "a");
51 void intel_xvmc_dump_close(void)
59 void intel_xvmc_dump_render(XvMCContext * context,
60 unsigned int picture_structure,
61 XvMCSurface * target, XvMCSurface * past,
62 XvMCSurface * future, unsigned int flags,
63 unsigned int num_macroblocks,
64 unsigned int first_macroblock,
65 XvMCMacroBlockArray * macroblock_array,
66 XvMCBlockArray * blocks)
74 fprintf(fp, "========== new surface rendering ==========\n");
76 "Context (id:%d) (surface_type_id:%d) (width:%d) (height:%d)\n",
77 (int)context->context_id, context->surface_type_id,
78 context->width, context->height);
80 if (picture_structure == XVMC_FRAME_PICTURE)
81 fprintf(fp, "picture structure: frame picture\n");
82 else if (picture_structure == XVMC_TOP_FIELD)
83 fprintf(fp, "picture structure: top field picture (%s)\n",
84 (flags == XVMC_SECOND_FIELD) ? "second" : "first");
85 else if (picture_structure == XVMC_BOTTOM_FIELD)
86 fprintf(fp, "picture structure: bottom field picture (%s)\n",
87 (flags == XVMC_SECOND_FIELD) ? "second" : "first");
90 fprintf(fp, "picture type: I\n");
91 else if (past && !future)
92 fprintf(fp, "picture type: P\n");
93 else if (past && future)
94 fprintf(fp, "picture type: B\n");
96 fprintf(fp, "picture type: Bad!\n");
98 fprintf(fp, "target picture: id (%d) width (%d) height (%d)\n",
99 (int)target->surface_id, target->width, target->height);
101 fprintf(fp, "past picture: id (%d) width (%d) height (%d)\n",
102 (int)past->surface_id, past->width, past->height);
104 fprintf(fp, "future picture: id (%d) width (%d) height (%d)\n",
105 (int)future->surface_id, future->width, future->height);
107 fprintf(fp, "num macroblocks: %d, first macroblocks %d\n",
108 num_macroblocks, first_macroblock);
110 for (i = first_macroblock; i < (first_macroblock + num_macroblocks);
112 mb = ¯oblock_array->macro_blocks[i];
114 fprintf(fp, "- MB(%d): ", i);
115 fprintf(fp, "x (%d) y (%d) ", mb->x, mb->y);
116 fprintf(fp, "macroblock type (");
117 if (mb->macroblock_type & XVMC_MB_TYPE_MOTION_FORWARD)
118 fprintf(fp, "motion_forward ");
119 if (mb->macroblock_type & XVMC_MB_TYPE_MOTION_BACKWARD)
120 fprintf(fp, "motion_backward ");
121 if (mb->macroblock_type & XVMC_MB_TYPE_PATTERN)
122 fprintf(fp, "pattern ");
123 if (mb->macroblock_type & XVMC_MB_TYPE_INTRA)
124 fprintf(fp, "intra ");
126 fprintf(fp, "mc type ");
127 if (picture_structure == XVMC_FRAME_PICTURE) {
128 if (mb->motion_type & XVMC_PREDICTION_FIELD)
129 fprintf(fp, "(field) ");
130 else if (mb->motion_type & XVMC_PREDICTION_FRAME)
131 fprintf(fp, "(frame) ");
132 else if (mb->motion_type & XVMC_PREDICTION_DUAL_PRIME)
133 fprintf(fp, "(dual-prime) ");
135 fprintf(fp, "(unknown %d) ", mb->motion_type);
137 if (mb->motion_type & XVMC_PREDICTION_FIELD)
138 fprintf(fp, "(field) ");
139 else if (mb->motion_type & XVMC_PREDICTION_DUAL_PRIME)
140 fprintf(fp, "(dual-prime) ");
141 else if (mb->motion_type & XVMC_PREDICTION_16x8)
142 fprintf(fp, "(16x8) ");
144 fprintf(fp, "(unknown %d) ", mb->motion_type);
147 if (mb->dct_type == XVMC_DCT_TYPE_FRAME)
148 fprintf(fp, "dct type (frame) ");
149 else if (mb->dct_type == XVMC_DCT_TYPE_FIELD)
150 fprintf(fp, "dct type (field) ");
152 fprintf(fp, "coded_block_pattern (0x%x)\n",
153 mb->coded_block_pattern);