3 * Copyright (c) 2009-2011 Intel Corporation. All Rights Reserved.
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sub license, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial portions
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
20 * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
21 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 #include "va_enc_h264.h"
29 #include "va_backend.h"
31 #include "va_enc_h264.h"
32 #include "va_dec_jpeg.h"
33 #include "va_dec_vp8.h"
42 #include <sys/types.h>
49 * Env. to debug some issue, e.g. the decode/encode issue in a video conference scenerio:
50 * .LIBVA_TRACE=log_file: general VA parameters saved into log_file
51 * .LIBVA_TRACE_BUFDATA: dump all VA data buffer into log_file
52 * .LIBVA_TRACE_CODEDBUF=coded_clip_file: save the coded clip into file coded_clip_file
53 * .LIBVA_TRACE_SURFACE=yuv_file: save surface YUV into file yuv_file. Use file name to determine
54 * decode/encode or jpeg surfaces
55 * .LIBVA_TRACE_SURFACE_GEOMETRY=WIDTHxHEIGHT+XOFF+YOFF: only save part of surface context into file
56 * due to storage bandwidth limitation
64 /* per context settings */
65 struct trace_context {
67 FILE *trace_fp_log; /* save the log into a file */
68 char *trace_log_fn; /* file name */
70 /* LIBVA_TRACE_CODEDBUF */
71 FILE *trace_fp_codedbuf; /* save the encode result into a file */
72 char *trace_codedbuf_fn; /* file name */
74 /* LIBVA_TRACE_SURFACE */
75 FILE *trace_fp_surface; /* save the surface YUV into a file */
76 char *trace_surface_fn; /* file name */
78 VAContextID trace_context; /* current context */
80 VASurfaceID trace_rendertarget; /* current render target */
81 VAProfile trace_profile; /* current profile for buffers */
82 VAEntrypoint trace_entrypoint; /* current entrypoint */
84 unsigned int trace_frame_no; /* current frame NO */
85 unsigned int trace_slice_no; /* current slice NO */
86 unsigned int trace_slice_size; /* current slice buffer size */
88 unsigned int trace_surface_width; /* surface dumping geometry */
89 unsigned int trace_surface_height;
90 unsigned int trace_surface_xoff;
91 unsigned int trace_surface_yoff;
93 unsigned int trace_frame_width; /* current frame width */
94 unsigned int trace_frame_height; /* current frame height */
97 #define TRACE_CTX(dpy) ((struct trace_context *)((VADisplayContextP)dpy)->vatrace)
99 #define DPY2TRACECTX(dpy) \
100 struct trace_context *trace_ctx = TRACE_CTX(dpy); \
102 if (trace_ctx == NULL) \
105 #define TRACE_FUNCNAME(idx) va_TraceMsg(trace_ctx, "==========%s\n", __func__);
107 /* Prototype declarations (functions defined in va.c) */
109 void va_errorMessage(const char *msg, ...);
110 void va_infoMessage(const char *msg, ...);
112 int va_parseConfig(char *env, char *env_value);
114 VAStatus vaBufferInfo(
116 VAContextID context, /* in */
117 VABufferID buf_id, /* in */
118 VABufferType *type, /* out */
119 unsigned int *size, /* out */
120 unsigned int *num_elements /* out */
123 VAStatus vaLockSurface(VADisplay dpy,
125 unsigned int *fourcc, /* following are output argument */
126 unsigned int *luma_stride,
127 unsigned int *chroma_u_stride,
128 unsigned int *chroma_v_stride,
129 unsigned int *luma_offset,
130 unsigned int *chroma_u_offset,
131 unsigned int *chroma_v_offset,
132 unsigned int *buffer_name,
136 VAStatus vaUnlockSurface(VADisplay dpy,
140 #define FILE_NAME_SUFFIX(env_value) \
142 int tmp = strnlen(env_value, sizeof(env_value)); \
143 int left = sizeof(env_value) - tmp; \
145 snprintf(env_value+tmp, \
149 (unsigned long)trace_ctx); \
152 void va_TraceInit(VADisplay dpy)
154 char env_value[1024];
155 unsigned short suffix = 0xffff & ((unsigned int)time(NULL));
158 struct trace_context *trace_ctx = calloc(sizeof(struct trace_context), 1);
160 if (trace_ctx == NULL)
163 if (va_parseConfig("LIBVA_TRACE", &env_value[0]) == 0) {
164 FILE_NAME_SUFFIX(env_value);
165 trace_ctx->trace_log_fn = strdup(env_value);
167 tmp = fopen(env_value, "w");
169 trace_ctx->trace_fp_log = tmp;
170 va_infoMessage("LIBVA_TRACE is on, save log into %s\n", trace_ctx->trace_log_fn);
171 trace_flag = VA_TRACE_FLAG_LOG;
173 va_errorMessage("Open file %s failed (%s)\n", env_value, strerror(errno));
176 /* may re-get the global settings for multiple context */
177 if ((trace_flag & VA_TRACE_FLAG_LOG) && (va_parseConfig("LIBVA_TRACE_BUFDATA", NULL) == 0)) {
178 trace_flag |= VA_TRACE_FLAG_BUFDATA;
179 va_infoMessage("LIBVA_TRACE_BUFDATA is on, dump buffer into log file\n");
182 /* per-context setting */
183 if (va_parseConfig("LIBVA_TRACE_CODEDBUF", &env_value[0]) == 0) {
184 FILE_NAME_SUFFIX(env_value);
185 trace_ctx->trace_codedbuf_fn = strdup(env_value);
186 va_infoMessage("LIBVA_TRACE_CODEDBUF is on, save codedbuf into log file %s\n",
187 trace_ctx->trace_codedbuf_fn);
188 trace_flag |= VA_TRACE_FLAG_CODEDBUF;
191 if (va_parseConfig("LIBVA_TRACE_SURFACE", &env_value[0]) == 0) {
192 FILE_NAME_SUFFIX(env_value);
193 trace_ctx->trace_surface_fn = strdup(env_value);
195 va_infoMessage("LIBVA_TRACE_SURFACE is on, save surface into %s\n",
196 trace_ctx->trace_surface_fn);
198 /* for surface data dump, it is time-consume, and may
199 * cause some side-effect, so only trace the needed surfaces
200 * to trace encode surface, set the trace file name to sth like *enc*
201 * to trace decode surface, set the trace file name to sth like *dec*
202 * if no dec/enc in file name, set both
204 if (strstr(env_value, "dec"))
205 trace_flag |= VA_TRACE_FLAG_SURFACE_DECODE;
206 if (strstr(env_value, "enc"))
207 trace_flag |= VA_TRACE_FLAG_SURFACE_ENCODE;
208 if (strstr(env_value, "jpeg") || strstr(env_value, "jpg"))
209 trace_flag |= VA_TRACE_FLAG_SURFACE_JPEG;
211 if (va_parseConfig("LIBVA_TRACE_SURFACE_GEOMETRY", &env_value[0]) == 0) {
212 char *p = env_value, *q;
214 trace_ctx->trace_surface_width = strtod(p, &q);
215 p = q+1; /* skip "x" */
216 trace_ctx->trace_surface_height = strtod(p, &q);
217 p = q+1; /* skip "+" */
218 trace_ctx->trace_surface_xoff = strtod(p, &q);
219 p = q+1; /* skip "+" */
220 trace_ctx->trace_surface_yoff = strtod(p, &q);
222 va_infoMessage("LIBVA_TRACE_SURFACE_GEOMETRY is on, only dump surface %dx%d+%d+%d content\n",
223 trace_ctx->trace_surface_width,
224 trace_ctx->trace_surface_height,
225 trace_ctx->trace_surface_xoff,
226 trace_ctx->trace_surface_yoff);
230 ((VADisplayContextP)dpy)->vatrace = trace_ctx;
234 void va_TraceEnd(VADisplay dpy)
238 if (trace_ctx->trace_fp_log)
239 fclose(trace_ctx->trace_fp_log);
241 if (trace_ctx->trace_fp_codedbuf)
242 fclose(trace_ctx->trace_fp_codedbuf);
244 if (trace_ctx->trace_fp_surface)
245 fclose(trace_ctx->trace_fp_surface);
247 if (trace_ctx->trace_log_fn)
248 free(trace_ctx->trace_log_fn);
250 if (trace_ctx->trace_codedbuf_fn)
251 free(trace_ctx->trace_codedbuf_fn);
253 if (trace_ctx->trace_surface_fn)
254 free(trace_ctx->trace_surface_fn);
257 ((VADisplayContextP)dpy)->vatrace = NULL;
261 void va_TraceMsg(struct trace_context *trace_ctx, const char *msg, ...)
265 if (!(trace_flag & VA_TRACE_FLAG_LOG))
271 if (gettimeofday(&tv, NULL) == 0)
272 fprintf(trace_ctx->trace_fp_log, "[%04d.%06d] ",
273 (unsigned int)tv.tv_sec & 0xffff, (unsigned int)tv.tv_usec);
275 vfprintf(trace_ctx->trace_fp_log, msg, args);
278 fflush(trace_ctx->trace_fp_log);
282 void va_TraceSurface(VADisplay dpy)
285 unsigned int fourcc; /* following are output argument */
286 unsigned int luma_stride;
287 unsigned int chroma_u_stride;
288 unsigned int chroma_v_stride;
289 unsigned int luma_offset;
290 unsigned int chroma_u_offset;
291 unsigned int chroma_v_offset;
292 unsigned int buffer_name;
294 unsigned char *Y_data, *UV_data, *tmp;
296 unsigned char check_sum = 0;
299 if (!trace_ctx->trace_fp_surface)
302 va_TraceMsg(trace_ctx, "==========dump surface data in file %s\n", trace_ctx->trace_surface_fn);
304 va_TraceMsg(trace_ctx, NULL);
306 va_status = vaLockSurface(
308 trace_ctx->trace_rendertarget,
310 &luma_stride, &chroma_u_stride, &chroma_v_stride,
311 &luma_offset, &chroma_u_offset, &chroma_v_offset,
312 &buffer_name, &buffer);
314 if (va_status != VA_STATUS_SUCCESS) {
315 va_TraceMsg(trace_ctx, "Error:vaLockSurface failed\n");
319 va_TraceMsg(trace_ctx, "\tfourcc = 0x%08x\n", fourcc);
320 va_TraceMsg(trace_ctx, "\twidth = %d\n", trace_ctx->trace_frame_width);
321 va_TraceMsg(trace_ctx, "\theight = %d\n", trace_ctx->trace_frame_height);
322 va_TraceMsg(trace_ctx, "\tluma_stride = %d\n", luma_stride);
323 va_TraceMsg(trace_ctx, "\tchroma_u_stride = %d\n", chroma_u_stride);
324 va_TraceMsg(trace_ctx, "\tchroma_v_stride = %d\n", chroma_v_stride);
325 va_TraceMsg(trace_ctx, "\tluma_offset = %d\n", luma_offset);
326 va_TraceMsg(trace_ctx, "\tchroma_u_offset = %d\n", chroma_u_offset);
327 va_TraceMsg(trace_ctx, "\tchroma_v_offset = %d\n", chroma_v_offset);
329 if (buffer == NULL) {
330 va_TraceMsg(trace_ctx, "Error:vaLockSurface return NULL buffer\n");
331 va_TraceMsg(trace_ctx, NULL);
333 vaUnlockSurface(dpy, trace_ctx->trace_rendertarget);
336 va_TraceMsg(trace_ctx, "\tbuffer location = 0x%08x\n", buffer);
337 va_TraceMsg(trace_ctx, NULL);
339 Y_data = (unsigned char*)buffer;
340 UV_data = (unsigned char*)buffer + chroma_u_offset;
342 tmp = Y_data + luma_stride * trace_ctx->trace_surface_yoff;
343 for (i=0; i<trace_ctx->trace_surface_height; i++) {
344 fwrite(tmp + trace_ctx->trace_surface_xoff,
345 trace_ctx->trace_surface_width,
346 1, trace_ctx->trace_fp_surface);
350 tmp = UV_data + chroma_u_stride * trace_ctx->trace_surface_yoff / 2;
351 if (fourcc == VA_FOURCC_NV12) {
352 for (i=0; i<trace_ctx->trace_surface_height/2; i++) {
353 fwrite(tmp + trace_ctx->trace_surface_xoff,
354 trace_ctx->trace_surface_width,
355 1, trace_ctx->trace_fp_surface);
357 tmp += chroma_u_stride;
361 vaUnlockSurface(dpy, trace_ctx->trace_rendertarget);
363 va_TraceMsg(trace_ctx, NULL);
367 void va_TraceInitialize (
369 int *major_version, /* out */
370 int *minor_version /* out */
377 void va_TraceTerminate (
386 void va_TraceCreateConfig(
389 VAEntrypoint entrypoint,
390 VAConfigAttrib *attrib_list,
392 VAConfigID *config_id /* out */
396 int encode, decode, jpeg;
401 va_TraceMsg(trace_ctx, "\tprofile = %d\n", profile);
402 va_TraceMsg(trace_ctx, "\tentrypoint = %d\n", entrypoint);
403 va_TraceMsg(trace_ctx, "\tnum_attribs = %d\n", num_attribs);
405 for (i = 0; i < num_attribs; i++) {
406 va_TraceMsg(trace_ctx, "\t\tattrib_list[%d].type = 0x%08x\n", i, attrib_list[i].type);
407 va_TraceMsg(trace_ctx, "\t\tattrib_list[%d].value = 0x%08x\n", i, attrib_list[i].value);
410 va_TraceMsg(trace_ctx, NULL);
412 trace_ctx->trace_profile = profile;
413 trace_ctx->trace_entrypoint = entrypoint;
415 /* avoid to create so many empty files */
416 encode = (trace_ctx->trace_entrypoint == VAEntrypointEncSlice);
417 decode = (trace_ctx->trace_entrypoint == VAEntrypointVLD);
418 jpeg = (trace_ctx->trace_entrypoint == VAEntrypointEncPicture);
419 if ((encode && (trace_flag & VA_TRACE_FLAG_SURFACE_ENCODE)) ||
420 (decode && (trace_flag & VA_TRACE_FLAG_SURFACE_DECODE)) ||
421 (jpeg && (trace_flag & VA_TRACE_FLAG_SURFACE_JPEG))) {
422 FILE *tmp = fopen(trace_ctx->trace_surface_fn, "w");
425 trace_ctx->trace_fp_surface = tmp;
427 va_errorMessage("Open file %s failed (%s)\n",
428 trace_ctx->trace_surface_fn,
430 trace_ctx->trace_fp_surface = NULL;
431 trace_flag &= ~(VA_TRACE_FLAG_SURFACE);
435 if (encode && (trace_flag & VA_TRACE_FLAG_CODEDBUF)) {
436 FILE *tmp = fopen(trace_ctx->trace_codedbuf_fn, "w");
439 trace_ctx->trace_fp_codedbuf = tmp;
441 va_errorMessage("Open file %s failed (%s)\n",
442 trace_ctx->trace_codedbuf_fn,
444 trace_ctx->trace_fp_codedbuf = NULL;
445 trace_flag &= ~VA_TRACE_FLAG_CODEDBUF;
450 static void va_TraceSurfaceAttributes(
451 struct trace_context *trace_ctx,
452 VASurfaceAttrib *attrib_list,
453 unsigned int *num_attribs
459 if (!attrib_list || !num_attribs)
464 if (num > VASurfaceAttribCount)
465 num = VASurfaceAttribCount;
467 for (i=0; i<num; i++) {
468 int type = p->value.type;
470 va_TraceMsg(trace_ctx, "\tattrib_list[%i] =\n", i);
472 va_TraceMsg(trace_ctx, "\t\ttype = %d\n", p->type);
473 va_TraceMsg(trace_ctx, "\t\tflags = %d\n", p->flags);
474 va_TraceMsg(trace_ctx, "\t\tvalue.type = %d\n", type);
476 case VAGenericValueTypeInteger:
477 va_TraceMsg(trace_ctx, "\t\tvalue.value.i = 0x%08x\n", p->value.value.i);
479 case VAGenericValueTypeFloat:
480 va_TraceMsg(trace_ctx, "\t\tvalue.value.f = %f\n", p->value.value.f);
482 case VAGenericValueTypePointer:
483 va_TraceMsg(trace_ctx, "\t\tvalue.value.p = %p\n", p->value.value.p);
484 if ((p->type == VASurfaceAttribExternalBufferDescriptor) && p->value.value.p) {
485 VASurfaceAttribExternalBuffers *tmp = (VASurfaceAttribExternalBuffers *) p->value.value.p;
488 va_TraceMsg(trace_ctx, "\t\t--VASurfaceAttribExternalBufferDescriptor\n");
489 va_TraceMsg(trace_ctx, "\t\t pixel_format=0x%08x\n", tmp->pixel_format);
490 va_TraceMsg(trace_ctx, "\t\t width=%d\n", tmp->width);
491 va_TraceMsg(trace_ctx, "\t\t height=%d\n", tmp->height);
492 va_TraceMsg(trace_ctx, "\t\t data_size=%d\n", tmp->data_size);
493 va_TraceMsg(trace_ctx, "\t\t num_planes=%d\n", tmp->num_planes);
494 va_TraceMsg(trace_ctx, "\t\t pitches[4]=%d %d %d %d\n",
495 tmp->pitches[0], tmp->pitches[1], tmp->pitches[2], tmp->pitches[3]);
496 va_TraceMsg(trace_ctx, "\t\t offsets[4]=%d %d %d %d\n",
497 tmp->offsets[0], tmp->offsets[1], tmp->offsets[2], tmp->offsets[3]);
498 va_TraceMsg(trace_ctx, "\t\t flags=0x%08x\n", tmp->flags);
499 va_TraceMsg(trace_ctx, "\t\t num_buffers=0x%08x\n", tmp->num_buffers);
500 va_TraceMsg(trace_ctx, "\t\t buffers=%p\n", tmp->buffers);
501 for (j = 0; j < tmp->num_buffers; j++) {
502 va_TraceMsg(trace_ctx, "\t\t\tbuffers[%d]=%p\n", j, tmp->buffers[j]);
506 case VAGenericValueTypeFunc:
507 va_TraceMsg(trace_ctx, "\t\tvalue.value.fn = %p\n", p->value.value.fn);
517 void va_TraceCreateSurfaces(
523 VASurfaceID *surfaces, /* out */
524 VASurfaceAttrib *attrib_list,
525 unsigned int num_attribs
533 va_TraceMsg(trace_ctx, "\twidth = %d\n", width);
534 va_TraceMsg(trace_ctx, "\theight = %d\n", height);
535 va_TraceMsg(trace_ctx, "\tformat = %d\n", format);
536 va_TraceMsg(trace_ctx, "\tnum_surfaces = %d\n", num_surfaces);
539 for (i = 0; i < num_surfaces; i++)
540 va_TraceMsg(trace_ctx, "\t\tsurfaces[%d] = 0x%08x\n", i, surfaces[i]);
543 va_TraceSurfaceAttributes(trace_ctx, attrib_list, &num_attribs);
545 va_TraceMsg(trace_ctx, NULL);
549 void va_TraceDestroySurfaces(
551 VASurfaceID *surface_list,
561 for (i = 0; i < num_surfaces; i++)
562 va_TraceMsg(trace_ctx, "\t\tsurfaces[%d] = 0x%08x\n", i, surface_list[i]);
565 va_TraceMsg(trace_ctx, NULL);
569 void va_TraceCreateContext(
571 VAConfigID config_id,
575 VASurfaceID *render_targets,
576 int num_render_targets,
577 VAContextID *context /* out */
585 va_TraceMsg(trace_ctx, "\tconfig = 0x%08x\n", config_id);
586 va_TraceMsg(trace_ctx, "\twidth = %d\n", picture_width);
587 va_TraceMsg(trace_ctx, "\theight = %d\n", picture_height);
588 va_TraceMsg(trace_ctx, "\tflag = 0x%08x\n", flag);
589 va_TraceMsg(trace_ctx, "\tnum_render_targets = %d\n", num_render_targets);
590 if (render_targets) {
591 for (i=0; i<num_render_targets; i++)
592 va_TraceMsg(trace_ctx, "\t\trender_targets[%d] = 0x%08x\n", i, render_targets[i]);
595 va_TraceMsg(trace_ctx, "\tcontext = 0x%08x\n", *context);
596 trace_ctx->trace_context = *context;
598 trace_ctx->trace_context = VA_INVALID_ID;
600 trace_ctx->trace_frame_no = 0;
601 trace_ctx->trace_slice_no = 0;
603 trace_ctx->trace_frame_width = picture_width;
604 trace_ctx->trace_frame_height = picture_height;
606 if (trace_ctx->trace_surface_width == 0)
607 trace_ctx->trace_surface_width = picture_width;
608 if (trace_ctx->trace_surface_height == 0)
609 trace_ctx->trace_surface_height = picture_height;
613 static char * buffer_type_to_string(int type)
616 case VAPictureParameterBufferType: return "VAPictureParameterBufferType";
617 case VAIQMatrixBufferType: return "VAIQMatrixBufferType";
618 case VABitPlaneBufferType: return "VABitPlaneBufferType";
619 case VASliceGroupMapBufferType: return "VASliceGroupMapBufferType";
620 case VASliceParameterBufferType: return "VASliceParameterBufferType";
621 case VASliceDataBufferType: return "VASliceDataBufferType";
622 case VAProtectedSliceDataBufferType: return "VAProtectedSliceDataBufferType";
623 case VAMacroblockParameterBufferType: return "VAMacroblockParameterBufferType";
624 case VAResidualDataBufferType: return "VAResidualDataBufferType";
625 case VADeblockingParameterBufferType: return "VADeblockingParameterBufferType";
626 case VAImageBufferType: return "VAImageBufferType";
627 case VAQMatrixBufferType: return "VAQMatrixBufferType";
628 case VAHuffmanTableBufferType: return "VAHuffmanTableBufferType";
629 /* Following are encode buffer types */
630 case VAEncCodedBufferType: return "VAEncCodedBufferType";
631 case VAEncSequenceParameterBufferType: return "VAEncSequenceParameterBufferType";
632 case VAEncPictureParameterBufferType: return "VAEncPictureParameterBufferType";
633 case VAEncSliceParameterBufferType: return "VAEncSliceParameterBufferType";
634 case VAEncPackedHeaderParameterBufferType: return "VAEncPackedHeaderParameterBufferType";
635 case VAEncPackedHeaderDataBufferType: return "VAEncPackedHeaderDataBufferType";
636 case VAEncMiscParameterBufferType: return "VAEncMiscParameterBufferType";
637 case VAEncMacroblockParameterBufferType: return "VAEncMacroblockParameterBufferType";
638 case VAProcPipelineParameterBufferType: return "VAProcPipelineParameterBufferType";
639 case VAProcFilterParameterBufferType: return "VAProcFilterParameterBufferType";
640 default: return "UnknowBuffer";
644 void va_TraceCreateBuffer (
646 VAContextID context, /* in */
647 VABufferType type, /* in */
648 unsigned int size, /* in */
649 unsigned int num_elements, /* in */
651 VABufferID *buf_id /* out */
656 /* only trace CodedBuffer */
657 if (type != VAEncCodedBufferType)
661 va_TraceMsg(trace_ctx, "\tbuf_type=%s\n", buffer_type_to_string(type));
663 va_TraceMsg(trace_ctx, "\tbuf_id=0x%x\n", *buf_id);
664 va_TraceMsg(trace_ctx, "\tsize=%d\n", size);
665 va_TraceMsg(trace_ctx, "\tnum_elements=%d\n", num_elements);
667 va_TraceMsg(trace_ctx, NULL);
670 void va_TraceDestroyBuffer (
672 VABufferID buf_id /* in */
677 unsigned int num_elements;
679 VACodedBufferSegment *buf_list;
684 vaBufferInfo(dpy, trace_ctx->trace_context, buf_id, &type, &size, &num_elements);
686 /* only trace CodedBuffer */
687 if (type != VAEncCodedBufferType)
691 va_TraceMsg(trace_ctx, "\tbuf_type=%s\n", buffer_type_to_string(type));
692 va_TraceMsg(trace_ctx, "\tbuf_id=0x%x\n", buf_id);
693 va_TraceMsg(trace_ctx, "\tsize=%d\n", size);
694 va_TraceMsg(trace_ctx, "\tnum_elements=%d\n", num_elements);
696 va_TraceMsg(trace_ctx, NULL);
700 void va_TraceMapBuffer (
702 VABufferID buf_id, /* in */
703 void **pbuf /* out */
708 unsigned int num_elements;
710 VACodedBufferSegment *buf_list;
715 vaBufferInfo(dpy, trace_ctx->trace_context, buf_id, &type, &size, &num_elements);
717 /* only trace CodedBuffer */
718 if (type != VAEncCodedBufferType)
722 va_TraceMsg(trace_ctx, "\tbuf_id=0x%x\n", buf_id);
723 va_TraceMsg(trace_ctx, "\tbuf_type=%s\n", buffer_type_to_string(type));
724 if ((pbuf == NULL) || (*pbuf == NULL))
727 buf_list = (VACodedBufferSegment *)(*pbuf);
728 while (buf_list != NULL) {
729 va_TraceMsg(trace_ctx, "\tCodedbuf[%d] =\n", i++);
731 va_TraceMsg(trace_ctx, "\t size = %d\n", buf_list->size);
732 va_TraceMsg(trace_ctx, "\t bit_offset = %d\n", buf_list->bit_offset);
733 va_TraceMsg(trace_ctx, "\t status = 0x%08x\n", buf_list->status);
734 va_TraceMsg(trace_ctx, "\t reserved = 0x%08x\n", buf_list->reserved);
735 va_TraceMsg(trace_ctx, "\t buf = 0x%08x\n", buf_list->buf);
737 if (trace_ctx->trace_fp_codedbuf) {
738 va_TraceMsg(trace_ctx, "\tDump the content to file\n");
739 fwrite(buf_list->buf, buf_list->size, 1, trace_ctx->trace_fp_codedbuf);
742 buf_list = buf_list->next;
744 va_TraceMsg(trace_ctx, NULL);
747 static void va_TraceVABuffers(
753 unsigned int num_elements,
758 unsigned char *p = pbuf;
762 va_TraceMsg(trace_ctx, "--%s\n", buffer_type_to_string(type));
764 if ((trace_flag & VA_TRACE_FLAG_BUFDATA) && trace_ctx->trace_fp_log) {
765 for (i=0; i<size; i++) {
766 unsigned char value = p[i];
769 fprintf(trace_ctx->trace_fp_log, "\t\t0x%04x:", i);
770 else if ((i%16) == 0)
771 fprintf(trace_ctx->trace_fp_log, "\n\t\t0x%04x:", i);
773 fprintf(trace_ctx->trace_fp_log, " %02x", value);
775 fprintf(trace_ctx->trace_fp_log, "\n");
778 va_TraceMsg(trace_ctx, NULL);
784 static void va_TraceVAPictureParameterBufferMPEG2(
790 unsigned int num_elements,
793 VAPictureParameterBufferMPEG2 *p=(VAPictureParameterBufferMPEG2 *)data;
796 va_TraceMsg(trace_ctx,"VAPictureParameterBufferMPEG2\n");
798 va_TraceMsg(trace_ctx,"\thorizontal size= %d\n", p->horizontal_size);
799 va_TraceMsg(trace_ctx,"\tvertical size= %d\n", p->vertical_size);
800 va_TraceMsg(trace_ctx,"\tforward reference picture= %d\n", p->forward_reference_picture);
801 va_TraceMsg(trace_ctx,"\tbackward reference picture= %d\n", p->backward_reference_picture);
802 va_TraceMsg(trace_ctx,"\tpicture coding type= %d\n", p->picture_coding_type);
803 va_TraceMsg(trace_ctx,"\tf mode= %d\n", p->f_code);
805 va_TraceMsg(trace_ctx,"\tpicture coding extension = %d\n", p->picture_coding_extension.value);
806 va_TraceMsg(trace_ctx,"\tintra_dc_precision= %d\n", p->picture_coding_extension.bits.intra_dc_precision);
807 va_TraceMsg(trace_ctx,"\tpicture_structure= %d\n", p->picture_coding_extension.bits.picture_structure);
808 va_TraceMsg(trace_ctx,"\ttop_field_first= %d\n", p->picture_coding_extension.bits.top_field_first);
809 va_TraceMsg(trace_ctx,"\tframe_pred_frame_dct= %d\n", p->picture_coding_extension.bits.frame_pred_frame_dct);
810 va_TraceMsg(trace_ctx,"\tconcealment_motion_vectors= %d\n", p->picture_coding_extension.bits.concealment_motion_vectors);
811 va_TraceMsg(trace_ctx,"\tq_scale_type= %d\n", p->picture_coding_extension.bits.q_scale_type);
812 va_TraceMsg(trace_ctx,"\tintra_vlc_format= %d\n", p->picture_coding_extension.bits.intra_vlc_format);
813 va_TraceMsg(trace_ctx,"\talternate_scan= %d\n", p->picture_coding_extension.bits.alternate_scan);
814 va_TraceMsg(trace_ctx,"\trepeat_first_field= %d\n", p->picture_coding_extension.bits.repeat_first_field);
815 va_TraceMsg(trace_ctx,"\tprogressive_frame= %d\n", p->picture_coding_extension.bits.progressive_frame);
816 va_TraceMsg(trace_ctx,"\tis_first_field= %d\n", p->picture_coding_extension.bits.is_first_field);
817 va_TraceMsg(trace_ctx, NULL);
823 static void va_TraceVAIQMatrixBufferMPEG2(
829 unsigned int num_elements,
832 VAIQMatrixBufferMPEG2 *p=(VAIQMatrixBufferMPEG2 *)data;
835 va_TraceMsg(trace_ctx,"VAIQMatrixBufferMPEG2\n");
837 va_TraceMsg(trace_ctx,"\tload_intra_quantiser_matrix = %d\n", p->load_intra_quantiser_matrix);
838 va_TraceMsg(trace_ctx,"\tload_non_intra_quantiser_matrix = %d\n", p->load_non_intra_quantiser_matrix);
839 va_TraceMsg(trace_ctx,"\tload_chroma_intra_quantiser_matrix = %d\n", p->load_chroma_intra_quantiser_matrix);
840 va_TraceMsg(trace_ctx,"\tload_chroma_non_intra_quantiser_matrix = %d\n", p->load_chroma_non_intra_quantiser_matrix);
841 va_TraceMsg(trace_ctx,"\tintra_quantiser_matrix = %d\n", p->intra_quantiser_matrix);
842 va_TraceMsg(trace_ctx,"\tnon_intra_quantiser_matrix = %d\n", p->non_intra_quantiser_matrix);
843 va_TraceMsg(trace_ctx,"\tchroma_intra_quantiser_matrix = %d\n", p->chroma_intra_quantiser_matrix);
844 va_TraceMsg(trace_ctx,"\tchroma_non_intra_quantiser_matrix = %d\n", p->chroma_non_intra_quantiser_matrix);
845 va_TraceMsg(trace_ctx, NULL);
851 static void va_TraceVASliceParameterBufferMPEG2(
857 unsigned int num_elements,
860 VASliceParameterBufferMPEG2 *p=(VASliceParameterBufferMPEG2 *)data;
864 trace_ctx->trace_slice_no++;
866 trace_ctx->trace_slice_size = p->slice_data_size;
868 va_TraceMsg(trace_ctx,"VASliceParameterBufferMPEG2\n");
870 va_TraceMsg(trace_ctx,"\tslice_data_size = %d\n", p->slice_data_size);
871 va_TraceMsg(trace_ctx,"\tslice_data_offset = %d\n", p->slice_data_offset);
872 va_TraceMsg(trace_ctx,"\tslice_data_flag = %d\n", p->slice_data_flag);
873 va_TraceMsg(trace_ctx,"\tmacroblock_offset = %d\n", p->macroblock_offset);
874 va_TraceMsg(trace_ctx,"\tslice_horizontal_position = %d\n", p->slice_horizontal_position);
875 va_TraceMsg(trace_ctx,"\tslice_vertical_position = %d\n", p->slice_vertical_position);
876 va_TraceMsg(trace_ctx,"\tquantiser_scale_code = %d\n", p->quantiser_scale_code);
877 va_TraceMsg(trace_ctx,"\tintra_slice_flag = %d\n", p->intra_slice_flag);
878 va_TraceMsg(trace_ctx, NULL);
883 static void va_TraceVAPictureParameterBufferJPEG(
889 unsigned int num_elements,
893 VAPictureParameterBufferJPEGBaseline *p=(VAPictureParameterBufferJPEGBaseline *)data;
896 va_TraceMsg(trace_ctx,"*VAPictureParameterBufferJPEG\n");
897 va_TraceMsg(trace_ctx,"\tpicture_width = %u\n", p->picture_width);
898 va_TraceMsg(trace_ctx,"\tpicture_height = %u\n", p->picture_height);
899 va_TraceMsg(trace_ctx,"\tcomponents = \n");
900 for (i = 0; i < p->num_components && i < 255; ++i) {
901 va_TraceMsg(trace_ctx,"\t\t[%d] component_id = %u\n", i, p->components[i].component_id);
902 va_TraceMsg(trace_ctx,"\t\t[%d] h_sampling_factor = %u\n", i, p->components[i].h_sampling_factor);
903 va_TraceMsg(trace_ctx,"\t\t[%d] v_sampling_factor = %u\n", i, p->components[i].v_sampling_factor);
904 va_TraceMsg(trace_ctx,"\t\t[%d] quantiser_table_selector = %u\n", i, p->components[i].quantiser_table_selector);
908 static void va_TraceVAIQMatrixBufferJPEG(
914 unsigned int num_elements,
918 static char tmp[1024];
919 VAIQMatrixBufferJPEGBaseline *p=(VAIQMatrixBufferJPEGBaseline *)data;
921 va_TraceMsg(trace_ctx,"*VAIQMatrixParameterBufferJPEG\n");
922 va_TraceMsg(trace_ctx,"\tload_quantiser_table =\n");
923 for (i = 0; i < 4; ++i) {
924 va_TraceMsg(trace_ctx,"\t\t[%d] = %u\n", i, p->load_quantiser_table[i]);
926 va_TraceMsg(trace_ctx,"\tquantiser_table =\n");
927 for (i = 0; i < 4; ++i) {
928 memset(tmp, 0, sizeof tmp);
929 for (j = 0; j < 64; ++j) {
930 sprintf(tmp + strlen(tmp), "%u ", p->quantiser_table[i][j]);
932 va_TraceMsg(trace_ctx,"\t\t[%d] = %s\n", i, tmp);
936 static void va_TraceVASliceParameterBufferJPEG(
942 unsigned int num_elements,
946 VASliceParameterBufferJPEGBaseline *p=(VASliceParameterBufferJPEGBaseline *)data;
948 va_TraceMsg(trace_ctx,"*VASliceParameterBufferJPEG\n");
949 va_TraceMsg(trace_ctx,"\tslice_data_size = %u\n", p->slice_data_size);
950 va_TraceMsg(trace_ctx,"\tslice_data_offset = %u\n", p->slice_data_offset);
951 va_TraceMsg(trace_ctx,"\tslice_data_flag = %u\n", p->slice_data_flag);
952 va_TraceMsg(trace_ctx,"\tslice_horizontal_position = %u\n", p->slice_horizontal_position);
953 va_TraceMsg(trace_ctx,"\tslice_vertical_position = %u\n", p->slice_vertical_position);
954 va_TraceMsg(trace_ctx,"\tcomponents = \n");
955 for (i = 0; i < p->num_components && i < 4; ++i) {
956 va_TraceMsg(trace_ctx,"\t\t[%d] component_selector = %u\n", i, p->components[i].component_selector);
957 va_TraceMsg(trace_ctx,"\t\t[%d] dc_table_selector = %u\n", i, p->components[i].dc_table_selector);
958 va_TraceMsg(trace_ctx,"\t\t[%d] ac_table_selector = %u\n", i, p->components[i].ac_table_selector);
960 va_TraceMsg(trace_ctx,"\trestart_interval = %u\n", p->restart_interval);
961 va_TraceMsg(trace_ctx,"\tnum_mcus = %u\n", p->num_mcus);
964 static void va_TraceVAHuffmanTableBufferJPEG(
970 unsigned int num_elements,
974 static char tmp[1024];
975 VAHuffmanTableBufferJPEGBaseline *p=(VAHuffmanTableBufferJPEGBaseline *)data;
977 va_TraceMsg(trace_ctx,"*VAHuffmanTableBufferJPEG\n");
979 for (i = 0; i < 2; ++i) {
980 va_TraceMsg(trace_ctx,"\tload_huffman_table[%d] =%u\n", i, p->load_huffman_table[0]);
981 va_TraceMsg(trace_ctx,"\thuffman_table[%d] =\n", i);
982 memset(tmp, 0, sizeof tmp);
983 for (j = 0; j < 16; ++j) {
984 sprintf(tmp + strlen(tmp), "%u ", p->huffman_table[i].num_dc_codes[j]);
986 va_TraceMsg(trace_ctx,"\t\tnum_dc_codes =%s\n", tmp);
987 memset(tmp, 0, sizeof tmp);
988 for (j = 0; j < 12; ++j) {
989 sprintf(tmp + strlen(tmp), "%u ", p->huffman_table[i].dc_values[j]);
991 va_TraceMsg(trace_ctx,"\t\tdc_values =%s\n", tmp);
992 memset(tmp, 0, sizeof tmp);
993 for (j = 0; j < 16; ++j) {
994 sprintf(tmp + strlen(tmp), "%u ", p->huffman_table[i].num_ac_codes[j]);
996 va_TraceMsg(trace_ctx,"\t\tnum_dc_codes =%s\n", tmp);
997 memset(tmp, 0, sizeof tmp);
998 for (j = 0; j < 162; ++j) {
999 sprintf(tmp + strlen(tmp), "%u ", p->huffman_table[i].ac_values[j]);
1001 va_TraceMsg(trace_ctx,"\t\tnum_dc_codes =%s\n", tmp);
1002 memset(tmp, 0, sizeof tmp);
1003 for (j = 0; j < 2; ++j) {
1004 sprintf(tmp + strlen(tmp), "%u ", p->huffman_table[i].pad[j]);
1006 va_TraceMsg(trace_ctx,"\t\tnum_dc_codes =%s\n", tmp);
1010 static void va_TraceVAPictureParameterBufferMPEG4(
1012 VAContextID context,
1016 unsigned int num_elements,
1020 VAPictureParameterBufferMPEG4 *p=(VAPictureParameterBufferMPEG4 *)data;
1024 va_TraceMsg(trace_ctx,"*VAPictureParameterBufferMPEG4\n");
1025 va_TraceMsg(trace_ctx,"\tvop_width = %d\n", p->vop_width);
1026 va_TraceMsg(trace_ctx,"\tvop_height = %d\n", p->vop_height);
1027 va_TraceMsg(trace_ctx,"\tforward_reference_picture = %d\n", p->forward_reference_picture);
1028 va_TraceMsg(trace_ctx,"\tbackward_reference_picture = %d\n", p->backward_reference_picture);
1029 va_TraceMsg(trace_ctx,"\tvol_fields value = %d\n", p->vol_fields.value);
1030 va_TraceMsg(trace_ctx,"\tshort_video_header= %d\n", p->vol_fields.bits.short_video_header);
1031 va_TraceMsg(trace_ctx,"\tchroma_format= %d\n", p->vol_fields.bits.chroma_format);
1032 va_TraceMsg(trace_ctx,"\tinterlaced= %d\n", p->vol_fields.bits.interlaced);
1033 va_TraceMsg(trace_ctx,"\tobmc_disable= %d\n", p->vol_fields.bits.obmc_disable);
1034 va_TraceMsg(trace_ctx,"\tsprite_enable= %d\n", p->vol_fields.bits.sprite_enable);
1035 va_TraceMsg(trace_ctx,"\tsprite_warping_accuracy= %d\n", p->vol_fields.bits.sprite_warping_accuracy);
1036 va_TraceMsg(trace_ctx,"\tquant_type= %d\n", p->vol_fields.bits.quant_type);
1037 va_TraceMsg(trace_ctx,"\tquarter_sample= %d\n", p->vol_fields.bits.quarter_sample);
1038 va_TraceMsg(trace_ctx,"\tdata_partitioned= %d\n", p->vol_fields.bits.data_partitioned);
1039 va_TraceMsg(trace_ctx,"\treversible_vlc= %d\n", p->vol_fields.bits.reversible_vlc);
1040 va_TraceMsg(trace_ctx,"\tresync_marker_disable= %d\n", p->vol_fields.bits.resync_marker_disable);
1041 va_TraceMsg(trace_ctx,"\tno_of_sprite_warping_points = %d\n", p->no_of_sprite_warping_points);
1042 va_TraceMsg(trace_ctx,"\tsprite_trajectory_du =");
1044 va_TraceMsg(trace_ctx,"\t%d", p->sprite_trajectory_du[i]);
1046 va_TraceMsg(trace_ctx,"\n");
1047 va_TraceMsg(trace_ctx,"\tsprite_trajectory_dv =");
1049 va_TraceMsg(trace_ctx,"\t%d", p->sprite_trajectory_dv[i]);
1050 va_TraceMsg(trace_ctx,"\n");
1051 va_TraceMsg(trace_ctx,"\tvop_fields value = %d\n", p->vop_fields.value);
1052 va_TraceMsg(trace_ctx,"\tvop_coding_type= %d\n", p->vop_fields.bits.vop_coding_type);
1053 va_TraceMsg(trace_ctx,"\tbackward_reference_vop_coding_type= %d\n", p->vop_fields.bits.backward_reference_vop_coding_type);
1054 va_TraceMsg(trace_ctx,"\tvop_rounding_type= %d\n", p->vop_fields.bits.vop_rounding_type);
1055 va_TraceMsg(trace_ctx,"\tintra_dc_vlc_thr= %d\n", p->vop_fields.bits.intra_dc_vlc_thr);
1056 va_TraceMsg(trace_ctx,"\ttop_field_first= %d\n", p->vop_fields.bits.top_field_first);
1057 va_TraceMsg(trace_ctx,"\talternate_vertical_scan_flag= %d\n", p->vop_fields.bits.alternate_vertical_scan_flag);
1058 va_TraceMsg(trace_ctx,"\tvop_fcode_forward = %d\n", p->vop_fcode_forward);
1059 va_TraceMsg(trace_ctx,"\tvop_fcode_backward = %d\n", p->vop_fcode_backward);
1060 va_TraceMsg(trace_ctx,"\tnum_gobs_in_vop = %d\n", p->num_gobs_in_vop);
1061 va_TraceMsg(trace_ctx,"\tnum_macroblocks_in_gob = %d\n", p->num_macroblocks_in_gob);
1062 va_TraceMsg(trace_ctx,"\tTRB = %d\n", p->TRB);
1063 va_TraceMsg(trace_ctx,"\tTRD = %d\n", p->TRD);
1064 va_TraceMsg(trace_ctx, NULL);
1070 static void va_TraceVAIQMatrixBufferMPEG4(
1072 VAContextID context,
1076 unsigned int num_elements,
1080 VAIQMatrixBufferMPEG4 *p=(VAIQMatrixBufferMPEG4 *)data;
1083 va_TraceMsg(trace_ctx,"VAIQMatrixBufferMPEG4\n");
1085 va_TraceMsg(trace_ctx,"\tload_intra_quant_mat = %d\n", p->load_intra_quant_mat);
1086 va_TraceMsg(trace_ctx,"\tload_non_intra_quant_mat = %d\n", p->load_non_intra_quant_mat);
1087 va_TraceMsg(trace_ctx,"\tintra_quant_mat =\n");
1089 va_TraceMsg(trace_ctx,"\t\t%d\n", p->intra_quant_mat[i]);
1091 va_TraceMsg(trace_ctx,"\tnon_intra_quant_mat =\n");
1093 va_TraceMsg(trace_ctx,"\t\t%d\n", p->non_intra_quant_mat[i]);
1094 va_TraceMsg(trace_ctx, NULL);
1099 static void va_TraceVAEncSequenceParameterBufferMPEG4(
1101 VAContextID context,
1105 unsigned int num_elements,
1108 VAEncSequenceParameterBufferMPEG4 *p = (VAEncSequenceParameterBufferMPEG4 *)data;
1111 va_TraceMsg(trace_ctx, "\t--VAEncSequenceParameterBufferMPEG4\n");
1113 va_TraceMsg(trace_ctx, "\tprofile_and_level_indication = %d\n", p->profile_and_level_indication);
1114 va_TraceMsg(trace_ctx, "\tintra_period = %d\n", p->intra_period);
1115 va_TraceMsg(trace_ctx, "\tvideo_object_layer_width = %d\n", p->video_object_layer_width);
1116 va_TraceMsg(trace_ctx, "\tvideo_object_layer_height = %d\n", p->video_object_layer_height);
1117 va_TraceMsg(trace_ctx, "\tvop_time_increment_resolution = %d\n", p->vop_time_increment_resolution);
1118 va_TraceMsg(trace_ctx, "\tfixed_vop_rate = %d\n", p->fixed_vop_rate);
1119 va_TraceMsg(trace_ctx, "\tfixed_vop_time_increment = %d\n", p->fixed_vop_time_increment);
1120 va_TraceMsg(trace_ctx, "\tbits_per_second = %d\n", p->bits_per_second);
1121 va_TraceMsg(trace_ctx, "\tframe_rate = %d\n", p->frame_rate);
1122 va_TraceMsg(trace_ctx, "\tinitial_qp = %d\n", p->initial_qp);
1123 va_TraceMsg(trace_ctx, "\tmin_qp = %d\n", p->min_qp);
1124 va_TraceMsg(trace_ctx, NULL);
1129 static void va_TraceVAEncPictureParameterBufferMPEG4(
1131 VAContextID context,
1135 unsigned int num_elements,
1138 VAEncPictureParameterBufferMPEG4 *p = (VAEncPictureParameterBufferMPEG4 *)data;
1141 va_TraceMsg(trace_ctx, "\t--VAEncPictureParameterBufferMPEG4\n");
1142 va_TraceMsg(trace_ctx, "\treference_picture = 0x%08x\n", p->reference_picture);
1143 va_TraceMsg(trace_ctx, "\treconstructed_picture = 0x%08x\n", p->reconstructed_picture);
1144 va_TraceMsg(trace_ctx, "\tcoded_buf = 0x%08x\n", p->coded_buf);
1145 va_TraceMsg(trace_ctx, "\tpicture_width = %d\n", p->picture_width);
1146 va_TraceMsg(trace_ctx, "\tpicture_height = %d\n", p->picture_height);
1147 va_TraceMsg(trace_ctx, "\tmodulo_time_base = %d\n", p->modulo_time_base);
1148 va_TraceMsg(trace_ctx, "\tvop_time_increment = %d\n", p->vop_time_increment);
1149 va_TraceMsg(trace_ctx, "\tpicture_type = %d\n", p->picture_type);
1150 va_TraceMsg(trace_ctx, NULL);
1156 static void va_TraceVASliceParameterBufferMPEG4(
1158 VAContextID context,
1162 unsigned int num_elements,
1165 VASliceParameterBufferMPEG4 *p=(VASliceParameterBufferMPEG4 *)data;
1169 trace_ctx->trace_slice_no++;
1171 trace_ctx->trace_slice_size = p->slice_data_size;
1173 va_TraceMsg(trace_ctx,"VASliceParameterBufferMPEG4\n");
1175 va_TraceMsg(trace_ctx,"\tslice_data_size = %d\n", p->slice_data_size);
1176 va_TraceMsg(trace_ctx,"\tslice_data_offset = %d\n", p->slice_data_offset);
1177 va_TraceMsg(trace_ctx,"\tslice_data_flag = %d\n", p->slice_data_flag);
1178 va_TraceMsg(trace_ctx,"\tmacroblock_offset = %d\n", p->macroblock_offset);
1179 va_TraceMsg(trace_ctx,"\tmacroblock_number = %d\n", p->macroblock_number);
1180 va_TraceMsg(trace_ctx,"\tquant_scale = %d\n", p->quant_scale);
1181 va_TraceMsg(trace_ctx, NULL);
1187 static inline void va_TraceFlagIfNotZero(
1188 struct trace_context *trace_ctx,
1189 const char *name, /* in */
1190 unsigned int flag /* in */
1194 va_TraceMsg(trace_ctx, "%s = %x\n", name, flag);
1199 static void va_TraceVAPictureParameterBufferH264(
1201 VAContextID context,
1205 unsigned int num_elements,
1209 VAPictureParameterBufferH264 *p = (VAPictureParameterBufferH264*)data;
1213 va_TraceMsg(trace_ctx, "\t--VAPictureParameterBufferH264\n");
1215 va_TraceMsg(trace_ctx, "\tCurrPic.picture_id = 0x%08x\n", p->CurrPic.picture_id);
1216 va_TraceMsg(trace_ctx, "\tCurrPic.frame_idx = %d\n", p->CurrPic.frame_idx);
1217 va_TraceMsg(trace_ctx, "\tCurrPic.flags = %d\n", p->CurrPic.flags);
1218 va_TraceMsg(trace_ctx, "\tCurrPic.TopFieldOrderCnt = %d\n", p->CurrPic.TopFieldOrderCnt);
1219 va_TraceMsg(trace_ctx, "\tCurrPic.BottomFieldOrderCnt = %d\n", p->CurrPic.BottomFieldOrderCnt);
1221 va_TraceMsg(trace_ctx, "\tReferenceFrames (TopFieldOrderCnt-BottomFieldOrderCnt-picture_id-frame_idx-flags:\n");
1222 for (i = 0; i < 16; i++)
1224 if ((p->ReferenceFrames[i].picture_id != VA_INVALID_SURFACE) &&
1225 ((p->ReferenceFrames[i].flags & VA_PICTURE_H264_INVALID) == 0)) {
1226 va_TraceMsg(trace_ctx, "\t\t%08d-%08d-0x%08x-%08d-0x%08x\n",
1227 p->ReferenceFrames[i].TopFieldOrderCnt,
1228 p->ReferenceFrames[i].BottomFieldOrderCnt,
1229 p->ReferenceFrames[i].picture_id,
1230 p->ReferenceFrames[i].frame_idx,
1231 p->ReferenceFrames[i].flags);
1235 va_TraceMsg(trace_ctx, "\tpicture_width_in_mbs_minus1 = %d\n", p->picture_width_in_mbs_minus1);
1236 va_TraceMsg(trace_ctx, "\tpicture_height_in_mbs_minus1 = %d\n", p->picture_height_in_mbs_minus1);
1237 va_TraceMsg(trace_ctx, "\tbit_depth_luma_minus8 = %d\n", p->bit_depth_luma_minus8);
1238 va_TraceMsg(trace_ctx, "\tbit_depth_chroma_minus8 = %d\n", p->bit_depth_chroma_minus8);
1239 va_TraceMsg(trace_ctx, "\tnum_ref_frames = %d\n", p->num_ref_frames);
1240 va_TraceMsg(trace_ctx, "\tseq fields = %d\n", p->seq_fields.value);
1241 va_TraceMsg(trace_ctx, "\tchroma_format_idc = %d\n", p->seq_fields.bits.chroma_format_idc);
1242 va_TraceMsg(trace_ctx, "\tresidual_colour_transform_flag = %d\n", p->seq_fields.bits.residual_colour_transform_flag);
1243 va_TraceMsg(trace_ctx, "\tframe_mbs_only_flag = %d\n", p->seq_fields.bits.frame_mbs_only_flag);
1244 va_TraceMsg(trace_ctx, "\tmb_adaptive_frame_field_flag = %d\n", p->seq_fields.bits.mb_adaptive_frame_field_flag);
1245 va_TraceMsg(trace_ctx, "\tdirect_8x8_inference_flag = %d\n", p->seq_fields.bits.direct_8x8_inference_flag);
1246 va_TraceMsg(trace_ctx, "\tMinLumaBiPredSize8x8 = %d\n", p->seq_fields.bits.MinLumaBiPredSize8x8);
1247 va_TraceMsg(trace_ctx, "\tnum_slice_groups_minus1 = %d\n", p->num_slice_groups_minus1);
1248 va_TraceMsg(trace_ctx, "\tslice_group_map_type = %d\n", p->slice_group_map_type);
1249 va_TraceMsg(trace_ctx, "\tslice_group_change_rate_minus1 = %d\n", p->slice_group_change_rate_minus1);
1250 va_TraceMsg(trace_ctx, "\tpic_init_qp_minus26 = %d\n", p->pic_init_qp_minus26);
1251 va_TraceMsg(trace_ctx, "\tpic_init_qs_minus26 = %d\n", p->pic_init_qs_minus26);
1252 va_TraceMsg(trace_ctx, "\tchroma_qp_index_offset = %d\n", p->chroma_qp_index_offset);
1253 va_TraceMsg(trace_ctx, "\tsecond_chroma_qp_index_offset = %d\n", p->second_chroma_qp_index_offset);
1254 va_TraceMsg(trace_ctx, "\tpic_fields = 0x%03x\n", p->pic_fields.value);
1255 va_TraceFlagIfNotZero(trace_ctx, "\t\tentropy_coding_mode_flag", p->pic_fields.bits.entropy_coding_mode_flag);
1256 va_TraceFlagIfNotZero(trace_ctx, "\t\tweighted_pred_flag", p->pic_fields.bits.weighted_pred_flag);
1257 va_TraceFlagIfNotZero(trace_ctx, "\t\tweighted_bipred_idc", p->pic_fields.bits.weighted_bipred_idc);
1258 va_TraceFlagIfNotZero(trace_ctx, "\t\ttransform_8x8_mode_flag", p->pic_fields.bits.transform_8x8_mode_flag);
1259 va_TraceFlagIfNotZero(trace_ctx, "\t\tfield_pic_flag", p->pic_fields.bits.field_pic_flag);
1260 va_TraceFlagIfNotZero(trace_ctx, "\t\tconstrained_intra_pred_flag", p->pic_fields.bits.constrained_intra_pred_flag);
1261 va_TraceFlagIfNotZero(trace_ctx, "\t\tpic_order_present_flag", p->pic_fields.bits.pic_order_present_flag);
1262 va_TraceFlagIfNotZero(trace_ctx, "\t\tdeblocking_filter_control_present_flag", p->pic_fields.bits.deblocking_filter_control_present_flag);
1263 va_TraceFlagIfNotZero(trace_ctx, "\t\tredundant_pic_cnt_present_flag", p->pic_fields.bits.redundant_pic_cnt_present_flag);
1264 va_TraceFlagIfNotZero(trace_ctx, "\t\treference_pic_flag", p->pic_fields.bits.reference_pic_flag);
1265 va_TraceMsg(trace_ctx, "\tframe_num = %d\n", p->frame_num);
1266 va_TraceMsg(trace_ctx, NULL);
1271 static void va_TraceVASliceParameterBufferH264(
1273 VAContextID context,
1277 unsigned int num_elements,
1281 VASliceParameterBufferH264* p = (VASliceParameterBufferH264*)data;
1284 trace_ctx->trace_slice_no++;
1285 trace_ctx->trace_slice_size = p->slice_data_size;
1287 va_TraceMsg(trace_ctx, "\t--VASliceParameterBufferH264\n");
1288 va_TraceMsg(trace_ctx, "\tslice_data_size = %d\n", p->slice_data_size);
1289 va_TraceMsg(trace_ctx, "\tslice_data_offset = %d\n", p->slice_data_offset);
1290 va_TraceMsg(trace_ctx, "\tslice_data_flag = %d\n", p->slice_data_flag);
1291 va_TraceMsg(trace_ctx, "\tslice_data_bit_offset = %d\n", p->slice_data_bit_offset);
1292 va_TraceMsg(trace_ctx, "\tfirst_mb_in_slice = %d\n", p->first_mb_in_slice);
1293 va_TraceMsg(trace_ctx, "\tslice_type = %d\n", p->slice_type);
1294 va_TraceMsg(trace_ctx, "\tdirect_spatial_mv_pred_flag = %d\n", p->direct_spatial_mv_pred_flag);
1295 va_TraceMsg(trace_ctx, "\tnum_ref_idx_l0_active_minus1 = %d\n", p->num_ref_idx_l0_active_minus1);
1296 va_TraceMsg(trace_ctx, "\tnum_ref_idx_l1_active_minus1 = %d\n", p->num_ref_idx_l1_active_minus1);
1297 va_TraceMsg(trace_ctx, "\tcabac_init_idc = %d\n", p->cabac_init_idc);
1298 va_TraceMsg(trace_ctx, "\tslice_qp_delta = %d\n", p->slice_qp_delta);
1299 va_TraceMsg(trace_ctx, "\tdisable_deblocking_filter_idc = %d\n", p->disable_deblocking_filter_idc);
1300 va_TraceMsg(trace_ctx, "\tslice_alpha_c0_offset_div2 = %d\n", p->slice_alpha_c0_offset_div2);
1301 va_TraceMsg(trace_ctx, "\tslice_beta_offset_div2 = %d\n", p->slice_beta_offset_div2);
1303 va_TraceMsg(trace_ctx, "\tRefPicList0 =\n");
1304 for (i = 0; i < 32; i++) {
1305 if ((p->RefPicList0[i].picture_id != VA_INVALID_SURFACE) &&
1306 ((p->RefPicList0[i].flags & VA_PICTURE_H264_INVALID) == 0))
1307 va_TraceMsg(trace_ctx, "%08d-%08d-0x%08x-%08d-0x%08x\n", p->RefPicList0[i].TopFieldOrderCnt, p->RefPicList0[i].BottomFieldOrderCnt, p->RefPicList0[i].picture_id, p->RefPicList0[i].frame_idx, p->RefPicList0[i].flags);
1311 va_TraceMsg(trace_ctx, "\tRefPicList1 =\n");
1312 for (i = 0; i < 32; i++) {
1313 if ((p->RefPicList1[i].picture_id != VA_INVALID_SURFACE) &&
1314 ((p->RefPicList1[i].flags & VA_PICTURE_H264_INVALID) == 0))
1315 va_TraceMsg(trace_ctx, "%08d-%08d-0x%08x-%08d-0x%08x\n", p->RefPicList1[i].TopFieldOrderCnt, p->RefPicList1[i].BottomFieldOrderCnt, p->RefPicList1[i].picture_id, p->RefPicList1[i].frame_idx, p->RefPicList1[i].flags);
1320 va_TraceMsg(trace_ctx, "\tluma_log2_weight_denom = %d\n", p->luma_log2_weight_denom);
1321 va_TraceMsg(trace_ctx, "\tchroma_log2_weight_denom = %d\n", p->chroma_log2_weight_denom);
1322 va_TraceMsg(trace_ctx, "\tluma_weight_l0_flag = %d\n", p->luma_weight_l0_flag);
1324 for (i = 0; (i <= p->num_ref_idx_l0_active_minus1) && (i<32); i++) {
1325 va_TraceMsg(trace_ctx, "\t\t%d\t%d\n",
1326 p->luma_weight_l0[i],
1327 p->luma_offset_l0[i]);
1331 va_TraceMsg(trace_ctx, "\tchroma_weight_l0_flag = %d\n", p->chroma_weight_l0_flag);
1333 for (i = 0; (i <= p->num_ref_idx_l0_active_minus1) && (i<32); i++) {
1334 va_TraceMsg(trace_ctx, "\t\t%d\t%d\t%d\t%d\n",
1335 p->chroma_weight_l0[i][0],
1336 p->chroma_offset_l0[i][0],
1337 p->chroma_weight_l0[i][1],
1338 p->chroma_offset_l0[i][1]);
1342 va_TraceMsg(trace_ctx, "\tluma_weight_l1_flag = %d\n", p->luma_weight_l1_flag);
1344 for (i = 0; (i <= p->num_ref_idx_l1_active_minus1) && (i<32); i++) {
1345 va_TraceMsg(trace_ctx, "\t\t%d\t%d\n",
1346 p->luma_weight_l1[i],
1347 p->luma_offset_l1[i]);
1351 va_TraceMsg(trace_ctx, "\tchroma_weight_l1_flag = %d\n", p->chroma_weight_l1_flag);
1353 for (i = 0; (i <= p->num_ref_idx_l1_active_minus1) && (i<32); i++) {
1354 va_TraceMsg(trace_ctx, "\t\t%d\t%d\t%d\t%d\n",
1355 p->chroma_weight_l1[i][0],
1356 p->chroma_offset_l1[i][0],
1357 p->chroma_weight_l1[i][1],
1358 p->chroma_offset_l1[i][1]);
1361 va_TraceMsg(trace_ctx, NULL);
1364 static void va_TraceVAIQMatrixBufferH264(
1366 VAContextID context,
1370 unsigned int num_elements,
1375 VAIQMatrixBufferH264* p = (VAIQMatrixBufferH264* )data;
1379 va_TraceMsg(trace_ctx, "\t--VAIQMatrixBufferH264\n");
1381 va_TraceMsg(trace_ctx, "\tScalingList4x4[6][16]=\n");
1382 for (i = 0; i < 6; i++) {
1383 for (j = 0; j < 16; j++) {
1384 if (trace_ctx->trace_fp_log) {
1385 fprintf(trace_ctx->trace_fp_log, "\t%d", p->ScalingList4x4[i][j]);
1386 if ((j + 1) % 8 == 0)
1387 fprintf(trace_ctx->trace_fp_log, "\n");
1392 va_TraceMsg(trace_ctx, "\tScalingList8x8[2][64]=\n");
1393 for (i = 0; i < 2; i++) {
1394 for (j = 0; j < 64; j++) {
1395 if (trace_ctx->trace_fp_log) {
1396 fprintf(trace_ctx->trace_fp_log,"\t%d", p->ScalingList8x8[i][j]);
1397 if ((j + 1) % 8 == 0)
1398 fprintf(trace_ctx->trace_fp_log, "\n");
1403 va_TraceMsg(trace_ctx, NULL);
1408 static void va_TraceVAEncSequenceParameterBufferH264(
1410 VAContextID context,
1414 unsigned int num_elements,
1417 VAEncSequenceParameterBufferH264 *p = (VAEncSequenceParameterBufferH264 *)data;
1421 va_TraceMsg(trace_ctx, "\t--VAEncSequenceParameterBufferH264\n");
1423 va_TraceMsg(trace_ctx, "\tseq_parameter_set_id = %d\n", p->seq_parameter_set_id);
1424 va_TraceMsg(trace_ctx, "\tlevel_idc = %d\n", p->level_idc);
1425 va_TraceMsg(trace_ctx, "\tintra_period = %d\n", p->intra_period);
1426 va_TraceMsg(trace_ctx, "\tintra_idr_period = %d\n", p->intra_idr_period);
1427 va_TraceMsg(trace_ctx, "\tip_period = %d\n", p->ip_period);
1428 va_TraceMsg(trace_ctx, "\tbits_per_second = %d\n", p->bits_per_second);
1429 va_TraceMsg(trace_ctx, "\tmax_num_ref_frames = %d\n", p->max_num_ref_frames);
1430 va_TraceMsg(trace_ctx, "\tpicture_width_in_mbs = %d\n", p->picture_width_in_mbs);
1431 va_TraceMsg(trace_ctx, "\tpicture_height_in_mbs = %d\n", p->picture_height_in_mbs);
1432 va_TraceMsg(trace_ctx, "\tchroma_format_idc = %d\n", p->seq_fields.bits.chroma_format_idc);
1433 va_TraceMsg(trace_ctx, "\tframe_mbs_only_flag = %d\n", p->seq_fields.bits.frame_mbs_only_flag);
1434 va_TraceMsg(trace_ctx, "\tmb_adaptive_frame_field_flag = %d\n", p->seq_fields.bits.mb_adaptive_frame_field_flag);
1435 va_TraceMsg(trace_ctx, "\tseq_scaling_matrix_present_flag = %d\n", p->seq_fields.bits.seq_scaling_matrix_present_flag);
1436 va_TraceMsg(trace_ctx, "\tdirect_8x8_inference_flag = %d\n", p->seq_fields.bits.direct_8x8_inference_flag);
1437 va_TraceMsg(trace_ctx, "\tlog2_max_frame_num_minus4 = %d\n", p->seq_fields.bits.log2_max_frame_num_minus4);
1438 va_TraceMsg(trace_ctx, "\tpic_order_cnt_type = %d\n", p->seq_fields.bits.pic_order_cnt_type);
1439 va_TraceMsg(trace_ctx, "\tlog2_max_pic_order_cnt_lsb_minus4 = %d\n", p->seq_fields.bits.log2_max_pic_order_cnt_lsb_minus4);
1440 va_TraceMsg(trace_ctx, "\tdelta_pic_order_always_zero_flag = %d\n", p->seq_fields.bits.delta_pic_order_always_zero_flag);
1441 va_TraceMsg(trace_ctx, "\tbit_depth_luma_minus8 = %d\n", p->bit_depth_luma_minus8);
1442 va_TraceMsg(trace_ctx, "\tbit_depth_chroma_minus8 = %d\n", p->bit_depth_chroma_minus8);
1443 va_TraceMsg(trace_ctx, "\tnum_ref_frames_in_pic_order_cnt_cycle = %d\n", p->num_ref_frames_in_pic_order_cnt_cycle);
1444 va_TraceMsg(trace_ctx, "\toffset_for_non_ref_pic = %d\n", p->offset_for_non_ref_pic);
1445 va_TraceMsg(trace_ctx, "\toffset_for_top_to_bottom_field = %d\n", p->offset_for_top_to_bottom_field);
1446 for(i = 0; (i < p->max_num_ref_frames) && (i < 32); ++i)
1447 va_TraceMsg(trace_ctx, "\toffset_for_ref_frame[%d] = %d\n", i, p->offset_for_ref_frame[i]);
1448 va_TraceMsg(trace_ctx, "\tframe_cropping_flag = %d\n", p->frame_cropping_flag);
1449 va_TraceMsg(trace_ctx, "\tframe_crop_left_offset = %d\n", p->frame_crop_left_offset);
1450 va_TraceMsg(trace_ctx, "\tframe_crop_right_offset = %d\n", p->frame_crop_right_offset);
1451 va_TraceMsg(trace_ctx, "\tframe_crop_top_offset = %d\n", p->frame_crop_top_offset);
1452 va_TraceMsg(trace_ctx, "\tframe_crop_bottom_offset = %d\n", p->frame_crop_bottom_offset);
1453 va_TraceMsg(trace_ctx, "\tvui_parameters_present_flag = %d\n", p->vui_parameters_present_flag);
1454 va_TraceMsg(trace_ctx, "\taspect_ratio_info_present_flag = %d\n", p->vui_fields.bits.aspect_ratio_info_present_flag);
1455 va_TraceMsg(trace_ctx, "\ttiming_info_present_flag = %d\n", p->vui_fields.bits.timing_info_present_flag);
1456 va_TraceMsg(trace_ctx, "\tbitstream_restriction_flag = %d\n", p->vui_fields.bits.bitstream_restriction_flag);
1457 va_TraceMsg(trace_ctx, "\tlog2_max_mv_length_horizontal = %d\n", p->vui_fields.bits.log2_max_mv_length_horizontal);
1458 va_TraceMsg(trace_ctx, "\tlog2_max_mv_length_vertical = %d\n", p->vui_fields.bits.log2_max_mv_length_vertical);
1459 va_TraceMsg(trace_ctx, "\taspect_ratio_idc = %d\n", p->aspect_ratio_idc);
1460 va_TraceMsg(trace_ctx, "\tsar_width = %d\n", p->sar_width);
1461 va_TraceMsg(trace_ctx, "\tsar_height = %d\n", p->sar_height);
1462 va_TraceMsg(trace_ctx, "\tnum_units_in_tick = %d\n", p->num_units_in_tick);
1463 va_TraceMsg(trace_ctx, "\ttime_scale = %d\n", p->time_scale);
1465 va_TraceMsg(trace_ctx, NULL);
1471 static void va_TraceVAEncPictureParameterBufferH264(
1473 VAContextID context,
1477 unsigned int num_elements,
1480 VAEncPictureParameterBufferH264 *p = (VAEncPictureParameterBufferH264 *)data;
1484 va_TraceMsg(trace_ctx, "\t--VAEncPictureParameterBufferH264\n");
1486 va_TraceMsg(trace_ctx, "\tCurrPic.picture_id = 0x%08x\n", p->CurrPic.picture_id);
1487 va_TraceMsg(trace_ctx, "\tCurrPic.frame_idx = %d\n", p->CurrPic.frame_idx);
1488 va_TraceMsg(trace_ctx, "\tCurrPic.flags = %d\n", p->CurrPic.flags);
1489 va_TraceMsg(trace_ctx, "\tCurrPic.TopFieldOrderCnt = %d\n", p->CurrPic.TopFieldOrderCnt);
1490 va_TraceMsg(trace_ctx, "\tCurrPic.BottomFieldOrderCnt = %d\n", p->CurrPic.BottomFieldOrderCnt);
1491 va_TraceMsg(trace_ctx, "\tReferenceFrames (TopFieldOrderCnt-BottomFieldOrderCnt-picture_id-frame_idx-flags):\n");
1492 for (i = 0; i < 16; i++)
1494 if ((p->ReferenceFrames[i].picture_id != VA_INVALID_SURFACE) &&
1495 ((p->ReferenceFrames[i].flags & VA_PICTURE_H264_INVALID) == 0)) {
1496 va_TraceMsg(trace_ctx, "\t\t%08d-%08d-0x%08x-%08d-0x%08x\n",
1497 p->ReferenceFrames[i].TopFieldOrderCnt,
1498 p->ReferenceFrames[i].BottomFieldOrderCnt,
1499 p->ReferenceFrames[i].picture_id,
1500 p->ReferenceFrames[i].frame_idx,
1501 p->ReferenceFrames[i].flags
1506 va_TraceMsg(trace_ctx, "\tcoded_buf = %08x\n", p->coded_buf);
1507 va_TraceMsg(trace_ctx, "\tpic_parameter_set_id = %d\n", p->pic_parameter_set_id);
1508 va_TraceMsg(trace_ctx, "\tseq_parameter_set_id = %d\n", p->seq_parameter_set_id);
1509 va_TraceMsg(trace_ctx, "\tlast_picture = 0x%08x\n", p->last_picture);
1510 va_TraceMsg(trace_ctx, "\tframe_num = %d\n", p->frame_num);
1511 va_TraceMsg(trace_ctx, "\tpic_init_qp = %d\n", p->pic_init_qp);
1512 va_TraceMsg(trace_ctx, "\tnum_ref_idx_l0_active_minus1 = %d\n", p->num_ref_idx_l0_active_minus1);
1513 va_TraceMsg(trace_ctx, "\tnum_ref_idx_l1_active_minus1 = %d\n", p->num_ref_idx_l1_active_minus1);
1514 va_TraceMsg(trace_ctx, "\tchroma_qp_index_offset = %d\n", p->chroma_qp_index_offset);
1515 va_TraceMsg(trace_ctx, "\tsecond_chroma_qp_index_offset = %d\n", p->second_chroma_qp_index_offset);
1516 va_TraceMsg(trace_ctx, "\tpic_fields = 0x%03x\n", p->pic_fields.value);
1517 va_TraceMsg(trace_ctx, "\tidr_pic_flag = %d\n", p->pic_fields.bits.idr_pic_flag);
1518 va_TraceMsg(trace_ctx, "\treference_pic_flag = %d\n", p->pic_fields.bits.reference_pic_flag);
1519 va_TraceMsg(trace_ctx, "\tentropy_coding_mode_flag = %d\n", p->pic_fields.bits.entropy_coding_mode_flag);
1520 va_TraceMsg(trace_ctx, "\tweighted_pred_flag = %d\n", p->pic_fields.bits.weighted_pred_flag);
1521 va_TraceMsg(trace_ctx, "\tweighted_bipred_idc = %d\n", p->pic_fields.bits.weighted_bipred_idc);
1522 va_TraceMsg(trace_ctx, "\tconstrained_intra_pred_flag = %d\n", p->pic_fields.bits.constrained_intra_pred_flag);
1523 va_TraceMsg(trace_ctx, "\ttransform_8x8_mode_flag = %d\n", p->pic_fields.bits.transform_8x8_mode_flag);
1524 va_TraceMsg(trace_ctx, "\tdeblocking_filter_control_present_flag = %d\n", p->pic_fields.bits.deblocking_filter_control_present_flag);
1525 va_TraceMsg(trace_ctx, "\tredundant_pic_cnt_present_flag = %d\n", p->pic_fields.bits.redundant_pic_cnt_present_flag);
1526 va_TraceMsg(trace_ctx, "\tpic_order_present_flag = %d\n", p->pic_fields.bits.pic_order_present_flag);
1527 va_TraceMsg(trace_ctx, "\tpic_scaling_matrix_present_flag = %d\n", p->pic_fields.bits.pic_scaling_matrix_present_flag);
1529 va_TraceMsg(trace_ctx, NULL);
1534 static void va_TraceVAEncSliceParameterBuffer(
1536 VAContextID context,
1540 unsigned int num_elements,
1543 VAEncSliceParameterBuffer* p = (VAEncSliceParameterBuffer*)data;
1546 va_TraceMsg(trace_ctx, "\t--VAEncSliceParameterBuffer\n");
1548 va_TraceMsg(trace_ctx, "\tstart_row_number = %d\n", p->start_row_number);
1549 va_TraceMsg(trace_ctx, "\tslice_height = %d\n", p->slice_height);
1550 va_TraceMsg(trace_ctx, "\tslice_flags.is_intra = %d\n", p->slice_flags.bits.is_intra);
1551 va_TraceMsg(trace_ctx, "\tslice_flags.disable_deblocking_filter_idc = %d\n", p->slice_flags.bits.disable_deblocking_filter_idc);
1552 va_TraceMsg(trace_ctx, "\tslice_flags.uses_long_term_ref = %d\n", p->slice_flags.bits.uses_long_term_ref);
1553 va_TraceMsg(trace_ctx, "\tslice_flags.is_long_term_ref = %d\n", p->slice_flags.bits.is_long_term_ref);
1554 va_TraceMsg(trace_ctx, NULL);
1559 static void va_TraceVAEncSliceParameterBufferH264(
1561 VAContextID context,
1565 unsigned int num_elements,
1568 VAEncSliceParameterBufferH264* p = (VAEncSliceParameterBufferH264*)data;
1575 va_TraceMsg(trace_ctx, "\t--VAEncSliceParameterBufferH264\n");
1576 va_TraceMsg(trace_ctx, "\tmacroblock_address = %d\n", p->macroblock_address);
1577 va_TraceMsg(trace_ctx, "\tnum_macroblocks = %d\n", p->num_macroblocks);
1578 va_TraceMsg(trace_ctx, "\tmacroblock_info = %08x\n", p->macroblock_info);
1579 va_TraceMsg(trace_ctx, "\tslice_type = %d\n", p->slice_type);
1580 va_TraceMsg(trace_ctx, "\tpic_parameter_set_id = %d\n", p->pic_parameter_set_id);
1581 va_TraceMsg(trace_ctx, "\tidr_pic_id = %d\n", p->idr_pic_id);
1582 va_TraceMsg(trace_ctx, "\tpic_order_cnt_lsb = %d\n", p->pic_order_cnt_lsb);
1583 va_TraceMsg(trace_ctx, "\tdelta_pic_order_cnt_bottom = %d\n", p->delta_pic_order_cnt_bottom);
1584 va_TraceMsg(trace_ctx, "\tdelta_pic_order_cnt[0] = %d\n", p->delta_pic_order_cnt[0]);
1585 va_TraceMsg(trace_ctx, "\tdelta_pic_order_cnt[1] = %d\n", p->delta_pic_order_cnt[1]);
1586 va_TraceMsg(trace_ctx, "\tdirect_spatial_mv_pred_flag = %d\n", p->direct_spatial_mv_pred_flag);
1587 va_TraceMsg(trace_ctx, "\tnum_ref_idx_active_override_flag = %d\n", p->num_ref_idx_active_override_flag);
1588 va_TraceMsg(trace_ctx, "\tnum_ref_idx_l1_active_minus1 = %d\n", p->num_ref_idx_l1_active_minus1);
1589 va_TraceMsg(trace_ctx, "\tslice_beta_offset_div2 = %d\n", p->slice_beta_offset_div2);
1591 va_TraceMsg(trace_ctx, "\tRefPicList0 (TopFieldOrderCnt-BottomFieldOrderCnt-picture_id-frame_idx-flags):\n");
1595 for (i = 0; i < 32; i++) {
1596 if ((p->RefPicList0[i].picture_id != VA_INVALID_SURFACE) &&
1597 ((p->RefPicList0[i].flags & VA_PICTURE_H264_INVALID) == 0))
1598 va_TraceMsg(trace_ctx, "\t\t%08d-%08d-0x%08x-%08d-0x%08x\n",
1599 p->RefPicList0[i].TopFieldOrderCnt,
1600 p->RefPicList0[i].BottomFieldOrderCnt,
1601 p->RefPicList0[i].picture_id,
1602 p->RefPicList0[i].frame_idx,
1603 p->RefPicList0[i].flags);
1608 va_TraceMsg(trace_ctx, "\tRefPicList1 (TopFieldOrderCnt-BottomFieldOrderCnt-picture_id-frame_idx-flags):\n");
1609 for (i = 0; i < 32; i++) {
1610 if ((p->RefPicList1[i].picture_id != VA_INVALID_SURFACE) &&
1611 ((p->RefPicList1[i].flags & VA_PICTURE_H264_INVALID) == 0))
1612 va_TraceMsg(trace_ctx, "\t\t%08d-%08d-0x%08x-%08d-0x%08d\n",
1613 p->RefPicList1[i].TopFieldOrderCnt,
1614 p->RefPicList1[i].BottomFieldOrderCnt,
1615 p->RefPicList1[i].picture_id,
1616 p->RefPicList1[i].frame_idx,
1617 p->RefPicList1[i].flags
1623 va_TraceMsg(trace_ctx, "\tluma_log2_weight_denom = %d\n", p->luma_log2_weight_denom);
1624 va_TraceMsg(trace_ctx, "\tchroma_log2_weight_denom = %d\n", p->chroma_log2_weight_denom);
1625 va_TraceMsg(trace_ctx, "\tluma_weight_l0_flag = %d\n", p->luma_weight_l0_flag);
1626 if (p->luma_weight_l0_flag) {
1627 for (i = 0; (i <= p->num_ref_idx_l0_active_minus1) && (i<32); i++) {
1628 va_TraceMsg(trace_ctx, "\t\t%d\t%d\n",
1629 p->luma_weight_l0[i],
1630 p->luma_offset_l0[i]);
1634 va_TraceMsg(trace_ctx, "\tchroma_weight_l0_flag = %d\n", p->chroma_weight_l0_flag);
1635 if (p->chroma_weight_l0_flag) {
1636 for (i = 0; (i <= p->num_ref_idx_l0_active_minus1) && (i<32); i++) {
1637 va_TraceMsg(trace_ctx, "\t\t%d\t%d\t%d\t%d\n",
1638 p->chroma_weight_l0[i][0],
1639 p->chroma_offset_l0[i][0],
1640 p->chroma_weight_l0[i][1],
1641 p->chroma_offset_l0[i][1]);
1645 va_TraceMsg(trace_ctx, "\tluma_weight_l1_flag = %d\n", p->luma_weight_l1_flag);
1646 if (p->luma_weight_l1_flag) {
1647 for (i = 0; (i <= p->num_ref_idx_l1_active_minus1) && (i<32); i++) {
1648 va_TraceMsg(trace_ctx, "\t\t%d\t\t%d\n",
1649 p->luma_weight_l1[i],
1650 p->luma_offset_l1[i]);
1654 va_TraceMsg(trace_ctx, "\tchroma_weight_l1_flag = %d\n", p->chroma_weight_l1_flag);
1655 if (p->chroma_weight_l1_flag && p->num_ref_idx_l1_active_minus1 < 32) {
1656 for (i = 0; (i <= p->num_ref_idx_l1_active_minus1) && (i<32); i++) {
1657 va_TraceMsg(trace_ctx, "\t\t%d\t%d\t%d\t%d\n",
1658 p->chroma_weight_l1[i][0],
1659 p->chroma_offset_l1[i][0],
1660 p->chroma_weight_l1[i][1],
1661 p->chroma_offset_l1[i][1]);
1664 va_TraceMsg(trace_ctx, NULL);
1666 va_TraceMsg(trace_ctx, "\tcabac_init_idc = %d\n", p->cabac_init_idc);
1667 va_TraceMsg(trace_ctx, "\tslice_qp_delta = %d\n", p->slice_qp_delta);
1668 va_TraceMsg(trace_ctx, "\tdisable_deblocking_filter_idc = %d\n", p->disable_deblocking_filter_idc);
1669 va_TraceMsg(trace_ctx, "\tslice_alpha_c0_offset_div2 = %d\n", p->slice_alpha_c0_offset_div2);
1670 va_TraceMsg(trace_ctx, "\tslice_beta_offset_div2 = %d\n", p->slice_beta_offset_div2);
1671 va_TraceMsg(trace_ctx, NULL);
1677 static void va_TraceVAEncPackedHeaderParameterBufferType(
1679 VAContextID context,
1683 unsigned int num_elements,
1686 VAEncPackedHeaderParameterBuffer* p = (VAEncPackedHeaderParameterBuffer*)data;
1692 va_TraceMsg(trace_ctx, "\t--VAEncPackedHeaderParameterBuffer\n");
1693 va_TraceMsg(trace_ctx, "\ttype = 0x%08x\n", p->type);
1694 va_TraceMsg(trace_ctx, "\tbit_length = %d\n", p->bit_length);
1695 va_TraceMsg(trace_ctx, "\thas_emulation_bytes = %d\n", p->has_emulation_bytes);
1696 va_TraceMsg(trace_ctx, NULL);
1701 static void va_TraceVAEncMiscParameterBuffer(
1703 VAContextID context,
1707 unsigned int num_elements,
1710 VAEncMiscParameterBuffer* tmp = (VAEncMiscParameterBuffer*)data;
1713 switch (tmp->type) {
1714 case VAEncMiscParameterTypeFrameRate:
1716 VAEncMiscParameterFrameRate *p = (VAEncMiscParameterFrameRate *)tmp->data;
1717 va_TraceMsg(trace_ctx, "\t--VAEncMiscParameterFrameRate\n");
1718 va_TraceMsg(trace_ctx, "\tframerate = %d\n", p->framerate);
1722 case VAEncMiscParameterTypeRateControl:
1724 VAEncMiscParameterRateControl *p = (VAEncMiscParameterRateControl *)tmp->data;
1726 va_TraceMsg(trace_ctx, "\t--VAEncMiscParameterRateControl\n");
1727 va_TraceMsg(trace_ctx, "\tbits_per_second = %d\n", p->bits_per_second);
1728 va_TraceMsg(trace_ctx, "\ttarget_percentage = %d\n", p->target_percentage);
1729 va_TraceMsg(trace_ctx, "\twindow_size = %d\n", p->window_size);
1730 va_TraceMsg(trace_ctx, "\tinitial_qp = %d\n", p->initial_qp);
1731 va_TraceMsg(trace_ctx, "\tmin_qp = %d\n", p->min_qp);
1732 va_TraceMsg(trace_ctx, "\tbasic_unit_size = %d\n", p->basic_unit_size);
1733 va_TraceMsg(trace_ctx, "\trc_flags.reset = %d \n", p->rc_flags.bits.reset);
1734 va_TraceMsg(trace_ctx, "\trc_flags.disable_frame_skip = %d\n", p->rc_flags.bits.disable_frame_skip);
1735 va_TraceMsg(trace_ctx, "\trc_flags.disable_bit_stuffing = %d\n", p->rc_flags.bits.disable_bit_stuffing);
1738 case VAEncMiscParameterTypeMaxSliceSize:
1740 VAEncMiscParameterMaxSliceSize *p = (VAEncMiscParameterMaxSliceSize *)tmp->data;
1742 va_TraceMsg(trace_ctx, "\t--VAEncMiscParameterTypeMaxSliceSize\n");
1743 va_TraceMsg(trace_ctx, "\tmax_slice_size = %d\n", p->max_slice_size);
1746 case VAEncMiscParameterTypeAIR:
1748 VAEncMiscParameterAIR *p = (VAEncMiscParameterAIR *)tmp->data;
1750 va_TraceMsg(trace_ctx, "\t--VAEncMiscParameterAIR\n");
1751 va_TraceMsg(trace_ctx, "\tair_num_mbs = %d\n", p->air_num_mbs);
1752 va_TraceMsg(trace_ctx, "\tair_threshold = %d\n", p->air_threshold);
1753 va_TraceMsg(trace_ctx, "\tair_auto = %d\n", p->air_auto);
1756 case VAEncMiscParameterTypeHRD:
1758 VAEncMiscParameterHRD *p = (VAEncMiscParameterHRD *)tmp->data;
1760 va_TraceMsg(trace_ctx, "\t--VAEncMiscParameterHRD\n");
1761 va_TraceMsg(trace_ctx, "\tinitial_buffer_fullness = %d\n", p->initial_buffer_fullness);
1762 va_TraceMsg(trace_ctx, "\tbuffer_size = %d\n", p->buffer_size);
1765 case VAEncMiscParameterTypeMaxFrameSize:
1767 VAEncMiscParameterBufferMaxFrameSize *p = (VAEncMiscParameterBufferMaxFrameSize *)tmp->data;
1769 va_TraceMsg(trace_ctx, "\t--VAEncMiscParameterTypeMaxFrameSize\n");
1770 va_TraceMsg(trace_ctx, "\tmax_frame_size = %d\n", p->max_frame_size);
1774 va_TraceMsg(trace_ctx, "Unknown VAEncMiscParameterBuffer(type = %d):\n", tmp->type);
1775 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data);
1778 va_TraceMsg(trace_ctx, NULL);
1784 static void va_TraceVAPictureParameterBufferVC1(
1786 VAContextID context,
1790 unsigned int num_elements,
1794 VAPictureParameterBufferVC1* p = (VAPictureParameterBufferVC1*)data;
1797 va_TraceMsg(trace_ctx, "\t--VAPictureParameterBufferVC1\n");
1799 va_TraceMsg(trace_ctx, "\tforward_reference_picture = 0x%08x\n", p->forward_reference_picture);
1800 va_TraceMsg(trace_ctx, "\tbackward_reference_picture = 0x%08x\n", p->backward_reference_picture);
1801 va_TraceMsg(trace_ctx, "\tinloop_decoded_picture = 0x%08x\n", p->inloop_decoded_picture);
1803 va_TraceMsg(trace_ctx, "\tpulldown = %d\n", p->sequence_fields.bits.pulldown);
1804 va_TraceMsg(trace_ctx, "\tinterlace = %d\n", p->sequence_fields.bits.interlace);
1805 va_TraceMsg(trace_ctx, "\ttfcntrflag = %d\n", p->sequence_fields.bits.tfcntrflag);
1806 va_TraceMsg(trace_ctx, "\tfinterpflag = %d\n", p->sequence_fields.bits.finterpflag);
1807 va_TraceMsg(trace_ctx, "\tpsf = %d\n", p->sequence_fields.bits.psf);
1808 va_TraceMsg(trace_ctx, "\tmultires = %d\n", p->sequence_fields.bits.multires);
1809 va_TraceMsg(trace_ctx, "\toverlap = %d\n", p->sequence_fields.bits.overlap);
1810 va_TraceMsg(trace_ctx, "\tsyncmarker = %d\n", p->sequence_fields.bits.syncmarker);
1811 va_TraceMsg(trace_ctx, "\trangered = %d\n", p->sequence_fields.bits.rangered);
1812 va_TraceMsg(trace_ctx, "\tmax_b_frames = %d\n", p->sequence_fields.bits.max_b_frames);
1813 va_TraceMsg(trace_ctx, "\tprofile = %d\n", p->sequence_fields.bits.profile);
1814 va_TraceMsg(trace_ctx, "\tcoded_width = %d\n", p->coded_width);
1815 va_TraceMsg(trace_ctx, "\tcoded_height = %d\n", p->coded_height);
1816 va_TraceMsg(trace_ctx, "\tclosed_entry = %d\n", p->entrypoint_fields.bits.closed_entry);
1817 va_TraceMsg(trace_ctx, "\tbroken_link = %d\n", p->entrypoint_fields.bits.broken_link);
1818 va_TraceMsg(trace_ctx, "\tclosed_entry = %d\n", p->entrypoint_fields.bits.closed_entry);
1819 va_TraceMsg(trace_ctx, "\tpanscan_flag = %d\n", p->entrypoint_fields.bits.panscan_flag);
1820 va_TraceMsg(trace_ctx, "\tloopfilter = %d\n", p->entrypoint_fields.bits.loopfilter);
1821 va_TraceMsg(trace_ctx, "\tconditional_overlap_flag = %d\n", p->conditional_overlap_flag);
1822 va_TraceMsg(trace_ctx, "\tfast_uvmc_flag = %d\n", p->fast_uvmc_flag);
1823 va_TraceMsg(trace_ctx, "\trange_mapping_luma_flag = %d\n", p->range_mapping_fields.bits.luma_flag);
1824 va_TraceMsg(trace_ctx, "\trange_mapping_luma = %d\n", p->range_mapping_fields.bits.luma);
1825 va_TraceMsg(trace_ctx, "\trange_mapping_chroma_flag = %d\n", p->range_mapping_fields.bits.chroma_flag);
1826 va_TraceMsg(trace_ctx, "\trange_mapping_chroma = %d\n", p->range_mapping_fields.bits.chroma);
1827 va_TraceMsg(trace_ctx, "\tb_picture_fraction = %d\n", p->b_picture_fraction);
1828 va_TraceMsg(trace_ctx, "\tcbp_table = %d\n", p->cbp_table);
1829 va_TraceMsg(trace_ctx, "\tmb_mode_table = %d\n", p->mb_mode_table);
1830 va_TraceMsg(trace_ctx, "\trange_reduction_frame = %d\n", p->range_reduction_frame);
1831 va_TraceMsg(trace_ctx, "\trounding_control = %d\n", p->rounding_control);
1832 va_TraceMsg(trace_ctx, "\tpost_processing = %d\n", p->post_processing);
1833 va_TraceMsg(trace_ctx, "\tpicture_resolution_index = %d\n", p->picture_resolution_index);
1834 va_TraceMsg(trace_ctx, "\tluma_scale = %d\n", p->luma_scale);
1835 va_TraceMsg(trace_ctx, "\tluma_shift = %d\n", p->luma_shift);
1836 va_TraceMsg(trace_ctx, "\tpicture_type = %d\n", p->picture_fields.bits.picture_type);
1837 va_TraceMsg(trace_ctx, "\tframe_coding_mode = %d\n", p->picture_fields.bits.frame_coding_mode);
1838 va_TraceMsg(trace_ctx, "\ttop_field_first = %d\n", p->picture_fields.bits.top_field_first);
1839 va_TraceMsg(trace_ctx, "\tis_first_field = %d\n", p->picture_fields.bits.is_first_field);
1840 va_TraceMsg(trace_ctx, "\tintensity_compensation = %d\n", p->picture_fields.bits.intensity_compensation);
1841 va_TraceMsg(trace_ctx, "\tmv_type_mb = %d\n", p->raw_coding.flags.mv_type_mb);
1842 va_TraceMsg(trace_ctx, "\tdirect_mb = %d\n", p->raw_coding.flags.direct_mb);
1843 va_TraceMsg(trace_ctx, "\tskip_mb = %d\n", p->raw_coding.flags.skip_mb);
1844 va_TraceMsg(trace_ctx, "\tfield_tx = %d\n", p->raw_coding.flags.field_tx);
1845 va_TraceMsg(trace_ctx, "\tforward_mb = %d\n", p->raw_coding.flags.forward_mb);
1846 va_TraceMsg(trace_ctx, "\tac_pred = %d\n", p->raw_coding.flags.ac_pred);
1847 va_TraceMsg(trace_ctx, "\toverflags = %d\n", p->raw_coding.flags.overflags);
1848 va_TraceMsg(trace_ctx, "\tbp_mv_type_mb = %d\n", p->bitplane_present.flags.bp_mv_type_mb);
1849 va_TraceMsg(trace_ctx, "\tbp_direct_mb = %d\n", p->bitplane_present.flags.bp_direct_mb);
1850 va_TraceMsg(trace_ctx, "\tbp_skip_mb = %d\n", p->bitplane_present.flags.bp_skip_mb);
1851 va_TraceMsg(trace_ctx, "\tbp_field_tx = %d\n", p->bitplane_present.flags.bp_field_tx);
1852 va_TraceMsg(trace_ctx, "\tbp_forward_mb = %d\n", p->bitplane_present.flags.bp_forward_mb);
1853 va_TraceMsg(trace_ctx, "\tbp_ac_pred = %d\n", p->bitplane_present.flags.bp_ac_pred);
1854 va_TraceMsg(trace_ctx, "\tbp_overflags = %d\n", p->bitplane_present.flags.bp_overflags);
1855 va_TraceMsg(trace_ctx, "\treference_distance_flag = %d\n", p->reference_fields.bits.reference_distance_flag);
1856 va_TraceMsg(trace_ctx, "\treference_distance = %d\n", p->reference_fields.bits.reference_distance);
1857 va_TraceMsg(trace_ctx, "\tnum_reference_pictures = %d\n", p->reference_fields.bits.num_reference_pictures);
1858 va_TraceMsg(trace_ctx, "\treference_field_pic_indicator = %d\n", p->reference_fields.bits.reference_field_pic_indicator);
1859 va_TraceMsg(trace_ctx, "\tmv_mode = %d\n", p->mv_fields.bits.mv_mode);
1860 va_TraceMsg(trace_ctx, "\tmv_mode2 = %d\n", p->mv_fields.bits.mv_mode2);
1861 va_TraceMsg(trace_ctx, "\tmv_table = %d\n", p->mv_fields.bits.mv_table);
1862 va_TraceMsg(trace_ctx, "\ttwo_mv_block_pattern_table = %d\n", p->mv_fields.bits.two_mv_block_pattern_table);
1863 va_TraceMsg(trace_ctx, "\tfour_mv_switch = %d\n", p->mv_fields.bits.four_mv_switch);
1864 va_TraceMsg(trace_ctx, "\tfour_mv_block_pattern_table = %d\n", p->mv_fields.bits.four_mv_block_pattern_table);
1865 va_TraceMsg(trace_ctx, "\textended_mv_flag = %d\n", p->mv_fields.bits.extended_mv_flag);
1866 va_TraceMsg(trace_ctx, "\textended_mv_range = %d\n", p->mv_fields.bits.extended_mv_range);
1867 va_TraceMsg(trace_ctx, "\textended_dmv_flag = %d\n", p->mv_fields.bits.extended_dmv_flag);
1868 va_TraceMsg(trace_ctx, "\textended_dmv_range = %d\n", p->mv_fields.bits.extended_dmv_range);
1869 va_TraceMsg(trace_ctx, "\tdquant = %d\n", p->pic_quantizer_fields.bits.dquant);
1870 va_TraceMsg(trace_ctx, "\tquantizer = %d\n", p->pic_quantizer_fields.bits.quantizer);
1871 va_TraceMsg(trace_ctx, "\thalf_qp = %d\n", p->pic_quantizer_fields.bits.half_qp);
1872 va_TraceMsg(trace_ctx, "\tpic_quantizer_scale = %d\n", p->pic_quantizer_fields.bits.pic_quantizer_scale);
1873 va_TraceMsg(trace_ctx, "\tpic_quantizer_type = %d\n", p->pic_quantizer_fields.bits.pic_quantizer_type);
1874 va_TraceMsg(trace_ctx, "\tdq_frame = %d\n", p->pic_quantizer_fields.bits.dq_frame);
1875 va_TraceMsg(trace_ctx, "\tdq_profile = %d\n", p->pic_quantizer_fields.bits.dq_profile);
1876 va_TraceMsg(trace_ctx, "\tdq_sb_edge = %d\n", p->pic_quantizer_fields.bits.dq_sb_edge);
1877 va_TraceMsg(trace_ctx, "\tdq_db_edge = %d\n", p->pic_quantizer_fields.bits.dq_db_edge);
1878 va_TraceMsg(trace_ctx, "\tdq_binary_level = %d\n", p->pic_quantizer_fields.bits.dq_binary_level);
1879 va_TraceMsg(trace_ctx, "\talt_pic_quantizer = %d\n", p->pic_quantizer_fields.bits.alt_pic_quantizer);
1880 va_TraceMsg(trace_ctx, "\tvariable_sized_transform_flag = %d\n", p->transform_fields.bits.variable_sized_transform_flag);
1881 va_TraceMsg(trace_ctx, "\tmb_level_transform_type_flag = %d\n", p->transform_fields.bits.mb_level_transform_type_flag);
1882 va_TraceMsg(trace_ctx, "\tframe_level_transform_type = %d\n", p->transform_fields.bits.frame_level_transform_type);
1883 va_TraceMsg(trace_ctx, "\ttransform_ac_codingset_idx1 = %d\n", p->transform_fields.bits.transform_ac_codingset_idx1);
1884 va_TraceMsg(trace_ctx, "\ttransform_ac_codingset_idx2 = %d\n", p->transform_fields.bits.transform_ac_codingset_idx2);
1885 va_TraceMsg(trace_ctx, "\tintra_transform_dc_table = %d\n", p->transform_fields.bits.intra_transform_dc_table);
1886 va_TraceMsg(trace_ctx, NULL);
1889 static void va_TraceVASliceParameterBufferVC1(
1891 VAContextID context,
1895 unsigned int num_elements,
1899 VASliceParameterBufferVC1 *p = (VASliceParameterBufferVC1*)data;
1902 trace_ctx->trace_slice_no++;
1903 trace_ctx->trace_slice_size = p->slice_data_size;
1905 va_TraceMsg(trace_ctx, "\t--VASliceParameterBufferVC1\n");
1906 va_TraceMsg(trace_ctx, "\tslice_data_size = %d\n", p->slice_data_size);
1907 va_TraceMsg(trace_ctx, "\tslice_data_offset = %d\n", p->slice_data_offset);
1908 va_TraceMsg(trace_ctx, "\tslice_data_flag = %d\n", p->slice_data_flag);
1909 va_TraceMsg(trace_ctx, "\tmacroblock_offset = %d\n", p->macroblock_offset);
1910 va_TraceMsg(trace_ctx, "\tslice_vertical_position = %d\n", p->slice_vertical_position);
1911 va_TraceMsg(trace_ctx, NULL);
1914 static void va_TraceVAPictureParameterBufferVP8(
1916 VAContextID context,
1920 unsigned int num_elements,
1924 VAPictureParameterBufferVP8 *p = (VAPictureParameterBufferVP8 *)data;
1928 va_TraceMsg(trace_ctx, "\t--VAPictureParameterBufferVP8\n");
1930 va_TraceMsg(trace_ctx, "\tframe_width = %d\n", p->frame_width);
1931 va_TraceMsg(trace_ctx, "\tframe_height = %d\n", p->frame_height);
1932 va_TraceMsg(trace_ctx, "\tlast_ref_frame = %x\n", p->last_ref_frame);
1933 va_TraceMsg(trace_ctx, "\tgolden_ref_frame = %x\n", p->golden_ref_frame);
1934 va_TraceMsg(trace_ctx, "\talt_ref_frame = %x\n", p->alt_ref_frame);
1935 va_TraceMsg(trace_ctx, "\tout_of_loop_frame = %x\n", p->out_of_loop_frame);
1937 va_TraceMsg(trace_ctx, "\tkey_frame = %d\n", p->pic_fields.bits.key_frame);
1938 va_TraceMsg(trace_ctx, "\tversion = %d\n", p->pic_fields.bits.version);
1939 va_TraceMsg(trace_ctx, "\tsegmentation_enabled = %d\n", p->pic_fields.bits.segmentation_enabled);
1940 va_TraceMsg(trace_ctx, "\tupdate_mb_segmentation_map = %d\n", p->pic_fields.bits.update_mb_segmentation_map);
1941 va_TraceMsg(trace_ctx, "\tupdate_segment_feature_data = %d\n", p->pic_fields.bits.update_segment_feature_data);
1942 va_TraceMsg(trace_ctx, "\tfilter_type = %d\n", p->pic_fields.bits.filter_type);
1943 va_TraceMsg(trace_ctx, "\tsharpness_level = %d\n", p->pic_fields.bits.sharpness_level);
1944 va_TraceMsg(trace_ctx, "\tloop_filter_adj_enable = %d\n", p->pic_fields.bits.loop_filter_adj_enable);
1945 va_TraceMsg(trace_ctx, "\tmode_ref_lf_delta_update = %d\n", p->pic_fields.bits.mode_ref_lf_delta_update);
1946 va_TraceMsg(trace_ctx, "\tsign_bias_golden = %d\n", p->pic_fields.bits.sign_bias_golden);
1947 va_TraceMsg(trace_ctx, "\tsign_bias_alternate = %d\n", p->pic_fields.bits.sign_bias_alternate);
1948 va_TraceMsg(trace_ctx, "\tmb_no_coeff_skip = %d\n", p->pic_fields.bits.mb_no_coeff_skip);
1949 va_TraceMsg(trace_ctx, "\tloop_filter_disable = %d\n", p->pic_fields.bits.loop_filter_disable);
1951 va_TraceMsg(trace_ctx, "\tmb_segment_tree_probs: 0x%2x, 0x%2x, 0x%2x\n",
1952 p->mb_segment_tree_probs[0], p->mb_segment_tree_probs[1], p->mb_segment_tree_probs[2]);
1954 va_TraceMsg(trace_ctx, "\tloop_filter_level: %d, %d, %d, %d\n",
1955 p->loop_filter_level[0], p->loop_filter_level[1], p->loop_filter_level[2], p->loop_filter_level[3]);
1957 va_TraceMsg(trace_ctx, "\tloop_filter_deltas_ref_frame: %d, %d, %d, %d\n",
1958 p->loop_filter_deltas_ref_frame[0], p->loop_filter_deltas_ref_frame[1], p->loop_filter_deltas_ref_frame[2], p->loop_filter_deltas_ref_frame[3]);
1960 va_TraceMsg(trace_ctx, "\tloop_filter_deltas_mode: %d, %d, %d, %d\n",
1961 p->loop_filter_deltas_mode[0], p->loop_filter_deltas_mode[1], p->loop_filter_deltas_mode[2], p->loop_filter_deltas_mode[3]);
1963 va_TraceMsg(trace_ctx, "\tprob_skip_false = %2x\n", p->prob_skip_false);
1964 va_TraceMsg(trace_ctx, "\tprob_intra = %2x\n", p->prob_intra);
1965 va_TraceMsg(trace_ctx, "\tprob_last = %2x\n", p->prob_last);
1966 va_TraceMsg(trace_ctx, "\tprob_gf = %2x\n", p->prob_gf);
1968 va_TraceMsg(trace_ctx, "\ty_mode_probs: 0x%2x, 0x%2x, 0x%2x, 0x%2x\n",
1969 p->y_mode_probs[0], p->y_mode_probs[1], p->y_mode_probs[2], p->y_mode_probs[3]);
1971 va_TraceMsg(trace_ctx, "\tuv_mode_probs: 0x%2x, 0x%2x, 0x%2x\n",
1972 p->uv_mode_probs[0], p->uv_mode_probs[1], p->uv_mode_probs[2]);
1974 va_TraceMsg(trace_ctx, "\tmv_probs[2][19]:\n");
1975 for(i = 0; i<2; ++i) {
1976 memset(tmp, 0, sizeof tmp);
1977 for (j=0; j<19; j++)
1978 sprintf(tmp + strlen(tmp), "%2x ", p->mv_probs[i][j]);
1979 va_TraceMsg(trace_ctx,"\t\t[%d] = %s\n", i, tmp);
1982 va_TraceMsg(trace_ctx, "\tbool_coder_ctx: range = %02x, value = %02x, count = %d\n",
1983 p->bool_coder_ctx.range, p->bool_coder_ctx.value, p->bool_coder_ctx.count);
1985 va_TraceMsg(trace_ctx, NULL);
1990 static void va_TraceVASliceParameterBufferVP8(
1992 VAContextID context,
1996 unsigned int num_elements,
1999 VASliceParameterBufferVP8 *p = (VASliceParameterBufferVP8 *)data;
2003 va_TraceMsg(trace_ctx, "\t--VASliceParameterBufferVP8\n");
2005 va_TraceMsg(trace_ctx, "\tslice_data_size = %d\n", p->slice_data_size);
2006 va_TraceMsg(trace_ctx, "\tslice_data_offset = %d\n", p->slice_data_offset);
2007 va_TraceMsg(trace_ctx, "\tslice_data_flag = %d\n", p->slice_data_flag);
2008 va_TraceMsg(trace_ctx, "\tmacroblock_offset = %d\n", p->macroblock_offset);
2009 va_TraceMsg(trace_ctx, "\tnum_of_partitions = %d\n", p->num_of_partitions);
2011 for(i = 0; i<9; ++i)
2012 va_TraceMsg(trace_ctx, "\tpartition_size[%d] = %d\n", i, p->partition_size[i]);
2014 va_TraceMsg(trace_ctx, NULL);
2019 static void va_TraceVAIQMatrixBufferVP8(
2021 VAContextID context,
2025 unsigned int num_elements,
2029 VAIQMatrixBufferVP8 *p = (VAIQMatrixBufferVP8 *)data;
2033 va_TraceMsg(trace_ctx, "\t--VAIQMatrixBufferVP8\n");
2035 va_TraceMsg(trace_ctx, "\tquantization_index[4][6]=\n");
2036 for (i = 0; i < 4; i++) {
2037 memset(tmp, 0, sizeof tmp);
2038 for (j = 0; j < 6; j++)
2039 sprintf(tmp + strlen(tmp), "%4x, ", p->quantization_index[i][j]);
2040 va_TraceMsg(trace_ctx,"\t\t[%d] = %s\n", i, tmp);
2043 va_TraceMsg(trace_ctx, NULL);
2047 static void va_TraceVAProbabilityBufferVP8(
2049 VAContextID context,
2053 unsigned int num_elements,
2057 VAProbabilityDataBufferVP8 *p = (VAProbabilityDataBufferVP8 *)data;
2061 va_TraceMsg(trace_ctx, "\t--VAProbabilityDataBufferVP8\n");
2063 for (i = 0; i < 4; i++)
2064 for (j = 0; j < 8; j++) {
2065 memset(tmp, 0, sizeof tmp);
2067 for (l=0; l<11; l++)
2068 sprintf(tmp + strlen(tmp), "%2x, ", p->dct_coeff_probs[i][j][k][l]);
2069 va_TraceMsg(trace_ctx,"\t\t[%d, %d] = %s\n", i, j, tmp);
2072 va_TraceMsg(trace_ctx, NULL);
2077 void va_TraceBeginPicture(
2079 VAContextID context,
2080 VASurfaceID render_target
2085 TRACE_FUNCNAME(idx);
2087 va_TraceMsg(trace_ctx, "\tcontext = 0x%08x\n", context);
2088 va_TraceMsg(trace_ctx, "\trender_targets = 0x%08x\n", render_target);
2089 va_TraceMsg(trace_ctx, "\tframe_count = #%d\n", trace_ctx->trace_frame_no);
2090 va_TraceMsg(trace_ctx, NULL);
2092 trace_ctx->trace_rendertarget = render_target; /* for surface data dump after vaEndPicture */
2094 trace_ctx->trace_frame_no++;
2095 trace_ctx->trace_slice_no = 0;
2098 static void va_TraceMPEG2Buf(
2100 VAContextID context,
2104 unsigned int num_elements,
2109 case VAPictureParameterBufferType:
2110 va_TraceVAPictureParameterBufferMPEG2(dpy, context, buffer, type, size, num_elements, pbuf);
2112 case VAIQMatrixBufferType:
2113 va_TraceVAIQMatrixBufferMPEG2(dpy, context, buffer, type, size, num_elements, pbuf);
2115 case VABitPlaneBufferType:
2116 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2118 case VASliceGroupMapBufferType:
2119 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2121 case VASliceParameterBufferType:
2122 va_TraceVASliceParameterBufferMPEG2(dpy, context, buffer, type, size, num_elements, pbuf);
2124 case VASliceDataBufferType:
2125 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2127 case VAMacroblockParameterBufferType:
2128 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2130 case VAResidualDataBufferType:
2131 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2133 case VADeblockingParameterBufferType:
2134 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2136 case VAImageBufferType:
2138 case VAProtectedSliceDataBufferType:
2139 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2141 case VAEncCodedBufferType:
2143 case VAEncSequenceParameterBufferType:
2145 case VAEncPictureParameterBufferType:
2147 case VAEncSliceParameterBufferType:
2154 static void va_TraceVAEncSequenceParameterBufferH263(
2156 VAContextID context,
2160 unsigned int num_elements,
2163 VAEncSequenceParameterBufferH263 *p = (VAEncSequenceParameterBufferH263 *)data;
2166 va_TraceMsg(trace_ctx, "\t--VAEncSequenceParameterBufferH263\n");
2168 va_TraceMsg(trace_ctx, "\tintra_period = %d\n", p->intra_period);
2169 va_TraceMsg(trace_ctx, "\tbits_per_second = %d\n", p->bits_per_second);
2170 va_TraceMsg(trace_ctx, "\tframe_rate = %d\n", p->frame_rate);
2171 va_TraceMsg(trace_ctx, "\tinitial_qp = %d\n", p->initial_qp);
2172 va_TraceMsg(trace_ctx, "\tmin_qp = %d\n", p->min_qp);
2173 va_TraceMsg(trace_ctx, NULL);
2179 static void va_TraceVAEncPictureParameterBufferH263(
2181 VAContextID context,
2185 unsigned int num_elements,
2188 VAEncPictureParameterBufferH263 *p = (VAEncPictureParameterBufferH263 *)data;
2191 va_TraceMsg(trace_ctx, "\t--VAEncPictureParameterBufferH263\n");
2192 va_TraceMsg(trace_ctx, "\treference_picture = 0x%08x\n", p->reference_picture);
2193 va_TraceMsg(trace_ctx, "\treconstructed_picture = 0x%08x\n", p->reconstructed_picture);
2194 va_TraceMsg(trace_ctx, "\tcoded_buf = %08x\n", p->coded_buf);
2195 va_TraceMsg(trace_ctx, "\tpicture_width = %d\n", p->picture_width);
2196 va_TraceMsg(trace_ctx, "\tpicture_height = %d\n", p->picture_height);
2197 va_TraceMsg(trace_ctx, "\tpicture_type = 0x%08x\n", p->picture_type);
2198 va_TraceMsg(trace_ctx, NULL);
2203 static void va_TraceVAEncPictureParameterBufferJPEG(
2205 VAContextID context,
2209 unsigned int num_elements,
2212 VAEncPictureParameterBufferJPEG *p = (VAEncPictureParameterBufferJPEG *)data;
2217 va_TraceMsg(trace_ctx, "\t--VAEncPictureParameterBufferJPEG\n");
2218 va_TraceMsg(trace_ctx, "\treconstructed_picture = 0x%08x\n", p->reconstructed_picture);
2219 va_TraceMsg(trace_ctx, "\tcoded_buf = %08x\n", p->coded_buf);
2220 va_TraceMsg(trace_ctx, "\tpicture_width = %d\n", p->picture_width);
2221 va_TraceMsg(trace_ctx, "\tpicture_height = %d\n", p->picture_height);
2223 va_TraceMsg(trace_ctx, NULL);
2228 static void va_TraceVAEncQMatrixBufferJPEG(
2230 VAContextID context,
2234 unsigned int num_elements,
2237 VAQMatrixBufferJPEG *p = (VAQMatrixBufferJPEG *)data;
2240 va_TraceMsg(trace_ctx, "\t--VAQMatrixBufferJPEG\n");
2241 va_TraceMsg(trace_ctx, "\tload_lum_quantiser_matrix = %d", p->load_lum_quantiser_matrix);
2242 if (p->load_lum_quantiser_matrix) {
2244 for (i = 0; i < 64; i++) {
2246 va_TraceMsg(trace_ctx, "\n\t");
2247 va_TraceMsg(trace_ctx, "\t0x%02x", p->lum_quantiser_matrix[i]);
2249 va_TraceMsg(trace_ctx, "\n");
2251 va_TraceMsg(trace_ctx, "\tload_chroma_quantiser_matrix = %08x\n", p->load_chroma_quantiser_matrix);
2252 if (p->load_chroma_quantiser_matrix) {
2254 for (i = 0; i < 64; i++) {
2256 va_TraceMsg(trace_ctx, "\n\t");
2257 va_TraceMsg(trace_ctx, "\t0x%02x", p->chroma_quantiser_matrix[i]);
2259 va_TraceMsg(trace_ctx, "\n");
2262 va_TraceMsg(trace_ctx, NULL);
2267 static void va_TraceH263Buf(
2269 VAContextID context,
2273 unsigned int num_elements,
2278 case VAPictureParameterBufferType:/* print MPEG4 buffer */
2279 va_TraceVAPictureParameterBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf);
2281 case VAIQMatrixBufferType:/* print MPEG4 buffer */
2282 va_TraceVAIQMatrixBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf);
2284 case VABitPlaneBufferType:/* print MPEG4 buffer */
2285 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2287 case VASliceGroupMapBufferType:
2289 case VASliceParameterBufferType:/* print MPEG4 buffer */
2290 va_TraceVASliceParameterBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf);
2292 case VASliceDataBufferType:
2293 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2295 case VAMacroblockParameterBufferType:
2296 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2298 case VAResidualDataBufferType:
2299 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2301 case VADeblockingParameterBufferType:
2302 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2304 case VAImageBufferType:
2306 case VAProtectedSliceDataBufferType:
2307 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2309 case VAEncCodedBufferType:
2311 case VAEncSequenceParameterBufferType:
2312 va_TraceVAEncSequenceParameterBufferH263(dpy, context, buffer, type, size, num_elements, pbuf);
2314 case VAEncPictureParameterBufferType:
2315 va_TraceVAEncPictureParameterBufferH263(dpy, context, buffer, type, size, num_elements, pbuf);
2317 case VAEncSliceParameterBufferType:
2318 va_TraceVAEncSliceParameterBuffer(dpy, context, buffer, type, size, num_elements, pbuf);
2320 case VAEncPackedHeaderParameterBufferType:
2321 va_TraceVAEncPackedHeaderParameterBufferType(dpy, context, buffer, type, size, num_elements, pbuf);
2324 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2330 static void va_TraceJPEGBuf(
2332 VAContextID context,
2336 unsigned int num_elements,
2341 case VABitPlaneBufferType:
2342 case VASliceGroupMapBufferType:
2343 case VASliceDataBufferType:
2344 case VAMacroblockParameterBufferType:
2345 case VAResidualDataBufferType:
2346 case VADeblockingParameterBufferType:
2347 case VAImageBufferType:
2348 case VAProtectedSliceDataBufferType:
2349 case VAEncCodedBufferType:
2350 case VAEncSequenceParameterBufferType:
2351 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2353 case VAEncSliceParameterBufferType:
2354 va_TraceVAEncPictureParameterBufferJPEG(dpy, context, buffer, type, size, num_elements, pbuf);
2356 case VAPictureParameterBufferType:
2357 va_TraceVAPictureParameterBufferJPEG(dpy, context, buffer, type, size, num_elements, pbuf);
2359 case VAIQMatrixBufferType:
2360 va_TraceVAIQMatrixBufferJPEG(dpy, context, buffer, type, size, num_elements, pbuf);
2362 case VASliceParameterBufferType:
2363 va_TraceVASliceParameterBufferJPEG(dpy, context, buffer, type, size, num_elements, pbuf);
2365 case VAHuffmanTableBufferType:
2366 va_TraceVAHuffmanTableBufferJPEG(dpy, context, buffer, type, size, num_elements, pbuf);
2368 case VAEncPictureParameterBufferType:
2369 va_TraceVAEncPictureParameterBufferJPEG(dpy, context, buffer, type, size, num_elements, pbuf);
2371 case VAQMatrixBufferType:
2372 va_TraceVAEncQMatrixBufferJPEG(dpy, context, buffer, type, size, num_elements, pbuf);
2375 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2380 static void va_TraceMPEG4Buf(
2382 VAContextID context,
2386 unsigned int num_elements,
2391 case VAPictureParameterBufferType:
2392 va_TraceVAPictureParameterBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf);
2394 case VAIQMatrixBufferType:
2395 va_TraceVAIQMatrixBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf);
2397 case VABitPlaneBufferType:
2398 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2400 case VASliceGroupMapBufferType:
2402 case VASliceParameterBufferType:
2403 va_TraceVASliceParameterBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf);
2405 case VASliceDataBufferType:
2406 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2408 case VAMacroblockParameterBufferType:
2409 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2411 case VAResidualDataBufferType:
2412 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2414 case VADeblockingParameterBufferType:
2415 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2417 case VAImageBufferType:
2419 case VAProtectedSliceDataBufferType:
2420 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2422 case VAEncCodedBufferType:
2424 case VAEncSequenceParameterBufferType:
2425 va_TraceVAEncSequenceParameterBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf);
2427 case VAEncPictureParameterBufferType:
2428 va_TraceVAEncPictureParameterBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf);
2430 case VAEncSliceParameterBufferType:
2431 va_TraceVAEncSliceParameterBuffer(dpy, context, buffer, type, size, num_elements, pbuf);
2434 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2440 static void va_TraceH264Buf(
2442 VAContextID context,
2446 unsigned int num_elements,
2453 case VAPictureParameterBufferType:
2454 va_TraceVAPictureParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
2456 case VAIQMatrixBufferType:
2457 va_TraceVAIQMatrixBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
2459 case VABitPlaneBufferType:
2460 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2462 case VASliceGroupMapBufferType:
2463 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2465 case VASliceParameterBufferType:
2466 va_TraceVASliceParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
2468 case VASliceDataBufferType:
2469 va_TraceVABuffers(dpy, context, buffer, type, trace_ctx->trace_slice_size, num_elements, pbuf);
2471 case VAMacroblockParameterBufferType:
2472 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2474 case VAResidualDataBufferType:
2475 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2477 case VADeblockingParameterBufferType:
2478 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2480 case VAImageBufferType:
2482 case VAProtectedSliceDataBufferType:
2483 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2485 case VAEncCodedBufferType:
2487 case VAEncSequenceParameterBufferType:
2488 va_TraceVAEncSequenceParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
2490 case VAEncPictureParameterBufferType:
2491 va_TraceVAEncPictureParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
2493 case VAEncSliceParameterBufferType:
2494 if (size == sizeof(VAEncSliceParameterBuffer))
2495 va_TraceVAEncSliceParameterBuffer(dpy, context, buffer, type, size, num_elements, pbuf);
2497 va_TraceVAEncSliceParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
2499 case VAEncPackedHeaderParameterBufferType:
2500 va_TraceVAEncPackedHeaderParameterBufferType(dpy, context, buffer, type, size, num_elements, pbuf);
2503 case VAEncMiscParameterBufferType:
2504 va_TraceVAEncMiscParameterBuffer(dpy, context, buffer, type, size, num_elements, pbuf);
2507 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2512 static void va_TraceVP8Buf(
2514 VAContextID context,
2518 unsigned int num_elements,
2525 case VAPictureParameterBufferType:
2526 va_TraceVAPictureParameterBufferVP8(dpy, context, buffer, type, size, num_elements, pbuf);
2528 case VAIQMatrixBufferType:
2529 va_TraceVAIQMatrixBufferVP8(dpy, context, buffer, type, size, num_elements, pbuf);
2531 case VABitPlaneBufferType:
2533 case VASliceGroupMapBufferType:
2535 case VASliceParameterBufferType:
2536 va_TraceVASliceParameterBufferVP8(dpy, context, buffer, type, size, num_elements, pbuf);
2538 case VASliceDataBufferType:
2540 case VAProbabilityBufferType:
2541 va_TraceVAProbabilityBufferVP8(dpy, context, buffer, type, size, num_elements, pbuf);
2543 case VAMacroblockParameterBufferType:
2545 case VAResidualDataBufferType:
2547 case VADeblockingParameterBufferType:
2549 case VAImageBufferType:
2551 case VAProtectedSliceDataBufferType:
2553 case VAEncCodedBufferType:
2555 case VAEncSequenceParameterBufferType:
2557 case VAEncPictureParameterBufferType:
2559 case VAEncSliceParameterBufferType:
2561 case VAEncPackedHeaderParameterBufferType:
2563 case VAEncMiscParameterBufferType:
2566 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2571 static void va_TraceVC1Buf(
2573 VAContextID context,
2577 unsigned int num_elements,
2584 case VAPictureParameterBufferType:
2585 va_TraceVAPictureParameterBufferVC1(dpy, context, buffer, type, size, num_elements, pbuf);
2587 case VAIQMatrixBufferType:
2589 case VABitPlaneBufferType:
2590 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2592 case VASliceGroupMapBufferType:
2593 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2595 case VASliceParameterBufferType:
2596 va_TraceVASliceParameterBufferVC1(dpy, context, buffer, type, size, num_elements, pbuf);
2598 case VASliceDataBufferType:
2599 va_TraceVABuffers(dpy, context, buffer, type, trace_ctx->trace_slice_size, num_elements, pbuf);
2601 case VAMacroblockParameterBufferType:
2602 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2604 case VAResidualDataBufferType:
2605 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2607 case VADeblockingParameterBufferType:
2608 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2610 case VAImageBufferType:
2612 case VAProtectedSliceDataBufferType:
2613 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2615 case VAEncCodedBufferType:
2617 case VAEncSequenceParameterBufferType:
2618 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2620 case VAEncPictureParameterBufferType:
2621 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2623 case VAEncSliceParameterBufferType:
2624 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2627 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2633 va_TraceProcFilterParameterBufferDeinterlacing(
2635 VAContextID context,
2636 VAProcFilterParameterBufferBase *base
2639 VAProcFilterParameterBufferDeinterlacing *deint = (VAProcFilterParameterBufferDeinterlacing *)base;
2643 va_TraceMsg(trace_ctx, "\t type = %d\n", deint->type);
2644 va_TraceMsg(trace_ctx, "\t algorithm = %d\n", deint->algorithm);
2645 va_TraceMsg(trace_ctx, "\t flags = %d\n", deint->flags);
2649 va_TraceProcFilterParameterBufferColorBalance(
2651 VAContextID context,
2652 VAProcFilterParameterBufferBase *base
2655 VAProcFilterParameterBufferColorBalance *color_balance = (VAProcFilterParameterBufferColorBalance *)base;
2659 va_TraceMsg(trace_ctx, "\t type = %d\n", color_balance->type);
2660 va_TraceMsg(trace_ctx, "\t attrib = %d\n", color_balance->attrib);
2661 va_TraceMsg(trace_ctx, "\t value = %f\n", color_balance->value);
2665 va_TraceProcFilterParameterBufferBase(
2667 VAContextID context,
2668 VAProcFilterParameterBufferBase *base
2673 va_TraceMsg(trace_ctx, "\t type = %d\n", base->type);
2677 va_TraceProcFilterParameterBuffer(
2679 VAContextID context,
2680 VABufferID *filters,
2681 unsigned int num_filters
2686 unsigned int num_elements;
2687 VAProcFilterParameterBufferBase *base_filter = NULL;
2692 if (num_filters == 0 || filters == NULL) {
2693 va_TraceMsg(trace_ctx, "\t num_filters = %d\n", num_filters);
2694 va_TraceMsg(trace_ctx, "\t filters = %p\n", filters);
2698 va_TraceMsg(trace_ctx, "\t num_filters = %d\n", num_filters);
2700 /* get buffer type information */
2701 for (i = 0; i < num_filters; i++) {
2702 vaBufferInfo(dpy, context, filters[i], &type, &size, &num_elements);
2704 if (type != VAProcFilterParameterBufferType) {
2705 va_TraceMsg(trace_ctx, "\t filters[%d] = 0x%08x (INVALID)\n", i, filters[i]);
2708 va_TraceMsg(trace_ctx, "\t filters[%d] = 0x%08x\n", i, filters[i]);
2712 vaMapBuffer(dpy, filters[i], (void **)&base_filter);
2714 if (base_filter == NULL) {
2715 vaUnmapBuffer(dpy, filters[i]);
2719 switch (base_filter->type) {
2720 case VAProcFilterDeinterlacing:
2721 va_TraceProcFilterParameterBufferDeinterlacing(dpy,
2725 case VAProcFilterColorBalance:
2726 va_TraceProcFilterParameterBufferColorBalance(dpy,
2731 va_TraceProcFilterParameterBufferBase(dpy,
2737 vaUnmapBuffer(dpy, filters[i]);
2742 va_TraceVAProcPipelineParameterBuffer(
2744 VAContextID context,
2748 unsigned int num_elements,
2752 VAProcPipelineParameterBuffer *p = (VAProcPipelineParameterBuffer *)data;
2757 va_TraceMsg(trace_ctx, "\t--VAProcPipelineParameterBuffer\n");
2759 va_TraceMsg(trace_ctx, "\t surface = 0x%08x\n", p->surface);
2761 if (p->surface_region) {
2762 va_TraceMsg(trace_ctx, "\t surface_region\n");
2763 va_TraceMsg(trace_ctx, "\t x = %d\n", p->surface_region->x);
2764 va_TraceMsg(trace_ctx, "\t y = %d\n", p->surface_region->y);
2765 va_TraceMsg(trace_ctx, "\t width = %d\n", p->surface_region->width);
2766 va_TraceMsg(trace_ctx, "\t height = %d\n", p->surface_region->height);
2768 va_TraceMsg(trace_ctx, "\t surface_region = (NULL)\n");
2771 va_TraceMsg(trace_ctx, "\t surface_color_standard = %d\n", p->surface_color_standard);
2773 if (p->output_region) {
2774 va_TraceMsg(trace_ctx, "\t output_region\n");
2775 va_TraceMsg(trace_ctx, "\t x = %d\n", p->output_region->x);
2776 va_TraceMsg(trace_ctx, "\t y = %d\n", p->output_region->y);
2777 va_TraceMsg(trace_ctx, "\t width = %d\n", p->output_region->width);
2778 va_TraceMsg(trace_ctx, "\t height = %d\n", p->output_region->height);
2780 va_TraceMsg(trace_ctx, "\t output_region = (NULL)\n");
2783 va_TraceMsg(trace_ctx, "\t output_background_color = 0x%08x\n", p->output_background_color);
2784 va_TraceMsg(trace_ctx, "\t output_color_standard = %d\n", p->output_color_standard);
2785 va_TraceMsg(trace_ctx, "\t pipeline_flags = 0x%08x\n", p->pipeline_flags);
2786 va_TraceMsg(trace_ctx, "\t filter_flags = 0x%08x\n", p->filter_flags);
2788 va_TraceProcFilterParameterBuffer(dpy, context, p->filters, p->num_filters);
2790 va_TraceMsg(trace_ctx, "\t num_forward_references = 0x%08x\n", p->num_forward_references);
2792 if (p->num_forward_references) {
2793 va_TraceMsg(trace_ctx, "\t forward_references\n");
2795 if (p->forward_references) {
2796 /* only dump the first 5 forward references */
2797 for (i = 0; i < p->num_forward_references && i < 5; i++) {
2798 va_TraceMsg(trace_ctx, "\t forward_references[%d] = 0x%08x\n", i, p->forward_references[i]);
2801 for (i = 0; i < p->num_forward_references && i < 5; i++) {
2802 va_TraceMsg(trace_ctx, "\t forward_references[%d] = (NULL)\n", i);
2807 va_TraceMsg(trace_ctx, "\t num_backward_references = 0x%08x\n", p->num_backward_references);
2809 if (p->num_backward_references) {
2810 va_TraceMsg(trace_ctx, "\t backward_references\n");
2812 if (p->backward_references) {
2813 /* only dump the first 5 backward references */
2814 for (i = 0; i < p->num_backward_references && i < 5; i++) {
2815 va_TraceMsg(trace_ctx, "\t backward_references[%d] = 0x%08x\n", i, p->backward_references[i]);
2818 for (i = 0; i < p->num_backward_references && i < 5; i++) {
2819 va_TraceMsg(trace_ctx, "\t backward_references[%d] = (NULL)\n", i);
2824 /* FIXME: add other info later */
2826 va_TraceMsg(trace_ctx, NULL);
2832 VAContextID context,
2836 unsigned int num_elements,
2843 case VAProcPipelineParameterBufferType:
2844 va_TraceVAProcPipelineParameterBuffer(dpy, context, buffer, type, size, num_elements, pbuf);
2847 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2852 void va_TraceRenderPicture(
2854 VAContextID context,
2855 VABufferID *buffers,
2861 unsigned int num_elements;
2865 TRACE_FUNCNAME(idx);
2867 va_TraceMsg(trace_ctx, "\tcontext = 0x%08x\n", context);
2868 va_TraceMsg(trace_ctx, "\tnum_buffers = %d\n", num_buffers);
2869 if (buffers == NULL)
2872 for (i = 0; i < num_buffers; i++) {
2873 unsigned char *pbuf = NULL;
2876 /* get buffer type information */
2877 vaBufferInfo(dpy, context, buffers[i], &type, &size, &num_elements);
2879 va_TraceMsg(trace_ctx, "\t---------------------------\n");
2880 va_TraceMsg(trace_ctx, "\tbuffers[%d] = 0x%08x\n", i, buffers[i]);
2881 va_TraceMsg(trace_ctx, "\t type = %s\n", buffer_type_to_string(type));
2882 va_TraceMsg(trace_ctx, "\t size = %d\n", size);
2883 va_TraceMsg(trace_ctx, "\t num_elements = %d\n", num_elements);
2885 vaMapBuffer(dpy, buffers[i], (void **)&pbuf);
2889 switch (trace_ctx->trace_profile) {
2890 case VAProfileMPEG2Simple:
2891 case VAProfileMPEG2Main:
2892 for (j=0; j<num_elements; j++) {
2893 va_TraceMsg(trace_ctx, "\telement[%d] =\n", j);
2894 va_TraceMPEG2Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
2897 case VAProfileMPEG4Simple:
2898 case VAProfileMPEG4AdvancedSimple:
2899 case VAProfileMPEG4Main:
2900 for (j=0; j<num_elements; j++) {
2901 va_TraceMsg(trace_ctx, "\telement[%d] =\n", j);
2902 va_TraceMPEG4Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
2905 case VAProfileH264Baseline:
2906 case VAProfileH264Main:
2907 case VAProfileH264High:
2908 case VAProfileH264ConstrainedBaseline:
2909 for (j=0; j<num_elements; j++) {
2910 va_TraceMsg(trace_ctx, "\telement[%d] =\n", j);
2912 va_TraceH264Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
2915 case VAProfileVC1Simple:
2916 case VAProfileVC1Main:
2917 case VAProfileVC1Advanced:
2918 for (j=0; j<num_elements; j++) {
2919 va_TraceMsg(trace_ctx, "\telement[%d] =\n", j);
2921 va_TraceVC1Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
2924 case VAProfileH263Baseline:
2925 for (j=0; j<num_elements; j++) {
2926 va_TraceMsg(trace_ctx, "\telement[%d] =\n", j);
2928 va_TraceH263Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
2931 case VAProfileJPEGBaseline:
2932 for (j=0; j<num_elements; j++) {
2933 va_TraceMsg(trace_ctx, "\telement[%d] =\n", j);
2935 va_TraceJPEGBuf (dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
2940 for (j=0; j<num_elements; j++) {
2941 va_TraceMsg(trace_ctx, "\telement[%d] =\n", j);
2943 va_TraceNoneBuf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
2947 case VAProfileVP8Version0_3:
2948 for (j=0; j<num_elements; j++) {
2949 va_TraceMsg(trace_ctx, "\telement[%d] =\n", j);
2951 va_TraceVP8Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
2959 vaUnmapBuffer(dpy, buffers[i]);
2962 va_TraceMsg(trace_ctx, NULL);
2965 void va_TraceEndPicture(
2967 VAContextID context,
2971 int encode, decode, jpeg;
2974 TRACE_FUNCNAME(idx);
2976 va_TraceMsg(trace_ctx, "\tcontext = 0x%08x\n", context);
2977 va_TraceMsg(trace_ctx, "\trender_targets = 0x%08x\n", trace_ctx->trace_rendertarget);
2979 /* avoid to create so many empty files */
2980 encode = (trace_ctx->trace_entrypoint == VAEntrypointEncSlice);
2981 decode = (trace_ctx->trace_entrypoint == VAEntrypointVLD);
2982 jpeg = (trace_ctx->trace_entrypoint == VAEntrypointEncPicture);
2984 /* trace encode source surface, can do it before HW completes rendering */
2985 if ((encode && (trace_flag & VA_TRACE_FLAG_SURFACE_ENCODE))||
2986 (jpeg && (trace_flag & VA_TRACE_FLAG_SURFACE_JPEG)))
2987 va_TraceSurface(dpy);
2989 /* trace decoded surface, do it after HW completes rendering */
2990 if (decode && ((trace_flag & VA_TRACE_FLAG_SURFACE_DECODE))) {
2991 vaSyncSurface(dpy, trace_ctx->trace_rendertarget);
2992 va_TraceSurface(dpy);
2995 va_TraceMsg(trace_ctx, NULL);
2999 void va_TraceSyncSurface(
3001 VASurfaceID render_target
3006 TRACE_FUNCNAME(idx);
3008 va_TraceMsg(trace_ctx, "\trender_target = 0x%08x\n", render_target);
3009 va_TraceMsg(trace_ctx, NULL);
3012 void va_TraceQuerySurfaceAttributes(
3015 VASurfaceAttrib *attrib_list,
3016 unsigned int *num_attribs
3021 TRACE_FUNCNAME(idx);
3022 va_TraceMsg(trace_ctx, "\tconfig = 0x%08x\n", config);
3023 va_TraceSurfaceAttributes(trace_ctx, attrib_list, num_attribs);
3025 va_TraceMsg(trace_ctx, NULL);
3030 void va_TraceQuerySurfaceStatus(
3032 VASurfaceID render_target,
3033 VASurfaceStatus *status /* out */
3038 TRACE_FUNCNAME(idx);
3040 va_TraceMsg(trace_ctx, "\trender_target = 0x%08x\n", render_target);
3042 va_TraceMsg(trace_ctx, "\tstatus = 0x%08x\n", *status);
3043 va_TraceMsg(trace_ctx, NULL);
3047 void va_TraceQuerySurfaceError(
3049 VASurfaceID surface,
3050 VAStatus error_status,
3051 void **error_info /*out*/
3056 TRACE_FUNCNAME(idx);
3057 va_TraceMsg(trace_ctx, "\tsurface = 0x%08x\n", surface);
3058 va_TraceMsg(trace_ctx, "\terror_status = 0x%08x\n", error_status);
3059 if (error_info && (error_status == VA_STATUS_ERROR_DECODING_ERROR)) {
3060 VASurfaceDecodeMBErrors *p = *error_info;
3061 while (p && (p->status != -1)) {
3062 va_TraceMsg(trace_ctx, "\t\tstatus = %d\n", p->status);
3063 va_TraceMsg(trace_ctx, "\t\tstart_mb = %d\n", p->start_mb);
3064 va_TraceMsg(trace_ctx, "\t\tend_mb = %d\n", p->end_mb);
3065 p++; /* next error record */
3068 va_TraceMsg(trace_ctx, NULL);
3071 void va_TraceMaxNumDisplayAttributes (
3078 TRACE_FUNCNAME(idx);
3080 va_TraceMsg(trace_ctx, "\tmax_display_attributes = %d\n", number);
3081 va_TraceMsg(trace_ctx, NULL);
3084 void va_TraceQueryDisplayAttributes (
3086 VADisplayAttribute *attr_list, /* out */
3087 int *num_attributes /* out */
3094 if (attr_list == NULL || num_attributes == NULL)
3097 va_TraceMsg(trace_ctx, "\tnum_attributes = %d\n", *num_attributes);
3099 for (i=0; i<*num_attributes; i++) {
3100 va_TraceMsg(trace_ctx, "\tattr_list[%d] =\n");
3101 va_TraceMsg(trace_ctx, "\t typ = 0x%08x\n", attr_list[i].type);
3102 va_TraceMsg(trace_ctx, "\t min_value = %d\n", attr_list[i].min_value);
3103 va_TraceMsg(trace_ctx, "\t max_value = %d\n", attr_list[i].max_value);
3104 va_TraceMsg(trace_ctx, "\t value = %d\n", attr_list[i].value);
3105 va_TraceMsg(trace_ctx, "\t flags = %d\n", attr_list[i].flags);
3107 va_TraceMsg(trace_ctx, NULL);
3111 static void va_TraceDisplayAttributes (
3113 VADisplayAttribute *attr_list,
3121 va_TraceMsg(trace_ctx, "\tnum_attributes = %d\n", num_attributes);
3122 if (attr_list == NULL)
3125 for (i=0; i<num_attributes; i++) {
3126 va_TraceMsg(trace_ctx, "\tattr_list[%d] =\n");
3127 va_TraceMsg(trace_ctx, "\t typ = 0x%08x\n", attr_list[i].type);
3128 va_TraceMsg(trace_ctx, "\t min_value = %d\n", attr_list[i].min_value);
3129 va_TraceMsg(trace_ctx, "\t max_value = %d\n", attr_list[i].max_value);
3130 va_TraceMsg(trace_ctx, "\t value = %d\n", attr_list[i].value);
3131 va_TraceMsg(trace_ctx, "\t flags = %d\n", attr_list[i].flags);
3133 va_TraceMsg(trace_ctx, NULL);
3137 void va_TraceGetDisplayAttributes (
3139 VADisplayAttribute *attr_list,
3145 TRACE_FUNCNAME(idx);
3147 va_TraceDisplayAttributes (dpy, attr_list, num_attributes);
3150 void va_TraceSetDisplayAttributes (
3152 VADisplayAttribute *attr_list,
3158 TRACE_FUNCNAME(idx);
3160 va_TraceDisplayAttributes (dpy, attr_list, num_attributes);
3164 void va_TracePutSurface (
3166 VASurfaceID surface,
3167 void *draw, /* the target Drawable */
3170 unsigned short srcw,
3171 unsigned short srch,
3174 unsigned short destw,
3175 unsigned short desth,
3176 VARectangle *cliprects, /* client supplied clip list */
3177 unsigned int number_cliprects, /* number of clip rects in the clip list */
3178 unsigned int flags /* de-interlacing flags */
3183 TRACE_FUNCNAME(idx);
3185 va_TraceMsg(trace_ctx, "\tsurface = 0x%08x\n", surface);
3186 va_TraceMsg(trace_ctx, "\tdraw = 0x%08x\n", draw);
3187 va_TraceMsg(trace_ctx, "\tsrcx = %d\n", srcx);
3188 va_TraceMsg(trace_ctx, "\tsrcy = %d\n", srcy);
3189 va_TraceMsg(trace_ctx, "\tsrcw = %d\n", srcw);
3190 va_TraceMsg(trace_ctx, "\tsrch = %d\n", srch);
3191 va_TraceMsg(trace_ctx, "\tdestx = %d\n", destx);
3192 va_TraceMsg(trace_ctx, "\tdesty = %d\n", desty);
3193 va_TraceMsg(trace_ctx, "\tdestw = %d\n", destw);
3194 va_TraceMsg(trace_ctx, "\tdesth = %d\n", desth);
3195 va_TraceMsg(trace_ctx, "\tcliprects = 0x%08x\n", cliprects);
3196 va_TraceMsg(trace_ctx, "\tnumber_cliprects = %d\n", number_cliprects);
3197 va_TraceMsg(trace_ctx, "\tflags = 0x%08x\n", flags);
3198 va_TraceMsg(trace_ctx, NULL);