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"
41 #include <sys/types.h>
48 * Env. to debug some issue, e.g. the decode/encode issue in a video conference scenerio:
49 * .LIBVA_TRACE=log_file: general VA parameters saved into log_file
50 * .LIBVA_TRACE_BUFDATA: dump all VA data buffer into log_file
51 * .LIBVA_TRACE_CODEDBUF=coded_clip_file: save the coded clip into file coded_clip_file
52 * .LIBVA_TRACE_SURFACE=yuv_file: save surface YUV into file yuv_file. Use file name to determine
53 * decode/encode or jpeg surfaces
54 * .LIBVA_TRACE_SURFACE_GEOMETRY=WIDTHxHEIGHT+XOFF+YOFF: only save part of surface context into file
55 * due to storage bandwidth limitation
56 * .LIBVA_TRACE_LOGSIZE=numeric number: truncate the log_file or coded_clip_file, or decoded_yuv_file
57 * when the size is bigger than the number
65 /* LIBVA_TRACE_LOGSIZE */
66 static unsigned int trace_logsize = 0xffffffff; /* truncate the log when the size is bigger than it */
68 /* per context settings */
69 struct trace_context {
71 FILE *trace_fp_log; /* save the log into a file */
72 char *trace_log_fn; /* file name */
74 /* LIBVA_TRACE_CODEDBUF */
75 FILE *trace_fp_codedbuf; /* save the encode result into a file */
76 char *trace_codedbuf_fn; /* file name */
78 /* LIBVA_TRACE_SURFACE */
79 FILE *trace_fp_surface; /* save the surface YUV into a file */
80 char *trace_surface_fn; /* file name */
82 VAContextID trace_context; /* current context */
84 VASurfaceID trace_rendertarget; /* current render target */
85 VAProfile trace_profile; /* current profile for buffers */
86 VAEntrypoint trace_entrypoint; /* current entrypoint */
87 VABufferID trace_codedbuf;
89 unsigned int trace_frame_no; /* current frame NO */
90 unsigned int trace_slice_no; /* current slice NO */
91 unsigned int trace_slice_size; /* current slice buffer size */
93 unsigned int trace_surface_width; /* surface dumping geometry */
94 unsigned int trace_surface_height;
95 unsigned int trace_surface_xoff;
96 unsigned int trace_surface_yoff;
98 unsigned int trace_frame_width; /* current frame width */
99 unsigned int trace_frame_height; /* current frame height */
100 unsigned int trace_sequence_start; /* get a new sequence for encoding or not */
103 #define TRACE_CTX(dpy) ((struct trace_context *)((VADisplayContextP)dpy)->vatrace)
105 #define DPY2TRACECTX(dpy) \
106 struct trace_context *trace_ctx = TRACE_CTX(dpy); \
108 if (trace_ctx == NULL) \
111 #define TRACE_FUNCNAME(idx) va_TraceMsg(trace_ctx, "==========%s\n", __func__);
113 /* Prototype declarations (functions defined in va.c) */
115 void va_errorMessage(const char *msg, ...);
116 void va_infoMessage(const char *msg, ...);
118 int va_parseConfig(char *env, char *env_value);
120 VAStatus vaBufferInfo(
122 VAContextID context, /* in */
123 VABufferID buf_id, /* in */
124 VABufferType *type, /* out */
125 unsigned int *size, /* out */
126 unsigned int *num_elements /* out */
129 VAStatus vaLockSurface(VADisplay dpy,
131 unsigned int *fourcc, /* following are output argument */
132 unsigned int *luma_stride,
133 unsigned int *chroma_u_stride,
134 unsigned int *chroma_v_stride,
135 unsigned int *luma_offset,
136 unsigned int *chroma_u_offset,
137 unsigned int *chroma_v_offset,
138 unsigned int *buffer_name,
142 VAStatus vaUnlockSurface(VADisplay dpy,
146 #define FILE_NAME_SUFFIX(env_value) \
148 int tmp = strnlen(env_value, sizeof(env_value)); \
149 int left = sizeof(env_value) - tmp; \
151 snprintf(env_value+tmp, \
155 (unsigned long)trace_ctx); \
158 void va_TraceInit(VADisplay dpy)
160 char env_value[1024];
161 unsigned short suffix = 0xffff & ((unsigned int)time(NULL));
164 struct trace_context *trace_ctx = calloc(sizeof(struct trace_context), 1);
166 if (trace_ctx == NULL)
169 if (va_parseConfig("LIBVA_TRACE", &env_value[0]) == 0) {
170 FILE_NAME_SUFFIX(env_value);
171 trace_ctx->trace_log_fn = strdup(env_value);
173 tmp = fopen(env_value, "w");
175 trace_ctx->trace_fp_log = tmp;
176 va_infoMessage("LIBVA_TRACE is on, save log into %s\n", trace_ctx->trace_log_fn);
177 trace_flag = VA_TRACE_FLAG_LOG;
179 va_errorMessage("Open file %s failed (%s)\n", env_value, strerror(errno));
182 /* may re-get the global settings for multiple context */
183 if (va_parseConfig("LIBVA_TRACE_LOGSIZE", &env_value[0]) == 0) {
184 trace_logsize = atoi(env_value);
185 va_infoMessage("LIBVA_TRACE_LOGSIZE is on, size is %d\n", trace_logsize);
188 if ((trace_flag & VA_TRACE_FLAG_LOG) && (va_parseConfig("LIBVA_TRACE_BUFDATA", NULL) == 0)) {
189 trace_flag |= VA_TRACE_FLAG_BUFDATA;
190 va_infoMessage("LIBVA_TRACE_BUFDATA is on, dump buffer into log file\n");
193 /* per-context setting */
194 if (va_parseConfig("LIBVA_TRACE_CODEDBUF", &env_value[0]) == 0) {
195 FILE_NAME_SUFFIX(env_value);
196 trace_ctx->trace_codedbuf_fn = strdup(env_value);
197 va_infoMessage("LIBVA_TRACE_CODEDBUF is on, save codedbuf into log file %s\n",
198 trace_ctx->trace_codedbuf_fn);
199 trace_flag |= VA_TRACE_FLAG_CODEDBUF;
202 if (va_parseConfig("LIBVA_TRACE_SURFACE", &env_value[0]) == 0) {
203 FILE_NAME_SUFFIX(env_value);
204 trace_ctx->trace_surface_fn = strdup(env_value);
206 va_infoMessage("LIBVA_TRACE_SURFACE is on, save surface into %s\n",
207 trace_ctx->trace_surface_fn);
209 /* for surface data dump, it is time-consume, and may
210 * cause some side-effect, so only trace the needed surfaces
211 * to trace encode surface, set the trace file name to sth like *enc*
212 * to trace decode surface, set the trace file name to sth like *dec*
213 * if no dec/enc in file name, set both
215 if (strstr(env_value, "dec"))
216 trace_flag |= VA_TRACE_FLAG_SURFACE_DECODE;
217 if (strstr(env_value, "enc"))
218 trace_flag |= VA_TRACE_FLAG_SURFACE_ENCODE;
219 if (strstr(env_value, "jpeg") || strstr(env_value, "jpg"))
220 trace_flag |= VA_TRACE_FLAG_SURFACE_JPEG;
222 if (va_parseConfig("LIBVA_TRACE_SURFACE_GEOMETRY", &env_value[0]) == 0) {
223 char *p = env_value, *q;
225 trace_ctx->trace_surface_width = strtod(p, &q);
226 p = q+1; /* skip "x" */
227 trace_ctx->trace_surface_height = strtod(p, &q);
228 p = q+1; /* skip "+" */
229 trace_ctx->trace_surface_xoff = strtod(p, &q);
230 p = q+1; /* skip "+" */
231 trace_ctx->trace_surface_yoff = strtod(p, &q);
233 va_infoMessage("LIBVA_TRACE_SURFACE_GEOMETRY is on, only dump surface %dx%d+%d+%d content\n",
234 trace_ctx->trace_surface_width,
235 trace_ctx->trace_surface_height,
236 trace_ctx->trace_surface_xoff,
237 trace_ctx->trace_surface_yoff);
241 ((VADisplayContextP)dpy)->vatrace = trace_ctx;
245 void va_TraceEnd(VADisplay dpy)
249 if (trace_ctx->trace_fp_log)
250 fclose(trace_ctx->trace_fp_log);
252 if (trace_ctx->trace_fp_codedbuf)
253 fclose(trace_ctx->trace_fp_codedbuf);
255 if (trace_ctx->trace_fp_surface)
256 fclose(trace_ctx->trace_fp_surface);
258 if (trace_ctx->trace_log_fn)
259 free(trace_ctx->trace_log_fn);
261 if (trace_ctx->trace_codedbuf_fn)
262 free(trace_ctx->trace_codedbuf_fn);
264 if (trace_ctx->trace_surface_fn)
265 free(trace_ctx->trace_surface_fn);
268 ((VADisplayContextP)dpy)->vatrace = NULL;
272 static unsigned int file_size(FILE *fp)
276 fstat(fileno(fp), &buf);
282 static void truncate_file(FILE *fp)
284 ftruncate(fileno(fp), 0);
288 void va_TraceMsg(struct trace_context *trace_ctx, const char *msg, ...)
292 if (!(trace_flag & VA_TRACE_FLAG_LOG))
295 if (file_size(trace_ctx->trace_fp_log) >= trace_logsize)
296 truncate_file(trace_ctx->trace_fp_log);
300 if (gettimeofday(&tv, NULL) == 0)
301 fprintf(trace_ctx->trace_fp_log, "[%04d:%06d] ",
302 (unsigned int)tv.tv_sec & 0xffff, (unsigned int)tv.tv_usec);
304 vfprintf(trace_ctx->trace_fp_log, msg, args);
307 fflush(trace_ctx->trace_fp_log);
310 void va_TraceCodedBuf(VADisplay dpy)
312 VACodedBufferSegment *buf_list = NULL;
318 /* can only truncate at a sequence boudary */
319 if (((file_size(trace_ctx->trace_fp_log) >= trace_logsize))
320 && trace_ctx->trace_sequence_start) {
321 va_TraceMsg(trace_ctx, "==========truncate file %s\n", trace_ctx->trace_codedbuf_fn);
322 truncate_file(trace_ctx->trace_fp_log);
325 trace_ctx->trace_sequence_start = 0; /* only truncate coded file when meet next new sequence */
327 va_status = vaMapBuffer(dpy, trace_ctx->trace_codedbuf, (void **)(&buf_list));
328 if (va_status != VA_STATUS_SUCCESS)
331 va_TraceMsg(trace_ctx, "==========dump codedbuf into file %s\n", trace_ctx->trace_codedbuf_fn);
333 while (buf_list != NULL) {
334 va_TraceMsg(trace_ctx, "\tVACodedBufferSegment[%d].size = %d\n", i++, buf_list->size);
335 if (trace_ctx->trace_fp_codedbuf)
336 fwrite(buf_list->buf, buf_list->size, 1, trace_ctx->trace_fp_codedbuf);
337 buf_list = buf_list->next;
339 vaUnmapBuffer(dpy,trace_ctx->trace_codedbuf);
340 va_TraceMsg(trace_ctx, NULL);
344 void va_TraceSurface(VADisplay dpy)
347 unsigned int fourcc; /* following are output argument */
348 unsigned int luma_stride;
349 unsigned int chroma_u_stride;
350 unsigned int chroma_v_stride;
351 unsigned int luma_offset;
352 unsigned int chroma_u_offset;
353 unsigned int chroma_v_offset;
354 unsigned int buffer_name;
356 unsigned char *Y_data, *UV_data, *tmp;
358 unsigned char check_sum = 0;
361 if (!trace_ctx->trace_fp_surface)
364 va_TraceMsg(trace_ctx, "==========dump surface data in file %s\n", trace_ctx->trace_surface_fn);
366 if ((file_size(trace_ctx->trace_fp_surface) >= trace_logsize)) {
367 va_TraceMsg(trace_ctx, "==========truncate file %s\n", trace_ctx->trace_surface_fn);
368 truncate_file(trace_ctx->trace_fp_surface);
370 va_TraceMsg(trace_ctx, NULL);
372 va_status = vaLockSurface(
374 trace_ctx->trace_rendertarget,
376 &luma_stride, &chroma_u_stride, &chroma_v_stride,
377 &luma_offset, &chroma_u_offset, &chroma_v_offset,
378 &buffer_name, &buffer);
380 if (va_status != VA_STATUS_SUCCESS) {
381 va_TraceMsg(trace_ctx, "Error:vaLockSurface failed\n");
385 va_TraceMsg(trace_ctx, "\tfourcc = 0x%08x\n", fourcc);
386 va_TraceMsg(trace_ctx, "\twidth = %d\n", trace_ctx->trace_frame_width);
387 va_TraceMsg(trace_ctx, "\theight = %d\n", trace_ctx->trace_frame_height);
388 va_TraceMsg(trace_ctx, "\tluma_stride = %d\n", luma_stride);
389 va_TraceMsg(trace_ctx, "\tchroma_u_stride = %d\n", chroma_u_stride);
390 va_TraceMsg(trace_ctx, "\tchroma_v_stride = %d\n", chroma_v_stride);
391 va_TraceMsg(trace_ctx, "\tluma_offset = %d\n", luma_offset);
392 va_TraceMsg(trace_ctx, "\tchroma_u_offset = %d\n", chroma_u_offset);
393 va_TraceMsg(trace_ctx, "\tchroma_v_offset = %d\n", chroma_v_offset);
395 if (buffer == NULL) {
396 va_TraceMsg(trace_ctx, "Error:vaLockSurface return NULL buffer\n");
397 va_TraceMsg(trace_ctx, NULL);
399 vaUnlockSurface(dpy, trace_ctx->trace_rendertarget);
402 va_TraceMsg(trace_ctx, "\tbuffer location = 0x%08x\n", buffer);
403 va_TraceMsg(trace_ctx, NULL);
405 Y_data = (unsigned char*)buffer;
406 UV_data = (unsigned char*)buffer + chroma_u_offset;
408 tmp = Y_data + luma_stride * trace_ctx->trace_surface_yoff;
409 for (i=0; i<trace_ctx->trace_surface_height; i++) {
410 fwrite(tmp + trace_ctx->trace_surface_xoff,
411 trace_ctx->trace_surface_width,
412 1, trace_ctx->trace_fp_surface);
416 tmp = UV_data + chroma_u_stride * trace_ctx->trace_surface_yoff / 2;
417 if (fourcc == VA_FOURCC_NV12) {
418 for (i=0; i<trace_ctx->trace_surface_height/2; i++) {
419 fwrite(tmp + trace_ctx->trace_surface_xoff,
420 trace_ctx->trace_surface_width,
421 1, trace_ctx->trace_fp_surface);
423 tmp += chroma_u_stride;
427 vaUnlockSurface(dpy, trace_ctx->trace_rendertarget);
429 va_TraceMsg(trace_ctx, NULL);
433 void va_TraceInitialize (
435 int *major_version, /* out */
436 int *minor_version /* out */
443 void va_TraceTerminate (
452 void va_TraceCreateConfig(
455 VAEntrypoint entrypoint,
456 VAConfigAttrib *attrib_list,
458 VAConfigID *config_id /* out */
462 int encode, decode, jpeg;
467 va_TraceMsg(trace_ctx, "\tprofile = %d\n", profile);
468 va_TraceMsg(trace_ctx, "\tentrypoint = %d\n", entrypoint);
469 va_TraceMsg(trace_ctx, "\tnum_attribs = %d\n", num_attribs);
471 for (i = 0; i < num_attribs; i++) {
472 va_TraceMsg(trace_ctx, "\t\tattrib_list[%d].type = 0x%08x\n", i, attrib_list[i].type);
473 va_TraceMsg(trace_ctx, "\t\tattrib_list[%d].value = 0x%08x\n", i, attrib_list[i].value);
476 va_TraceMsg(trace_ctx, NULL);
478 trace_ctx->trace_profile = profile;
479 trace_ctx->trace_entrypoint = entrypoint;
481 /* avoid to create so many empty files */
482 encode = (trace_ctx->trace_entrypoint == VAEntrypointEncSlice);
483 decode = (trace_ctx->trace_entrypoint == VAEntrypointVLD);
484 jpeg = (trace_ctx->trace_entrypoint == VAEntrypointEncPicture);
485 if ((encode && (trace_flag & VA_TRACE_FLAG_SURFACE_ENCODE)) ||
486 (decode && (trace_flag & VA_TRACE_FLAG_SURFACE_DECODE)) ||
487 (jpeg && (trace_flag & VA_TRACE_FLAG_SURFACE_JPEG))) {
488 FILE *tmp = fopen(trace_ctx->trace_surface_fn, "w");
491 trace_ctx->trace_fp_surface = tmp;
493 va_errorMessage("Open file %s failed (%s)\n",
494 trace_ctx->trace_surface_fn,
496 trace_ctx->trace_fp_surface = NULL;
497 trace_flag &= ~(VA_TRACE_FLAG_SURFACE);
501 if (encode && (trace_flag & VA_TRACE_FLAG_CODEDBUF)) {
502 FILE *tmp = fopen(trace_ctx->trace_codedbuf_fn, "w");
505 trace_ctx->trace_fp_codedbuf = tmp;
507 va_errorMessage("Open file %s failed (%s)\n",
508 trace_ctx->trace_codedbuf_fn,
510 trace_ctx->trace_fp_codedbuf = NULL;
511 trace_flag &= ~VA_TRACE_FLAG_CODEDBUF;
516 static void va_TraceSurfaceAttributes(
517 struct trace_context *trace_ctx,
518 VASurfaceAttrib *attrib_list,
519 unsigned int *num_attribs
525 if (!attrib_list || !num_attribs)
530 if (num > VASurfaceAttribCount)
531 num = VASurfaceAttribCount;
533 for (i=0; i<num; i++) {
534 va_TraceMsg(trace_ctx, "\tattrib_list[%i] =\n", i);
536 va_TraceMsg(trace_ctx, "\t\ttype = %d\n", p->type);
537 va_TraceMsg(trace_ctx, "\t\tflags = %d\n", p->flags);
538 va_TraceMsg(trace_ctx, "\t\tvalue.type = %d\n", p->value.type);
539 if (p->value.type == VAGenericValueTypeInteger)
540 va_TraceMsg(trace_ctx, "\t\tvalue.value.i = 0x%08x\n", p->value.value.i);
541 else if (p->value.type == VAGenericValueTypeFloat)
542 va_TraceMsg(trace_ctx, "\t\tvalue.value.f = %f\n", p->value.value.f);
543 else if (p->value.type == VAGenericValueTypePointer)
544 va_TraceMsg(trace_ctx, "\t\tvalue.value.p = %p\n", p->value.value.p);
545 else if (p->value.type == VAGenericValueTypeFunc)
546 va_TraceMsg(trace_ctx, "\t\tvalue.value.fn = %p\n", p->value.value.fn);
552 void va_TraceCreateSurfaces(
558 VASurfaceID *surfaces, /* out */
559 VASurfaceAttrib *attrib_list,
560 unsigned int num_attribs
568 va_TraceMsg(trace_ctx, "\twidth = %d\n", width);
569 va_TraceMsg(trace_ctx, "\theight = %d\n", height);
570 va_TraceMsg(trace_ctx, "\tformat = %d\n", format);
571 va_TraceMsg(trace_ctx, "\tnum_surfaces = %d\n", num_surfaces);
574 for (i = 0; i < num_surfaces; i++)
575 va_TraceMsg(trace_ctx, "\t\tsurfaces[%d] = 0x%08x\n", i, surfaces[i]);
578 va_TraceSurfaceAttributes(trace_ctx, attrib_list, &num_attribs);
580 va_TraceMsg(trace_ctx, NULL);
584 void va_TraceDestroySurfaces(
586 VASurfaceID *surface_list,
596 for (i = 0; i < num_surfaces; i++)
597 va_TraceMsg(trace_ctx, "\t\tsurfaces[%d] = 0x%08x\n", i, surface_list[i]);
600 va_TraceMsg(trace_ctx, NULL);
604 void va_TraceCreateContext(
606 VAConfigID config_id,
610 VASurfaceID *render_targets,
611 int num_render_targets,
612 VAContextID *context /* out */
620 va_TraceMsg(trace_ctx, "\tconfig = 0x%08x\n", config_id);
621 va_TraceMsg(trace_ctx, "\twidth = %d\n", picture_width);
622 va_TraceMsg(trace_ctx, "\theight = %d\n", picture_height);
623 va_TraceMsg(trace_ctx, "\tflag = 0x%08x\n", flag);
624 va_TraceMsg(trace_ctx, "\tnum_render_targets = %d\n", num_render_targets);
625 if (render_targets) {
626 for (i=0; i<num_render_targets; i++)
627 va_TraceMsg(trace_ctx, "\t\trender_targets[%d] = 0x%08x\n", i, render_targets[i]);
630 va_TraceMsg(trace_ctx, "\tcontext = 0x%08x\n", *context);
631 trace_ctx->trace_context = *context;
633 trace_ctx->trace_context = VA_INVALID_ID;
635 trace_ctx->trace_frame_no = 0;
636 trace_ctx->trace_slice_no = 0;
638 trace_ctx->trace_frame_width = picture_width;
639 trace_ctx->trace_frame_height = picture_height;
641 if (trace_ctx->trace_surface_width == 0)
642 trace_ctx->trace_surface_width = picture_width;
643 if (trace_ctx->trace_surface_height == 0)
644 trace_ctx->trace_surface_height = picture_height;
648 static char * buffer_type_to_string(int type)
651 case VAPictureParameterBufferType: return "VAPictureParameterBufferType";
652 case VAIQMatrixBufferType: return "VAIQMatrixBufferType";
653 case VABitPlaneBufferType: return "VABitPlaneBufferType";
654 case VASliceGroupMapBufferType: return "VASliceGroupMapBufferType";
655 case VASliceParameterBufferType: return "VASliceParameterBufferType";
656 case VASliceDataBufferType: return "VASliceDataBufferType";
657 case VAProtectedSliceDataBufferType: return "VAProtectedSliceDataBufferType";
658 case VAMacroblockParameterBufferType: return "VAMacroblockParameterBufferType";
659 case VAResidualDataBufferType: return "VAResidualDataBufferType";
660 case VADeblockingParameterBufferType: return "VADeblockingParameterBufferType";
661 case VAImageBufferType: return "VAImageBufferType";
662 case VAQMatrixBufferType: return "VAQMatrixBufferType";
663 case VAHuffmanTableBufferType: return "VAHuffmanTableBufferType";
664 /* Following are encode buffer types */
665 case VAEncCodedBufferType: return "VAEncCodedBufferType";
666 case VAEncSequenceParameterBufferType: return "VAEncSequenceParameterBufferType";
667 case VAEncPictureParameterBufferType: return "VAEncPictureParameterBufferType";
668 case VAEncSliceParameterBufferType: return "VAEncSliceParameterBufferType";
669 case VAEncPackedHeaderParameterBufferType: return "VAEncPackedHeaderParameterBufferType";
670 case VAEncPackedHeaderDataBufferType: return "VAEncPackedHeaderDataBufferType";
671 case VAEncMiscParameterBufferType: return "VAEncMiscParameterBufferType";
672 case VAEncMacroblockParameterBufferType: return "VAEncMacroblockParameterBufferType";
673 case VAProcPipelineParameterBufferType: return "VAProcPipelineParameterBufferType";
674 case VAProcFilterParameterBufferType: return "VAProcFilterParameterBufferType";
675 default: return "UnknowBuffer";
679 void va_TraceCreateBuffer (
681 VAContextID context, /* in */
682 VABufferType type, /* in */
683 unsigned int size, /* in */
684 unsigned int num_elements, /* in */
686 VABufferID *buf_id /* out */
691 /* only trace CodedBuffer */
692 if (type != VAEncCodedBufferType)
696 va_TraceMsg(trace_ctx, "\tbuf_type=%s\n", buffer_type_to_string(type));
698 va_TraceMsg(trace_ctx, "\tbuf_id=0x%x\n", *buf_id);
699 va_TraceMsg(trace_ctx, "\tsize=%d\n", size);
700 va_TraceMsg(trace_ctx, "\tnum_elements=%d\n", num_elements);
702 va_TraceMsg(trace_ctx, NULL);
705 void va_TraceDestroyBuffer (
707 VABufferID buf_id /* in */
712 unsigned int num_elements;
714 VACodedBufferSegment *buf_list;
719 vaBufferInfo(dpy, trace_ctx->trace_context, buf_id, &type, &size, &num_elements);
721 /* only trace CodedBuffer */
722 if (type != VAEncCodedBufferType)
726 va_TraceMsg(trace_ctx, "\tbuf_type=%s\n", buffer_type_to_string(type));
727 va_TraceMsg(trace_ctx, "\tbuf_id=0x%x\n", buf_id);
728 va_TraceMsg(trace_ctx, "\tsize=%d\n", size);
729 va_TraceMsg(trace_ctx, "\tnum_elements=%d\n", num_elements);
731 va_TraceMsg(trace_ctx, NULL);
735 void va_TraceMapBuffer (
737 VABufferID buf_id, /* in */
738 void **pbuf /* out */
743 unsigned int num_elements;
745 VACodedBufferSegment *buf_list;
750 vaBufferInfo(dpy, trace_ctx->trace_context, buf_id, &type, &size, &num_elements);
752 /* only trace CodedBuffer */
753 if (type != VAEncCodedBufferType)
757 va_TraceMsg(trace_ctx, "\tbuf_id=0x%x\n", buf_id);
758 va_TraceMsg(trace_ctx, "\tbuf_type=%s\n", buffer_type_to_string(type));
759 if ((pbuf == NULL) || (*pbuf == NULL))
762 buf_list = (VACodedBufferSegment *)(*pbuf);
763 while (buf_list != NULL) {
764 va_TraceMsg(trace_ctx, "\tCodedbuf[%d] =\n", i++);
766 va_TraceMsg(trace_ctx, "\t size = %d\n", buf_list->size);
767 va_TraceMsg(trace_ctx, "\t bit_offset = %d\n", buf_list->bit_offset);
768 va_TraceMsg(trace_ctx, "\t status = 0x%08x\n", buf_list->status);
769 va_TraceMsg(trace_ctx, "\t reserved = 0x%08x\n", buf_list->reserved);
770 va_TraceMsg(trace_ctx, "\t buf = 0x%08x\n", buf_list->buf);
772 buf_list = buf_list->next;
774 va_TraceMsg(trace_ctx, NULL);
777 static void va_TraceVABuffers(
783 unsigned int num_elements,
788 unsigned char *p = pbuf;
792 va_TraceMsg(trace_ctx, "--%s\n", buffer_type_to_string(type));
794 if ((trace_flag & VA_TRACE_FLAG_BUFDATA) && trace_ctx->trace_fp_log) {
795 for (i=0; i<size; i++) {
796 unsigned char value = p[i];
799 fprintf(trace_ctx->trace_fp_log, "\t\t0x%04x:", i);
800 else if ((i%16) == 0)
801 fprintf(trace_ctx->trace_fp_log, "\n\t\t0x%04x:", i);
803 fprintf(trace_ctx->trace_fp_log, " %02x", value);
805 fprintf(trace_ctx->trace_fp_log, "\n");
808 va_TraceMsg(trace_ctx, NULL);
814 static void va_TraceVAPictureParameterBufferMPEG2(
820 unsigned int num_elements,
823 VAPictureParameterBufferMPEG2 *p=(VAPictureParameterBufferMPEG2 *)data;
826 va_TraceMsg(trace_ctx,"VAPictureParameterBufferMPEG2\n");
828 va_TraceMsg(trace_ctx,"\thorizontal size= %d\n", p->horizontal_size);
829 va_TraceMsg(trace_ctx,"\tvertical size= %d\n", p->vertical_size);
830 va_TraceMsg(trace_ctx,"\tforward reference picture= %d\n", p->forward_reference_picture);
831 va_TraceMsg(trace_ctx,"\tbackward reference picture= %d\n", p->backward_reference_picture);
832 va_TraceMsg(trace_ctx,"\tpicture coding type= %d\n", p->picture_coding_type);
833 va_TraceMsg(trace_ctx,"\tf mode= %d\n", p->f_code);
835 va_TraceMsg(trace_ctx,"\tpicture coding extension = %d\n", p->picture_coding_extension.value);
836 va_TraceMsg(trace_ctx,"\tintra_dc_precision= %d\n", p->picture_coding_extension.bits.intra_dc_precision);
837 va_TraceMsg(trace_ctx,"\tpicture_structure= %d\n", p->picture_coding_extension.bits.picture_structure);
838 va_TraceMsg(trace_ctx,"\ttop_field_first= %d\n", p->picture_coding_extension.bits.top_field_first);
839 va_TraceMsg(trace_ctx,"\tframe_pred_frame_dct= %d\n", p->picture_coding_extension.bits.frame_pred_frame_dct);
840 va_TraceMsg(trace_ctx,"\tconcealment_motion_vectors= %d\n", p->picture_coding_extension.bits.concealment_motion_vectors);
841 va_TraceMsg(trace_ctx,"\tq_scale_type= %d\n", p->picture_coding_extension.bits.q_scale_type);
842 va_TraceMsg(trace_ctx,"\tintra_vlc_format= %d\n", p->picture_coding_extension.bits.intra_vlc_format);
843 va_TraceMsg(trace_ctx,"\talternate_scan= %d\n", p->picture_coding_extension.bits.alternate_scan);
844 va_TraceMsg(trace_ctx,"\trepeat_first_field= %d\n", p->picture_coding_extension.bits.repeat_first_field);
845 va_TraceMsg(trace_ctx,"\tprogressive_frame= %d\n", p->picture_coding_extension.bits.progressive_frame);
846 va_TraceMsg(trace_ctx,"\tis_first_field= %d\n", p->picture_coding_extension.bits.is_first_field);
847 va_TraceMsg(trace_ctx, NULL);
853 static void va_TraceVAIQMatrixBufferMPEG2(
859 unsigned int num_elements,
862 VAIQMatrixBufferMPEG2 *p=(VAIQMatrixBufferMPEG2 *)data;
865 va_TraceMsg(trace_ctx,"VAIQMatrixBufferMPEG2\n");
867 va_TraceMsg(trace_ctx,"\tload_intra_quantiser_matrix = %d\n", p->load_intra_quantiser_matrix);
868 va_TraceMsg(trace_ctx,"\tload_non_intra_quantiser_matrix = %d\n", p->load_non_intra_quantiser_matrix);
869 va_TraceMsg(trace_ctx,"\tload_chroma_intra_quantiser_matrix = %d\n", p->load_chroma_intra_quantiser_matrix);
870 va_TraceMsg(trace_ctx,"\tload_chroma_non_intra_quantiser_matrix = %d\n", p->load_chroma_non_intra_quantiser_matrix);
871 va_TraceMsg(trace_ctx,"\tintra_quantiser_matrix = %d\n", p->intra_quantiser_matrix);
872 va_TraceMsg(trace_ctx,"\tnon_intra_quantiser_matrix = %d\n", p->non_intra_quantiser_matrix);
873 va_TraceMsg(trace_ctx,"\tchroma_intra_quantiser_matrix = %d\n", p->chroma_intra_quantiser_matrix);
874 va_TraceMsg(trace_ctx,"\tchroma_non_intra_quantiser_matrix = %d\n", p->chroma_non_intra_quantiser_matrix);
875 va_TraceMsg(trace_ctx, NULL);
881 static void va_TraceVASliceParameterBufferMPEG2(
887 unsigned int num_elements,
890 VASliceParameterBufferMPEG2 *p=(VASliceParameterBufferMPEG2 *)data;
894 trace_ctx->trace_slice_no++;
896 trace_ctx->trace_slice_size = p->slice_data_size;
898 va_TraceMsg(trace_ctx,"VASliceParameterBufferMPEG2\n");
900 va_TraceMsg(trace_ctx,"\tslice_data_size = %d\n", p->slice_data_size);
901 va_TraceMsg(trace_ctx,"\tslice_data_offset = %d\n", p->slice_data_offset);
902 va_TraceMsg(trace_ctx,"\tslice_data_flag = %d\n", p->slice_data_flag);
903 va_TraceMsg(trace_ctx,"\tmacroblock_offset = %d\n", p->macroblock_offset);
904 va_TraceMsg(trace_ctx,"\tslice_horizontal_position = %d\n", p->slice_horizontal_position);
905 va_TraceMsg(trace_ctx,"\tslice_vertical_position = %d\n", p->slice_vertical_position);
906 va_TraceMsg(trace_ctx,"\tquantiser_scale_code = %d\n", p->quantiser_scale_code);
907 va_TraceMsg(trace_ctx,"\tintra_slice_flag = %d\n", p->intra_slice_flag);
908 va_TraceMsg(trace_ctx, NULL);
913 static void va_TraceVAPictureParameterBufferJPEG(
919 unsigned int num_elements,
923 VAPictureParameterBufferJPEGBaseline *p=(VAPictureParameterBufferJPEGBaseline *)data;
926 va_TraceMsg(trace_ctx,"*VAPictureParameterBufferJPEG\n");
927 va_TraceMsg(trace_ctx,"\tpicture_width = %u\n", p->picture_width);
928 va_TraceMsg(trace_ctx,"\tpicture_height = %u\n", p->picture_height);
929 va_TraceMsg(trace_ctx,"\tcomponents = \n");
930 for (i = 0; i < p->num_components && i < 255; ++i) {
931 va_TraceMsg(trace_ctx,"\t\t[%d] component_id = %u\n", i, p->components[i].component_id);
932 va_TraceMsg(trace_ctx,"\t\t[%d] h_sampling_factor = %u\n", i, p->components[i].h_sampling_factor);
933 va_TraceMsg(trace_ctx,"\t\t[%d] v_sampling_factor = %u\n", i, p->components[i].v_sampling_factor);
934 va_TraceMsg(trace_ctx,"\t\t[%d] quantiser_table_selector = %u\n", i, p->components[i].quantiser_table_selector);
938 static void va_TraceVAIQMatrixBufferJPEG(
944 unsigned int num_elements,
948 static char tmp[1024];
949 VAIQMatrixBufferJPEGBaseline *p=(VAIQMatrixBufferJPEGBaseline *)data;
951 va_TraceMsg(trace_ctx,"*VAIQMatrixParameterBufferJPEG\n");
952 va_TraceMsg(trace_ctx,"\tload_quantiser_table =\n");
953 for (i = 0; i < 4; ++i) {
954 va_TraceMsg(trace_ctx,"\t\t[%d] = %u\n", i, p->load_quantiser_table[i]);
956 va_TraceMsg(trace_ctx,"\tquantiser_table =\n");
957 for (i = 0; i < 4; ++i) {
958 memset(tmp, 0, sizeof tmp);
959 for (j = 0; j < 64; ++j) {
960 sprintf(tmp + strlen(tmp), "%u ", p->quantiser_table[i][j]);
962 va_TraceMsg(trace_ctx,"\t\t[%d] = %s\n", i, tmp);
966 static void va_TraceVASliceParameterBufferJPEG(
972 unsigned int num_elements,
976 VASliceParameterBufferJPEGBaseline *p=(VASliceParameterBufferJPEGBaseline *)data;
978 va_TraceMsg(trace_ctx,"*VASliceParameterBufferJPEG\n");
979 va_TraceMsg(trace_ctx,"\tslice_data_size = %u\n", p->slice_data_size);
980 va_TraceMsg(trace_ctx,"\tslice_data_offset = %u\n", p->slice_data_offset);
981 va_TraceMsg(trace_ctx,"\tslice_data_flag = %u\n", p->slice_data_flag);
982 va_TraceMsg(trace_ctx,"\tslice_horizontal_position = %u\n", p->slice_horizontal_position);
983 va_TraceMsg(trace_ctx,"\tslice_vertical_position = %u\n", p->slice_vertical_position);
984 va_TraceMsg(trace_ctx,"\tcomponents = \n");
985 for (i = 0; i < p->num_components && i < 4; ++i) {
986 va_TraceMsg(trace_ctx,"\t\t[%d] component_selector = %u\n", i, p->components[i].component_selector);
987 va_TraceMsg(trace_ctx,"\t\t[%d] dc_table_selector = %u\n", i, p->components[i].dc_table_selector);
988 va_TraceMsg(trace_ctx,"\t\t[%d] ac_table_selector = %u\n", i, p->components[i].ac_table_selector);
990 va_TraceMsg(trace_ctx,"\trestart_interval = %u\n", p->restart_interval);
991 va_TraceMsg(trace_ctx,"\tnum_mcus = %u\n", p->num_mcus);
994 static void va_TraceVAHuffmanTableBufferJPEG(
1000 unsigned int num_elements,
1004 static char tmp[1024];
1005 VAHuffmanTableBufferJPEGBaseline *p=(VAHuffmanTableBufferJPEGBaseline *)data;
1007 va_TraceMsg(trace_ctx,"*VAHuffmanTableBufferJPEG\n");
1009 for (i = 0; i < 2; ++i) {
1010 va_TraceMsg(trace_ctx,"\tload_huffman_table[%d] =%u\n", i, p->load_huffman_table[0]);
1011 va_TraceMsg(trace_ctx,"\thuffman_table[%d] =\n", i);
1012 memset(tmp, 0, sizeof tmp);
1013 for (j = 0; j < 16; ++j) {
1014 sprintf(tmp + strlen(tmp), "%u ", p->huffman_table[i].num_dc_codes[j]);
1016 va_TraceMsg(trace_ctx,"\t\tnum_dc_codes =%s\n", tmp);
1017 memset(tmp, 0, sizeof tmp);
1018 for (j = 0; j < 12; ++j) {
1019 sprintf(tmp + strlen(tmp), "%u ", p->huffman_table[i].dc_values[j]);
1021 va_TraceMsg(trace_ctx,"\t\tdc_values =%s\n", tmp);
1022 memset(tmp, 0, sizeof tmp);
1023 for (j = 0; j < 16; ++j) {
1024 sprintf(tmp + strlen(tmp), "%u ", p->huffman_table[i].num_ac_codes[j]);
1026 va_TraceMsg(trace_ctx,"\t\tnum_dc_codes =%s\n", tmp);
1027 memset(tmp, 0, sizeof tmp);
1028 for (j = 0; j < 162; ++j) {
1029 sprintf(tmp + strlen(tmp), "%u ", p->huffman_table[i].ac_values[j]);
1031 va_TraceMsg(trace_ctx,"\t\tnum_dc_codes =%s\n", tmp);
1032 memset(tmp, 0, sizeof tmp);
1033 for (j = 0; j < 2; ++j) {
1034 sprintf(tmp + strlen(tmp), "%u ", p->huffman_table[i].pad[j]);
1036 va_TraceMsg(trace_ctx,"\t\tnum_dc_codes =%s\n", tmp);
1040 static void va_TraceVAPictureParameterBufferMPEG4(
1042 VAContextID context,
1046 unsigned int num_elements,
1050 VAPictureParameterBufferMPEG4 *p=(VAPictureParameterBufferMPEG4 *)data;
1054 va_TraceMsg(trace_ctx,"*VAPictureParameterBufferMPEG4\n");
1055 va_TraceMsg(trace_ctx,"\tvop_width = %d\n", p->vop_width);
1056 va_TraceMsg(trace_ctx,"\tvop_height = %d\n", p->vop_height);
1057 va_TraceMsg(trace_ctx,"\tforward_reference_picture = %d\n", p->forward_reference_picture);
1058 va_TraceMsg(trace_ctx,"\tbackward_reference_picture = %d\n", p->backward_reference_picture);
1059 va_TraceMsg(trace_ctx,"\tvol_fields value = %d\n", p->vol_fields.value);
1060 va_TraceMsg(trace_ctx,"\tshort_video_header= %d\n", p->vol_fields.bits.short_video_header);
1061 va_TraceMsg(trace_ctx,"\tchroma_format= %d\n", p->vol_fields.bits.chroma_format);
1062 va_TraceMsg(trace_ctx,"\tinterlaced= %d\n", p->vol_fields.bits.interlaced);
1063 va_TraceMsg(trace_ctx,"\tobmc_disable= %d\n", p->vol_fields.bits.obmc_disable);
1064 va_TraceMsg(trace_ctx,"\tsprite_enable= %d\n", p->vol_fields.bits.sprite_enable);
1065 va_TraceMsg(trace_ctx,"\tsprite_warping_accuracy= %d\n", p->vol_fields.bits.sprite_warping_accuracy);
1066 va_TraceMsg(trace_ctx,"\tquant_type= %d\n", p->vol_fields.bits.quant_type);
1067 va_TraceMsg(trace_ctx,"\tquarter_sample= %d\n", p->vol_fields.bits.quarter_sample);
1068 va_TraceMsg(trace_ctx,"\tdata_partitioned= %d\n", p->vol_fields.bits.data_partitioned);
1069 va_TraceMsg(trace_ctx,"\treversible_vlc= %d\n", p->vol_fields.bits.reversible_vlc);
1070 va_TraceMsg(trace_ctx,"\tresync_marker_disable= %d\n", p->vol_fields.bits.resync_marker_disable);
1071 va_TraceMsg(trace_ctx,"\tno_of_sprite_warping_points = %d\n", p->no_of_sprite_warping_points);
1072 va_TraceMsg(trace_ctx,"\tsprite_trajectory_du =");
1074 va_TraceMsg(trace_ctx,"\t%d", p->sprite_trajectory_du[i]);
1076 va_TraceMsg(trace_ctx,"\n");
1077 va_TraceMsg(trace_ctx,"\tsprite_trajectory_dv =");
1079 va_TraceMsg(trace_ctx,"\t%d", p->sprite_trajectory_dv[i]);
1080 va_TraceMsg(trace_ctx,"\n");
1081 va_TraceMsg(trace_ctx,"\tvop_fields value = %d\n", p->vop_fields.value);
1082 va_TraceMsg(trace_ctx,"\tvop_coding_type= %d\n", p->vop_fields.bits.vop_coding_type);
1083 va_TraceMsg(trace_ctx,"\tbackward_reference_vop_coding_type= %d\n", p->vop_fields.bits.backward_reference_vop_coding_type);
1084 va_TraceMsg(trace_ctx,"\tvop_rounding_type= %d\n", p->vop_fields.bits.vop_rounding_type);
1085 va_TraceMsg(trace_ctx,"\tintra_dc_vlc_thr= %d\n", p->vop_fields.bits.intra_dc_vlc_thr);
1086 va_TraceMsg(trace_ctx,"\ttop_field_first= %d\n", p->vop_fields.bits.top_field_first);
1087 va_TraceMsg(trace_ctx,"\talternate_vertical_scan_flag= %d\n", p->vop_fields.bits.alternate_vertical_scan_flag);
1088 va_TraceMsg(trace_ctx,"\tvop_fcode_forward = %d\n", p->vop_fcode_forward);
1089 va_TraceMsg(trace_ctx,"\tvop_fcode_backward = %d\n", p->vop_fcode_backward);
1090 va_TraceMsg(trace_ctx,"\tnum_gobs_in_vop = %d\n", p->num_gobs_in_vop);
1091 va_TraceMsg(trace_ctx,"\tnum_macroblocks_in_gob = %d\n", p->num_macroblocks_in_gob);
1092 va_TraceMsg(trace_ctx,"\tTRB = %d\n", p->TRB);
1093 va_TraceMsg(trace_ctx,"\tTRD = %d\n", p->TRD);
1094 va_TraceMsg(trace_ctx, NULL);
1100 static void va_TraceVAIQMatrixBufferMPEG4(
1102 VAContextID context,
1106 unsigned int num_elements,
1110 VAIQMatrixBufferMPEG4 *p=(VAIQMatrixBufferMPEG4 *)data;
1113 va_TraceMsg(trace_ctx,"VAIQMatrixBufferMPEG4\n");
1115 va_TraceMsg(trace_ctx,"\tload_intra_quant_mat = %d\n", p->load_intra_quant_mat);
1116 va_TraceMsg(trace_ctx,"\tload_non_intra_quant_mat = %d\n", p->load_non_intra_quant_mat);
1117 va_TraceMsg(trace_ctx,"\tintra_quant_mat =\n");
1119 va_TraceMsg(trace_ctx,"\t\t%d\n", p->intra_quant_mat[i]);
1121 va_TraceMsg(trace_ctx,"\tnon_intra_quant_mat =\n");
1123 va_TraceMsg(trace_ctx,"\t\t%d\n", p->non_intra_quant_mat[i]);
1124 va_TraceMsg(trace_ctx, NULL);
1129 static void va_TraceVAEncSequenceParameterBufferMPEG4(
1131 VAContextID context,
1135 unsigned int num_elements,
1138 VAEncSequenceParameterBufferMPEG4 *p = (VAEncSequenceParameterBufferMPEG4 *)data;
1141 va_TraceMsg(trace_ctx, "\t--VAEncSequenceParameterBufferMPEG4\n");
1143 va_TraceMsg(trace_ctx, "\tprofile_and_level_indication = %d\n", p->profile_and_level_indication);
1144 va_TraceMsg(trace_ctx, "\tintra_period = %d\n", p->intra_period);
1145 va_TraceMsg(trace_ctx, "\tvideo_object_layer_width = %d\n", p->video_object_layer_width);
1146 va_TraceMsg(trace_ctx, "\tvideo_object_layer_height = %d\n", p->video_object_layer_height);
1147 va_TraceMsg(trace_ctx, "\tvop_time_increment_resolution = %d\n", p->vop_time_increment_resolution);
1148 va_TraceMsg(trace_ctx, "\tfixed_vop_rate = %d\n", p->fixed_vop_rate);
1149 va_TraceMsg(trace_ctx, "\tfixed_vop_time_increment = %d\n", p->fixed_vop_time_increment);
1150 va_TraceMsg(trace_ctx, "\tbits_per_second = %d\n", p->bits_per_second);
1151 va_TraceMsg(trace_ctx, "\tframe_rate = %d\n", p->frame_rate);
1152 va_TraceMsg(trace_ctx, "\tinitial_qp = %d\n", p->initial_qp);
1153 va_TraceMsg(trace_ctx, "\tmin_qp = %d\n", p->min_qp);
1154 va_TraceMsg(trace_ctx, NULL);
1156 /* start a new sequce, coded log file can be truncated */
1157 trace_ctx->trace_sequence_start = 1;
1162 static void va_TraceVAEncPictureParameterBufferMPEG4(
1164 VAContextID context,
1168 unsigned int num_elements,
1171 VAEncPictureParameterBufferMPEG4 *p = (VAEncPictureParameterBufferMPEG4 *)data;
1174 va_TraceMsg(trace_ctx, "\t--VAEncPictureParameterBufferMPEG4\n");
1175 va_TraceMsg(trace_ctx, "\treference_picture = 0x%08x\n", p->reference_picture);
1176 va_TraceMsg(trace_ctx, "\treconstructed_picture = 0x%08x\n", p->reconstructed_picture);
1177 va_TraceMsg(trace_ctx, "\tcoded_buf = 0x%08x\n", p->coded_buf);
1178 va_TraceMsg(trace_ctx, "\tpicture_width = %d\n", p->picture_width);
1179 va_TraceMsg(trace_ctx, "\tpicture_height = %d\n", p->picture_height);
1180 va_TraceMsg(trace_ctx, "\tmodulo_time_base = %d\n", p->modulo_time_base);
1181 va_TraceMsg(trace_ctx, "\tvop_time_increment = %d\n", p->vop_time_increment);
1182 va_TraceMsg(trace_ctx, "\tpicture_type = %d\n", p->picture_type);
1183 va_TraceMsg(trace_ctx, NULL);
1185 trace_ctx->trace_codedbuf = p->coded_buf;
1191 static void va_TraceVASliceParameterBufferMPEG4(
1193 VAContextID context,
1197 unsigned int num_elements,
1200 VASliceParameterBufferMPEG4 *p=(VASliceParameterBufferMPEG4 *)data;
1204 trace_ctx->trace_slice_no++;
1206 trace_ctx->trace_slice_size = p->slice_data_size;
1208 va_TraceMsg(trace_ctx,"VASliceParameterBufferMPEG4\n");
1210 va_TraceMsg(trace_ctx,"\tslice_data_size = %d\n", p->slice_data_size);
1211 va_TraceMsg(trace_ctx,"\tslice_data_offset = %d\n", p->slice_data_offset);
1212 va_TraceMsg(trace_ctx,"\tslice_data_flag = %d\n", p->slice_data_flag);
1213 va_TraceMsg(trace_ctx,"\tmacroblock_offset = %d\n", p->macroblock_offset);
1214 va_TraceMsg(trace_ctx,"\tmacroblock_number = %d\n", p->macroblock_number);
1215 va_TraceMsg(trace_ctx,"\tquant_scale = %d\n", p->quant_scale);
1216 va_TraceMsg(trace_ctx, NULL);
1222 static inline void va_TraceFlagIfNotZero(
1223 struct trace_context *trace_ctx,
1224 const char *name, /* in */
1225 unsigned int flag /* in */
1229 va_TraceMsg(trace_ctx, "%s = %x\n", name, flag);
1234 static void va_TraceVAPictureParameterBufferH264(
1236 VAContextID context,
1240 unsigned int num_elements,
1244 VAPictureParameterBufferH264 *p = (VAPictureParameterBufferH264*)data;
1248 va_TraceMsg(trace_ctx, "\t--VAPictureParameterBufferH264\n");
1250 va_TraceMsg(trace_ctx, "\tCurrPic.picture_id = 0x%08x\n", p->CurrPic.picture_id);
1251 va_TraceMsg(trace_ctx, "\tCurrPic.frame_idx = %d\n", p->CurrPic.frame_idx);
1252 va_TraceMsg(trace_ctx, "\tCurrPic.flags = %d\n", p->CurrPic.flags);
1253 va_TraceMsg(trace_ctx, "\tCurrPic.TopFieldOrderCnt = %d\n", p->CurrPic.TopFieldOrderCnt);
1254 va_TraceMsg(trace_ctx, "\tCurrPic.BottomFieldOrderCnt = %d\n", p->CurrPic.BottomFieldOrderCnt);
1256 va_TraceMsg(trace_ctx, "\tReferenceFrames (TopFieldOrderCnt-BottomFieldOrderCnt-picture_id-frame_idx-flags:\n");
1257 for (i = 0; i < 16; i++)
1259 if ((p->ReferenceFrames[i].picture_id != VA_INVALID_SURFACE) &&
1260 ((p->ReferenceFrames[i].flags & VA_PICTURE_H264_INVALID) == 0)) {
1261 va_TraceMsg(trace_ctx, "\t\t%08d-%08d-0x%08x-%08d-0x%08x\n",
1262 p->ReferenceFrames[i].TopFieldOrderCnt,
1263 p->ReferenceFrames[i].BottomFieldOrderCnt,
1264 p->ReferenceFrames[i].picture_id,
1265 p->ReferenceFrames[i].frame_idx,
1266 p->ReferenceFrames[i].flags);
1270 va_TraceMsg(trace_ctx, "\tpicture_width_in_mbs_minus1 = %d\n", p->picture_width_in_mbs_minus1);
1271 va_TraceMsg(trace_ctx, "\tpicture_height_in_mbs_minus1 = %d\n", p->picture_height_in_mbs_minus1);
1272 va_TraceMsg(trace_ctx, "\tbit_depth_luma_minus8 = %d\n", p->bit_depth_luma_minus8);
1273 va_TraceMsg(trace_ctx, "\tbit_depth_chroma_minus8 = %d\n", p->bit_depth_chroma_minus8);
1274 va_TraceMsg(trace_ctx, "\tnum_ref_frames = %d\n", p->num_ref_frames);
1275 va_TraceMsg(trace_ctx, "\tseq fields = %d\n", p->seq_fields.value);
1276 va_TraceMsg(trace_ctx, "\tchroma_format_idc = %d\n", p->seq_fields.bits.chroma_format_idc);
1277 va_TraceMsg(trace_ctx, "\tresidual_colour_transform_flag = %d\n", p->seq_fields.bits.residual_colour_transform_flag);
1278 va_TraceMsg(trace_ctx, "\tframe_mbs_only_flag = %d\n", p->seq_fields.bits.frame_mbs_only_flag);
1279 va_TraceMsg(trace_ctx, "\tmb_adaptive_frame_field_flag = %d\n", p->seq_fields.bits.mb_adaptive_frame_field_flag);
1280 va_TraceMsg(trace_ctx, "\tdirect_8x8_inference_flag = %d\n", p->seq_fields.bits.direct_8x8_inference_flag);
1281 va_TraceMsg(trace_ctx, "\tMinLumaBiPredSize8x8 = %d\n", p->seq_fields.bits.MinLumaBiPredSize8x8);
1282 va_TraceMsg(trace_ctx, "\tnum_slice_groups_minus1 = %d\n", p->num_slice_groups_minus1);
1283 va_TraceMsg(trace_ctx, "\tslice_group_map_type = %d\n", p->slice_group_map_type);
1284 va_TraceMsg(trace_ctx, "\tslice_group_change_rate_minus1 = %d\n", p->slice_group_change_rate_minus1);
1285 va_TraceMsg(trace_ctx, "\tpic_init_qp_minus26 = %d\n", p->pic_init_qp_minus26);
1286 va_TraceMsg(trace_ctx, "\tpic_init_qs_minus26 = %d\n", p->pic_init_qs_minus26);
1287 va_TraceMsg(trace_ctx, "\tchroma_qp_index_offset = %d\n", p->chroma_qp_index_offset);
1288 va_TraceMsg(trace_ctx, "\tsecond_chroma_qp_index_offset = %d\n", p->second_chroma_qp_index_offset);
1289 va_TraceMsg(trace_ctx, "\tpic_fields = 0x%03x\n", p->pic_fields.value);
1290 va_TraceFlagIfNotZero(trace_ctx, "\t\tentropy_coding_mode_flag", p->pic_fields.bits.entropy_coding_mode_flag);
1291 va_TraceFlagIfNotZero(trace_ctx, "\t\tweighted_pred_flag", p->pic_fields.bits.weighted_pred_flag);
1292 va_TraceFlagIfNotZero(trace_ctx, "\t\tweighted_bipred_idc", p->pic_fields.bits.weighted_bipred_idc);
1293 va_TraceFlagIfNotZero(trace_ctx, "\t\ttransform_8x8_mode_flag", p->pic_fields.bits.transform_8x8_mode_flag);
1294 va_TraceFlagIfNotZero(trace_ctx, "\t\tfield_pic_flag", p->pic_fields.bits.field_pic_flag);
1295 va_TraceFlagIfNotZero(trace_ctx, "\t\tconstrained_intra_pred_flag", p->pic_fields.bits.constrained_intra_pred_flag);
1296 va_TraceFlagIfNotZero(trace_ctx, "\t\tpic_order_present_flag", p->pic_fields.bits.pic_order_present_flag);
1297 va_TraceFlagIfNotZero(trace_ctx, "\t\tdeblocking_filter_control_present_flag", p->pic_fields.bits.deblocking_filter_control_present_flag);
1298 va_TraceFlagIfNotZero(trace_ctx, "\t\tredundant_pic_cnt_present_flag", p->pic_fields.bits.redundant_pic_cnt_present_flag);
1299 va_TraceFlagIfNotZero(trace_ctx, "\t\treference_pic_flag", p->pic_fields.bits.reference_pic_flag);
1300 va_TraceMsg(trace_ctx, "\tframe_num = %d\n", p->frame_num);
1301 va_TraceMsg(trace_ctx, NULL);
1306 static void va_TraceVASliceParameterBufferH264(
1308 VAContextID context,
1312 unsigned int num_elements,
1316 VASliceParameterBufferH264* p = (VASliceParameterBufferH264*)data;
1319 trace_ctx->trace_slice_no++;
1320 trace_ctx->trace_slice_size = p->slice_data_size;
1322 va_TraceMsg(trace_ctx, "\t--VASliceParameterBufferH264\n");
1323 va_TraceMsg(trace_ctx, "\tslice_data_size = %d\n", p->slice_data_size);
1324 va_TraceMsg(trace_ctx, "\tslice_data_offset = %d\n", p->slice_data_offset);
1325 va_TraceMsg(trace_ctx, "\tslice_data_flag = %d\n", p->slice_data_flag);
1326 va_TraceMsg(trace_ctx, "\tslice_data_bit_offset = %d\n", p->slice_data_bit_offset);
1327 va_TraceMsg(trace_ctx, "\tfirst_mb_in_slice = %d\n", p->first_mb_in_slice);
1328 va_TraceMsg(trace_ctx, "\tslice_type = %d\n", p->slice_type);
1329 va_TraceMsg(trace_ctx, "\tdirect_spatial_mv_pred_flag = %d\n", p->direct_spatial_mv_pred_flag);
1330 va_TraceMsg(trace_ctx, "\tnum_ref_idx_l0_active_minus1 = %d\n", p->num_ref_idx_l0_active_minus1);
1331 va_TraceMsg(trace_ctx, "\tnum_ref_idx_l1_active_minus1 = %d\n", p->num_ref_idx_l1_active_minus1);
1332 va_TraceMsg(trace_ctx, "\tcabac_init_idc = %d\n", p->cabac_init_idc);
1333 va_TraceMsg(trace_ctx, "\tslice_qp_delta = %d\n", p->slice_qp_delta);
1334 va_TraceMsg(trace_ctx, "\tdisable_deblocking_filter_idc = %d\n", p->disable_deblocking_filter_idc);
1335 va_TraceMsg(trace_ctx, "\tslice_alpha_c0_offset_div2 = %d\n", p->slice_alpha_c0_offset_div2);
1336 va_TraceMsg(trace_ctx, "\tslice_beta_offset_div2 = %d\n", p->slice_beta_offset_div2);
1338 va_TraceMsg(trace_ctx, "\tRefPicList0 =\n");
1339 for (i = 0; i < 32; i++) {
1340 if ((p->RefPicList0[i].picture_id != VA_INVALID_SURFACE) &&
1341 ((p->RefPicList0[i].flags & VA_PICTURE_H264_INVALID) == 0))
1342 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);
1346 va_TraceMsg(trace_ctx, "\tRefPicList1 =\n");
1347 for (i = 0; i < 32; i++) {
1348 if ((p->RefPicList0[i].picture_id != VA_INVALID_SURFACE) &&
1349 ((p->RefPicList0[i].flags & VA_PICTURE_H264_INVALID) == 0))
1350 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);
1355 va_TraceMsg(trace_ctx, "\tluma_log2_weight_denom = %d\n", p->luma_log2_weight_denom);
1356 va_TraceMsg(trace_ctx, "\tchroma_log2_weight_denom = %d\n", p->chroma_log2_weight_denom);
1357 va_TraceMsg(trace_ctx, "\tluma_weight_l0_flag = %d\n", p->luma_weight_l0_flag);
1358 if (p->luma_weight_l0_flag) {
1359 for (i = 0; (i <= p->num_ref_idx_l0_active_minus1) && (i<32); i++) {
1360 va_TraceMsg(trace_ctx, "\t\t%d\t%d\n",
1361 p->luma_weight_l0[i],
1362 p->luma_offset_l0[i]);
1366 va_TraceMsg(trace_ctx, "\tchroma_weight_l0_flag = %d\n", p->chroma_weight_l0_flag);
1367 if (p->chroma_weight_l0_flag) {
1368 for (i = 0; (i <= p->num_ref_idx_l0_active_minus1) && (i<32); i++) {
1369 va_TraceMsg(trace_ctx, "\t\t%d\t%d\t%d\t%d\n",
1370 p->chroma_weight_l0[i][0],
1371 p->chroma_offset_l0[i][0],
1372 p->chroma_weight_l0[i][1],
1373 p->chroma_offset_l0[i][1]);
1377 va_TraceMsg(trace_ctx, "\tluma_weight_l1_flag = %d\n", p->luma_weight_l1_flag);
1378 if (p->luma_weight_l1_flag) {
1379 for (i = 0; (i <= p->num_ref_idx_l1_active_minus1) && (i<32); i++) {
1380 va_TraceMsg(trace_ctx, "\t\t%d\t%d\n",
1381 p->luma_weight_l1[i],
1382 p->luma_offset_l1[i]);
1386 va_TraceMsg(trace_ctx, "\tchroma_weight_l1_flag = %d\n", p->chroma_weight_l1_flag);
1387 if (p->chroma_weight_l1_flag) {
1388 for (i = 0; (i <= p->num_ref_idx_l1_active_minus1) && (i<32); i++) {
1389 va_TraceMsg(trace_ctx, "\t\t%d\t%d\t%d\t%d\n",
1390 p->chroma_weight_l1[i][0],
1391 p->chroma_offset_l1[i][0],
1392 p->chroma_weight_l1[i][1],
1393 p->chroma_offset_l1[i][1]);
1396 va_TraceMsg(trace_ctx, NULL);
1399 static void va_TraceVAIQMatrixBufferH264(
1401 VAContextID context,
1405 unsigned int num_elements,
1410 VAIQMatrixBufferH264* p = (VAIQMatrixBufferH264* )data;
1414 va_TraceMsg(trace_ctx, "\t--VAIQMatrixBufferH264\n");
1416 va_TraceMsg(trace_ctx, "\tScalingList4x4[6][16]=\n");
1417 for (i = 0; i < 6; i++) {
1418 for (j = 0; j < 16; j++) {
1419 if (trace_ctx->trace_fp_log) {
1420 fprintf(trace_ctx->trace_fp_log, "\t%d", p->ScalingList4x4[i][j]);
1421 if ((j + 1) % 8 == 0)
1422 fprintf(trace_ctx->trace_fp_log, "\n");
1427 va_TraceMsg(trace_ctx, "\tScalingList8x8[2][64]=\n");
1428 for (i = 0; i < 2; i++) {
1429 for (j = 0; j < 64; j++) {
1430 if (trace_ctx->trace_fp_log) {
1431 fprintf(trace_ctx->trace_fp_log,"\t%d", p->ScalingList8x8[i][j]);
1432 if ((j + 1) % 8 == 0)
1433 fprintf(trace_ctx->trace_fp_log, "\n");
1438 va_TraceMsg(trace_ctx, NULL);
1443 static void va_TraceVAEncSequenceParameterBufferH264(
1445 VAContextID context,
1449 unsigned int num_elements,
1452 VAEncSequenceParameterBufferH264 *p = (VAEncSequenceParameterBufferH264 *)data;
1456 va_TraceMsg(trace_ctx, "\t--VAEncSequenceParameterBufferH264\n");
1458 va_TraceMsg(trace_ctx, "\tseq_parameter_set_id = %d\n", p->seq_parameter_set_id);
1459 va_TraceMsg(trace_ctx, "\tlevel_idc = %d\n", p->level_idc);
1460 va_TraceMsg(trace_ctx, "\tintra_period = %d\n", p->intra_period);
1461 va_TraceMsg(trace_ctx, "\tintra_idr_period = %d\n", p->intra_idr_period);
1462 va_TraceMsg(trace_ctx, "\tip_period = %d\n", p->ip_period);
1463 va_TraceMsg(trace_ctx, "\tbits_per_second = %d\n", p->bits_per_second);
1464 va_TraceMsg(trace_ctx, "\tmax_num_ref_frames = %d\n", p->max_num_ref_frames);
1465 va_TraceMsg(trace_ctx, "\tpicture_width_in_mbs = %d\n", p->picture_width_in_mbs);
1466 va_TraceMsg(trace_ctx, "\tpicture_height_in_mbs = %d\n", p->picture_height_in_mbs);
1467 va_TraceMsg(trace_ctx, "\tchroma_format_idc = %d\n", p->seq_fields.bits.chroma_format_idc);
1468 va_TraceMsg(trace_ctx, "\tframe_mbs_only_flag = %d\n", p->seq_fields.bits.frame_mbs_only_flag);
1469 va_TraceMsg(trace_ctx, "\tmb_adaptive_frame_field_flag = %d\n", p->seq_fields.bits.mb_adaptive_frame_field_flag);
1470 va_TraceMsg(trace_ctx, "\tseq_scaling_matrix_present_flag = %d\n", p->seq_fields.bits.seq_scaling_matrix_present_flag);
1471 va_TraceMsg(trace_ctx, "\tdirect_8x8_inference_flag = %d\n", p->seq_fields.bits.direct_8x8_inference_flag);
1472 va_TraceMsg(trace_ctx, "\tlog2_max_frame_num_minus4 = %d\n", p->seq_fields.bits.log2_max_frame_num_minus4);
1473 va_TraceMsg(trace_ctx, "\tpic_order_cnt_type = %d\n", p->seq_fields.bits.pic_order_cnt_type);
1474 va_TraceMsg(trace_ctx, "\tlog2_max_pic_order_cnt_lsb_minus4 = %d\n", p->seq_fields.bits.log2_max_pic_order_cnt_lsb_minus4);
1475 va_TraceMsg(trace_ctx, "\tdelta_pic_order_always_zero_flag = %d\n", p->seq_fields.bits.delta_pic_order_always_zero_flag);
1476 va_TraceMsg(trace_ctx, "\tbit_depth_luma_minus8 = %d\n", p->bit_depth_luma_minus8);
1477 va_TraceMsg(trace_ctx, "\tbit_depth_chroma_minus8 = %d\n", p->bit_depth_chroma_minus8);
1478 va_TraceMsg(trace_ctx, "\tnum_ref_frames_in_pic_order_cnt_cycle = %d\n", p->num_ref_frames_in_pic_order_cnt_cycle);
1479 va_TraceMsg(trace_ctx, "\toffset_for_non_ref_pic = %d\n", p->offset_for_non_ref_pic);
1480 va_TraceMsg(trace_ctx, "\toffset_for_top_to_bottom_field = %d\n", p->offset_for_top_to_bottom_field);
1481 for(i = 0; (i < p->max_num_ref_frames) && (i < 32); ++i)
1482 va_TraceMsg(trace_ctx, "\toffset_for_ref_frame[%d] = %d\n", i, p->offset_for_ref_frame[i]);
1483 va_TraceMsg(trace_ctx, "\tframe_cropping_flag = %d\n", p->frame_cropping_flag);
1484 va_TraceMsg(trace_ctx, "\tframe_crop_left_offset = %d\n", p->frame_crop_left_offset);
1485 va_TraceMsg(trace_ctx, "\tframe_crop_right_offset = %d\n", p->frame_crop_right_offset);
1486 va_TraceMsg(trace_ctx, "\tframe_crop_top_offset = %d\n", p->frame_crop_top_offset);
1487 va_TraceMsg(trace_ctx, "\tframe_crop_bottom_offset = %d\n", p->frame_crop_bottom_offset);
1488 va_TraceMsg(trace_ctx, "\tvui_parameters_present_flag = %d\n", p->vui_parameters_present_flag);
1489 va_TraceMsg(trace_ctx, "\taspect_ratio_info_present_flag = %d\n", p->vui_fields.bits.aspect_ratio_info_present_flag);
1490 va_TraceMsg(trace_ctx, "\ttiming_info_present_flag = %d\n", p->vui_fields.bits.timing_info_present_flag);
1491 va_TraceMsg(trace_ctx, "\tbitstream_restriction_flag = %d\n", p->vui_fields.bits.bitstream_restriction_flag);
1492 va_TraceMsg(trace_ctx, "\tlog2_max_mv_length_horizontal = %d\n", p->vui_fields.bits.log2_max_mv_length_horizontal);
1493 va_TraceMsg(trace_ctx, "\tlog2_max_mv_length_vertical = %d\n", p->vui_fields.bits.log2_max_mv_length_vertical);
1494 va_TraceMsg(trace_ctx, "\taspect_ratio_idc = %d\n", p->aspect_ratio_idc);
1495 va_TraceMsg(trace_ctx, "\tsar_width = %d\n", p->sar_width);
1496 va_TraceMsg(trace_ctx, "\tsar_height = %d\n", p->sar_height);
1497 va_TraceMsg(trace_ctx, "\tnum_units_in_tick = %d\n", p->num_units_in_tick);
1498 va_TraceMsg(trace_ctx, "\ttime_scale = %d\n", p->time_scale);
1500 va_TraceMsg(trace_ctx, NULL);
1502 /* start a new sequce, coded log file can be truncated */
1503 trace_ctx->trace_sequence_start = 1;
1509 static void va_TraceVAEncPictureParameterBufferH264(
1511 VAContextID context,
1515 unsigned int num_elements,
1518 VAEncPictureParameterBufferH264 *p = (VAEncPictureParameterBufferH264 *)data;
1522 va_TraceMsg(trace_ctx, "\t--VAEncPictureParameterBufferH264\n");
1524 va_TraceMsg(trace_ctx, "\tCurrPic.picture_id = 0x%08x\n", p->CurrPic.picture_id);
1525 va_TraceMsg(trace_ctx, "\tCurrPic.frame_idx = %d\n", p->CurrPic.frame_idx);
1526 va_TraceMsg(trace_ctx, "\tCurrPic.flags = %d\n", p->CurrPic.flags);
1527 va_TraceMsg(trace_ctx, "\tCurrPic.TopFieldOrderCnt = %d\n", p->CurrPic.TopFieldOrderCnt);
1528 va_TraceMsg(trace_ctx, "\tCurrPic.BottomFieldOrderCnt = %d\n", p->CurrPic.BottomFieldOrderCnt);
1529 va_TraceMsg(trace_ctx, "\tReferenceFrames (TopFieldOrderCnt-BottomFieldOrderCnt-picture_id-frame_idx-flags):\n");
1530 for (i = 0; i < 16; i++)
1532 if ((p->ReferenceFrames[i].picture_id != VA_INVALID_SURFACE) &&
1533 ((p->ReferenceFrames[i].flags & VA_PICTURE_H264_INVALID) == 0)) {
1534 va_TraceMsg(trace_ctx, "\t\t%08d-%08d-0x%08x-%08d-0x%08x\n",
1535 p->ReferenceFrames[i].TopFieldOrderCnt,
1536 p->ReferenceFrames[i].BottomFieldOrderCnt,
1537 p->ReferenceFrames[i].picture_id,
1538 p->ReferenceFrames[i].frame_idx,
1539 p->ReferenceFrames[i].flags
1544 va_TraceMsg(trace_ctx, "\tcoded_buf = %08x\n", p->coded_buf);
1545 va_TraceMsg(trace_ctx, "\tpic_parameter_set_id = %d\n", p->pic_parameter_set_id);
1546 va_TraceMsg(trace_ctx, "\tseq_parameter_set_id = %d\n", p->seq_parameter_set_id);
1547 va_TraceMsg(trace_ctx, "\tlast_picture = 0x%08x\n", p->last_picture);
1548 va_TraceMsg(trace_ctx, "\tframe_num = %d\n", p->frame_num);
1549 va_TraceMsg(trace_ctx, "\tpic_init_qp = %d\n", p->pic_init_qp);
1550 va_TraceMsg(trace_ctx, "\tnum_ref_idx_l0_active_minus1 = %d\n", p->num_ref_idx_l0_active_minus1);
1551 va_TraceMsg(trace_ctx, "\tnum_ref_idx_l1_active_minus1 = %d\n", p->num_ref_idx_l1_active_minus1);
1552 va_TraceMsg(trace_ctx, "\tchroma_qp_index_offset = %d\n", p->chroma_qp_index_offset);
1553 va_TraceMsg(trace_ctx, "\tsecond_chroma_qp_index_offset = %d\n", p->second_chroma_qp_index_offset);
1554 va_TraceMsg(trace_ctx, "\tpic_fields = 0x%03x\n", p->pic_fields.value);
1555 va_TraceMsg(trace_ctx, "\tidr_pic_flag = %d\n", p->pic_fields.bits.idr_pic_flag);
1556 va_TraceMsg(trace_ctx, "\treference_pic_flag = %d\n", p->pic_fields.bits.reference_pic_flag);
1557 va_TraceMsg(trace_ctx, "\tentropy_coding_mode_flag = %d\n", p->pic_fields.bits.entropy_coding_mode_flag);
1558 va_TraceMsg(trace_ctx, "\tweighted_pred_flag = %d\n", p->pic_fields.bits.weighted_pred_flag);
1559 va_TraceMsg(trace_ctx, "\tweighted_bipred_idc = %d\n", p->pic_fields.bits.weighted_bipred_idc);
1560 va_TraceMsg(trace_ctx, "\tconstrained_intra_pred_flag = %d\n", p->pic_fields.bits.constrained_intra_pred_flag);
1561 va_TraceMsg(trace_ctx, "\ttransform_8x8_mode_flag = %d\n", p->pic_fields.bits.transform_8x8_mode_flag);
1562 va_TraceMsg(trace_ctx, "\tdeblocking_filter_control_present_flag = %d\n", p->pic_fields.bits.deblocking_filter_control_present_flag);
1563 va_TraceMsg(trace_ctx, "\tredundant_pic_cnt_present_flag = %d\n", p->pic_fields.bits.redundant_pic_cnt_present_flag);
1564 va_TraceMsg(trace_ctx, "\tpic_order_present_flag = %d\n", p->pic_fields.bits.pic_order_present_flag);
1565 va_TraceMsg(trace_ctx, "\tpic_scaling_matrix_present_flag = %d\n", p->pic_fields.bits.pic_scaling_matrix_present_flag);
1567 va_TraceMsg(trace_ctx, NULL);
1569 trace_ctx->trace_codedbuf = p->coded_buf;
1574 static void va_TraceVAEncSliceParameterBuffer(
1576 VAContextID context,
1580 unsigned int num_elements,
1583 VAEncSliceParameterBuffer* p = (VAEncSliceParameterBuffer*)data;
1586 va_TraceMsg(trace_ctx, "\t--VAEncSliceParameterBuffer\n");
1588 va_TraceMsg(trace_ctx, "\tstart_row_number = %d\n", p->start_row_number);
1589 va_TraceMsg(trace_ctx, "\tslice_height = %d\n", p->slice_height);
1590 va_TraceMsg(trace_ctx, "\tslice_flags.is_intra = %d\n", p->slice_flags.bits.is_intra);
1591 va_TraceMsg(trace_ctx, "\tslice_flags.disable_deblocking_filter_idc = %d\n", p->slice_flags.bits.disable_deblocking_filter_idc);
1592 va_TraceMsg(trace_ctx, "\tslice_flags.uses_long_term_ref = %d\n", p->slice_flags.bits.uses_long_term_ref);
1593 va_TraceMsg(trace_ctx, "\tslice_flags.is_long_term_ref = %d\n", p->slice_flags.bits.is_long_term_ref);
1594 va_TraceMsg(trace_ctx, NULL);
1599 static void va_TraceVAEncSliceParameterBufferH264(
1601 VAContextID context,
1605 unsigned int num_elements,
1608 VAEncSliceParameterBufferH264* p = (VAEncSliceParameterBufferH264*)data;
1615 va_TraceMsg(trace_ctx, "\t--VAEncSliceParameterBufferH264\n");
1616 va_TraceMsg(trace_ctx, "\tmacroblock_address = %d\n", p->macroblock_address);
1617 va_TraceMsg(trace_ctx, "\tnum_macroblocks = %d\n", p->num_macroblocks);
1618 va_TraceMsg(trace_ctx, "\tmacroblock_info = %08x\n", p->macroblock_info);
1619 va_TraceMsg(trace_ctx, "\tslice_type = %d\n", p->slice_type);
1620 va_TraceMsg(trace_ctx, "\tpic_parameter_set_id = %d\n", p->pic_parameter_set_id);
1621 va_TraceMsg(trace_ctx, "\tidr_pic_id = %d\n", p->idr_pic_id);
1622 va_TraceMsg(trace_ctx, "\tpic_order_cnt_lsb = %d\n", p->pic_order_cnt_lsb);
1623 va_TraceMsg(trace_ctx, "\tdelta_pic_order_cnt_bottom = %d\n", p->delta_pic_order_cnt_bottom);
1624 va_TraceMsg(trace_ctx, "\tdelta_pic_order_cnt[0] = %d\n", p->delta_pic_order_cnt[0]);
1625 va_TraceMsg(trace_ctx, "\tdelta_pic_order_cnt[1] = %d\n", p->delta_pic_order_cnt[1]);
1626 va_TraceMsg(trace_ctx, "\tdirect_spatial_mv_pred_flag = %d\n", p->direct_spatial_mv_pred_flag);
1627 va_TraceMsg(trace_ctx, "\tnum_ref_idx_active_override_flag = %d\n", p->num_ref_idx_active_override_flag);
1628 va_TraceMsg(trace_ctx, "\tnum_ref_idx_l1_active_minus1 = %d\n", p->num_ref_idx_l1_active_minus1);
1629 va_TraceMsg(trace_ctx, "\tslice_beta_offset_div2 = %d\n", p->slice_beta_offset_div2);
1631 va_TraceMsg(trace_ctx, "\tRefPicList0 (TopFieldOrderCnt-BottomFieldOrderCnt-picture_id-frame_idx-flags):\n");
1635 for (i = 0; i < 32; i++) {
1636 if ((p->RefPicList0[i].picture_id != VA_INVALID_SURFACE) &&
1637 ((p->RefPicList0[i].flags & VA_PICTURE_H264_INVALID) == 0))
1638 va_TraceMsg(trace_ctx, "\t\t%08d-%08d-0x%08x-%08d-0x%08x\n",
1639 p->RefPicList0[i].TopFieldOrderCnt,
1640 p->RefPicList0[i].BottomFieldOrderCnt,
1641 p->RefPicList0[i].picture_id,
1642 p->RefPicList0[i].frame_idx,
1643 p->RefPicList0[i].flags);
1648 va_TraceMsg(trace_ctx, "\tRefPicList1 (TopFieldOrderCnt-BottomFieldOrderCnt-picture_id-frame_idx-flags):\n");
1649 for (i = 0; i < 32; i++) {
1650 if ((p->RefPicList1[i].picture_id != VA_INVALID_SURFACE) &&
1651 ((p->RefPicList1[i].flags & VA_PICTURE_H264_INVALID) == 0))
1652 va_TraceMsg(trace_ctx, "\t\t%08d-%08d-0x%08x-%08d-0x%08d\n",
1653 p->RefPicList1[i].TopFieldOrderCnt,
1654 p->RefPicList1[i].BottomFieldOrderCnt,
1655 p->RefPicList1[i].picture_id,
1656 p->RefPicList1[i].frame_idx,
1657 p->RefPicList1[i].flags
1663 va_TraceMsg(trace_ctx, "\tluma_log2_weight_denom = %d\n", p->luma_log2_weight_denom);
1664 va_TraceMsg(trace_ctx, "\tchroma_log2_weight_denom = %d\n", p->chroma_log2_weight_denom);
1665 va_TraceMsg(trace_ctx, "\tluma_weight_l0_flag = %d\n", p->luma_weight_l0_flag);
1666 if (p->luma_weight_l0_flag) {
1667 for (i = 0; (i <= p->num_ref_idx_l0_active_minus1) && (i<32); i++) {
1668 va_TraceMsg(trace_ctx, "\t\t%d\t%d\n",
1669 p->luma_weight_l0[i],
1670 p->luma_offset_l0[i]);
1674 va_TraceMsg(trace_ctx, "\tchroma_weight_l0_flag = %d\n", p->chroma_weight_l0_flag);
1675 if (p->chroma_weight_l0_flag) {
1676 for (i = 0; (i <= p->num_ref_idx_l0_active_minus1) && (i<32); i++) {
1677 va_TraceMsg(trace_ctx, "\t\t%d\t%d\t%d\t%d\n",
1678 p->chroma_weight_l0[i][0],
1679 p->chroma_offset_l0[i][0],
1680 p->chroma_weight_l0[i][1],
1681 p->chroma_offset_l0[i][1]);
1685 va_TraceMsg(trace_ctx, "\tluma_weight_l1_flag = %d\n", p->luma_weight_l1_flag);
1686 if (p->luma_weight_l1_flag) {
1687 for (i = 0; (i <= p->num_ref_idx_l1_active_minus1) && (i<32); i++) {
1688 va_TraceMsg(trace_ctx, "\t\t%d\t\t%d\n",
1689 p->luma_weight_l1[i],
1690 p->luma_offset_l1[i]);
1694 va_TraceMsg(trace_ctx, "\tchroma_weight_l1_flag = %d\n", p->chroma_weight_l1_flag);
1695 if (p->chroma_weight_l1_flag && p->num_ref_idx_l1_active_minus1 < 32) {
1696 for (i = 0; (i <= p->num_ref_idx_l1_active_minus1) && (i<32); i++) {
1697 va_TraceMsg(trace_ctx, "\t\t%d\t%d\t%d\t%d\n",
1698 p->chroma_weight_l1[i][0],
1699 p->chroma_offset_l1[i][0],
1700 p->chroma_weight_l1[i][1],
1701 p->chroma_offset_l1[i][1]);
1704 va_TraceMsg(trace_ctx, NULL);
1706 va_TraceMsg(trace_ctx, "\tcabac_init_idc = %d\n", p->cabac_init_idc);
1707 va_TraceMsg(trace_ctx, "\tslice_qp_delta = %d\n", p->slice_qp_delta);
1708 va_TraceMsg(trace_ctx, "\tdisable_deblocking_filter_idc = %d\n", p->disable_deblocking_filter_idc);
1709 va_TraceMsg(trace_ctx, "\tslice_alpha_c0_offset_div2 = %d\n", p->slice_alpha_c0_offset_div2);
1710 va_TraceMsg(trace_ctx, "\tslice_beta_offset_div2 = %d\n", p->slice_beta_offset_div2);
1711 va_TraceMsg(trace_ctx, NULL);
1717 static void va_TraceVAEncPackedHeaderParameterBufferType(
1719 VAContextID context,
1723 unsigned int num_elements,
1726 VAEncPackedHeaderParameterBuffer* p = (VAEncPackedHeaderParameterBuffer*)data;
1732 va_TraceMsg(trace_ctx, "\t--VAEncPackedHeaderParameterBuffer\n");
1733 va_TraceMsg(trace_ctx, "\ttype = 0x%08x\n", p->type);
1734 va_TraceMsg(trace_ctx, "\tbit_length = %d\n", p->bit_length);
1735 va_TraceMsg(trace_ctx, "\thas_emulation_bytes = %d\n", p->has_emulation_bytes);
1736 va_TraceMsg(trace_ctx, NULL);
1741 static void va_TraceVAEncMiscParameterBuffer(
1743 VAContextID context,
1747 unsigned int num_elements,
1750 VAEncMiscParameterBuffer* tmp = (VAEncMiscParameterBuffer*)data;
1753 switch (tmp->type) {
1754 case VAEncMiscParameterTypeFrameRate:
1756 VAEncMiscParameterFrameRate *p = (VAEncMiscParameterFrameRate *)tmp->data;
1757 va_TraceMsg(trace_ctx, "\t--VAEncMiscParameterFrameRate\n");
1758 va_TraceMsg(trace_ctx, "\tframerate = %d\n", p->framerate);
1762 case VAEncMiscParameterTypeRateControl:
1764 VAEncMiscParameterRateControl *p = (VAEncMiscParameterRateControl *)tmp->data;
1766 va_TraceMsg(trace_ctx, "\t--VAEncMiscParameterRateControl\n");
1767 va_TraceMsg(trace_ctx, "\tbits_per_second = %d\n", p->bits_per_second);
1768 va_TraceMsg(trace_ctx, "\ttarget_percentage = %d\n", p->target_percentage);
1769 va_TraceMsg(trace_ctx, "\twindow_size = %d\n", p->window_size);
1770 va_TraceMsg(trace_ctx, "\tinitial_qp = %d\n", p->initial_qp);
1771 va_TraceMsg(trace_ctx, "\tmin_qp = %d\n", p->min_qp);
1772 va_TraceMsg(trace_ctx, "\tbasic_unit_size = %d\n", p->basic_unit_size);
1773 va_TraceMsg(trace_ctx, "\trc_flags.reset = %d \n", p->rc_flags.bits.reset);
1774 va_TraceMsg(trace_ctx, "\trc_flags.disable_frame_skip = %d\n", p->rc_flags.bits.disable_frame_skip);
1775 va_TraceMsg(trace_ctx, "\trc_flags.disable_bit_stuffing = %d\n", p->rc_flags.bits.disable_bit_stuffing);
1778 case VAEncMiscParameterTypeMaxSliceSize:
1780 VAEncMiscParameterMaxSliceSize *p = (VAEncMiscParameterMaxSliceSize *)tmp->data;
1782 va_TraceMsg(trace_ctx, "\t--VAEncMiscParameterTypeMaxSliceSize\n");
1783 va_TraceMsg(trace_ctx, "\tmax_slice_size = %d\n", p->max_slice_size);
1786 case VAEncMiscParameterTypeAIR:
1788 VAEncMiscParameterAIR *p = (VAEncMiscParameterAIR *)tmp->data;
1790 va_TraceMsg(trace_ctx, "\t--VAEncMiscParameterAIR\n");
1791 va_TraceMsg(trace_ctx, "\tair_num_mbs = %d\n", p->air_num_mbs);
1792 va_TraceMsg(trace_ctx, "\tair_threshold = %d\n", p->air_threshold);
1793 va_TraceMsg(trace_ctx, "\tair_auto = %d\n", p->air_auto);
1796 case VAEncMiscParameterTypeHRD:
1798 VAEncMiscParameterHRD *p = (VAEncMiscParameterHRD *)tmp->data;
1800 va_TraceMsg(trace_ctx, "\t--VAEncMiscParameterHRD\n");
1801 va_TraceMsg(trace_ctx, "\tinitial_buffer_fullness = %d\n", p->initial_buffer_fullness);
1802 va_TraceMsg(trace_ctx, "\tbuffer_size = %d\n", p->buffer_size);
1806 va_TraceMsg(trace_ctx, "Unknown VAEncMiscParameterBuffer(type = %d):\n", tmp->type);
1807 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, data);
1810 va_TraceMsg(trace_ctx, NULL);
1816 static void va_TraceVAPictureParameterBufferVC1(
1818 VAContextID context,
1822 unsigned int num_elements,
1826 VAPictureParameterBufferVC1* p = (VAPictureParameterBufferVC1*)data;
1829 va_TraceMsg(trace_ctx, "\t--VAPictureParameterBufferVC1\n");
1831 va_TraceMsg(trace_ctx, "\tforward_reference_picture = 0x%08x\n", p->forward_reference_picture);
1832 va_TraceMsg(trace_ctx, "\tbackward_reference_picture = 0x%08x\n", p->backward_reference_picture);
1833 va_TraceMsg(trace_ctx, "\tinloop_decoded_picture = 0x%08x\n", p->inloop_decoded_picture);
1835 va_TraceMsg(trace_ctx, "\tpulldown = %d\n", p->sequence_fields.bits.pulldown);
1836 va_TraceMsg(trace_ctx, "\tinterlace = %d\n", p->sequence_fields.bits.interlace);
1837 va_TraceMsg(trace_ctx, "\ttfcntrflag = %d\n", p->sequence_fields.bits.tfcntrflag);
1838 va_TraceMsg(trace_ctx, "\tfinterpflag = %d\n", p->sequence_fields.bits.finterpflag);
1839 va_TraceMsg(trace_ctx, "\tpsf = %d\n", p->sequence_fields.bits.psf);
1840 va_TraceMsg(trace_ctx, "\tmultires = %d\n", p->sequence_fields.bits.multires);
1841 va_TraceMsg(trace_ctx, "\toverlap = %d\n", p->sequence_fields.bits.overlap);
1842 va_TraceMsg(trace_ctx, "\tsyncmarker = %d\n", p->sequence_fields.bits.syncmarker);
1843 va_TraceMsg(trace_ctx, "\trangered = %d\n", p->sequence_fields.bits.rangered);
1844 va_TraceMsg(trace_ctx, "\tmax_b_frames = %d\n", p->sequence_fields.bits.max_b_frames);
1845 va_TraceMsg(trace_ctx, "\tprofile = %d\n", p->sequence_fields.bits.profile);
1846 va_TraceMsg(trace_ctx, "\tcoded_width = %d\n", p->coded_width);
1847 va_TraceMsg(trace_ctx, "\tcoded_height = %d\n", p->coded_height);
1848 va_TraceMsg(trace_ctx, "\tclosed_entry = %d\n", p->entrypoint_fields.bits.closed_entry);
1849 va_TraceMsg(trace_ctx, "\tbroken_link = %d\n", p->entrypoint_fields.bits.broken_link);
1850 va_TraceMsg(trace_ctx, "\tclosed_entry = %d\n", p->entrypoint_fields.bits.closed_entry);
1851 va_TraceMsg(trace_ctx, "\tpanscan_flag = %d\n", p->entrypoint_fields.bits.panscan_flag);
1852 va_TraceMsg(trace_ctx, "\tloopfilter = %d\n", p->entrypoint_fields.bits.loopfilter);
1853 va_TraceMsg(trace_ctx, "\tconditional_overlap_flag = %d\n", p->conditional_overlap_flag);
1854 va_TraceMsg(trace_ctx, "\tfast_uvmc_flag = %d\n", p->fast_uvmc_flag);
1855 va_TraceMsg(trace_ctx, "\trange_mapping_luma_flag = %d\n", p->range_mapping_fields.bits.luma_flag);
1856 va_TraceMsg(trace_ctx, "\trange_mapping_luma = %d\n", p->range_mapping_fields.bits.luma);
1857 va_TraceMsg(trace_ctx, "\trange_mapping_chroma_flag = %d\n", p->range_mapping_fields.bits.chroma_flag);
1858 va_TraceMsg(trace_ctx, "\trange_mapping_chroma = %d\n", p->range_mapping_fields.bits.chroma);
1859 va_TraceMsg(trace_ctx, "\tb_picture_fraction = %d\n", p->b_picture_fraction);
1860 va_TraceMsg(trace_ctx, "\tcbp_table = %d\n", p->cbp_table);
1861 va_TraceMsg(trace_ctx, "\tmb_mode_table = %d\n", p->mb_mode_table);
1862 va_TraceMsg(trace_ctx, "\trange_reduction_frame = %d\n", p->range_reduction_frame);
1863 va_TraceMsg(trace_ctx, "\trounding_control = %d\n", p->rounding_control);
1864 va_TraceMsg(trace_ctx, "\tpost_processing = %d\n", p->post_processing);
1865 va_TraceMsg(trace_ctx, "\tpicture_resolution_index = %d\n", p->picture_resolution_index);
1866 va_TraceMsg(trace_ctx, "\tluma_scale = %d\n", p->luma_scale);
1867 va_TraceMsg(trace_ctx, "\tluma_shift = %d\n", p->luma_shift);
1868 va_TraceMsg(trace_ctx, "\tpicture_type = %d\n", p->picture_fields.bits.picture_type);
1869 va_TraceMsg(trace_ctx, "\tframe_coding_mode = %d\n", p->picture_fields.bits.frame_coding_mode);
1870 va_TraceMsg(trace_ctx, "\ttop_field_first = %d\n", p->picture_fields.bits.top_field_first);
1871 va_TraceMsg(trace_ctx, "\tis_first_field = %d\n", p->picture_fields.bits.is_first_field);
1872 va_TraceMsg(trace_ctx, "\tintensity_compensation = %d\n", p->picture_fields.bits.intensity_compensation);
1873 va_TraceMsg(trace_ctx, "\tmv_type_mb = %d\n", p->raw_coding.flags.mv_type_mb);
1874 va_TraceMsg(trace_ctx, "\tdirect_mb = %d\n", p->raw_coding.flags.direct_mb);
1875 va_TraceMsg(trace_ctx, "\tskip_mb = %d\n", p->raw_coding.flags.skip_mb);
1876 va_TraceMsg(trace_ctx, "\tfield_tx = %d\n", p->raw_coding.flags.field_tx);
1877 va_TraceMsg(trace_ctx, "\tforward_mb = %d\n", p->raw_coding.flags.forward_mb);
1878 va_TraceMsg(trace_ctx, "\tac_pred = %d\n", p->raw_coding.flags.ac_pred);
1879 va_TraceMsg(trace_ctx, "\toverflags = %d\n", p->raw_coding.flags.overflags);
1880 va_TraceMsg(trace_ctx, "\tbp_mv_type_mb = %d\n", p->bitplane_present.flags.bp_mv_type_mb);
1881 va_TraceMsg(trace_ctx, "\tbp_direct_mb = %d\n", p->bitplane_present.flags.bp_direct_mb);
1882 va_TraceMsg(trace_ctx, "\tbp_skip_mb = %d\n", p->bitplane_present.flags.bp_skip_mb);
1883 va_TraceMsg(trace_ctx, "\tbp_field_tx = %d\n", p->bitplane_present.flags.bp_field_tx);
1884 va_TraceMsg(trace_ctx, "\tbp_forward_mb = %d\n", p->bitplane_present.flags.bp_forward_mb);
1885 va_TraceMsg(trace_ctx, "\tbp_ac_pred = %d\n", p->bitplane_present.flags.bp_ac_pred);
1886 va_TraceMsg(trace_ctx, "\tbp_overflags = %d\n", p->bitplane_present.flags.bp_overflags);
1887 va_TraceMsg(trace_ctx, "\treference_distance_flag = %d\n", p->reference_fields.bits.reference_distance_flag);
1888 va_TraceMsg(trace_ctx, "\treference_distance = %d\n", p->reference_fields.bits.reference_distance);
1889 va_TraceMsg(trace_ctx, "\tnum_reference_pictures = %d\n", p->reference_fields.bits.num_reference_pictures);
1890 va_TraceMsg(trace_ctx, "\treference_field_pic_indicator = %d\n", p->reference_fields.bits.reference_field_pic_indicator);
1891 va_TraceMsg(trace_ctx, "\tmv_mode = %d\n", p->mv_fields.bits.mv_mode);
1892 va_TraceMsg(trace_ctx, "\tmv_mode2 = %d\n", p->mv_fields.bits.mv_mode2);
1893 va_TraceMsg(trace_ctx, "\tmv_table = %d\n", p->mv_fields.bits.mv_table);
1894 va_TraceMsg(trace_ctx, "\ttwo_mv_block_pattern_table = %d\n", p->mv_fields.bits.two_mv_block_pattern_table);
1895 va_TraceMsg(trace_ctx, "\tfour_mv_switch = %d\n", p->mv_fields.bits.four_mv_switch);
1896 va_TraceMsg(trace_ctx, "\tfour_mv_block_pattern_table = %d\n", p->mv_fields.bits.four_mv_block_pattern_table);
1897 va_TraceMsg(trace_ctx, "\textended_mv_flag = %d\n", p->mv_fields.bits.extended_mv_flag);
1898 va_TraceMsg(trace_ctx, "\textended_mv_range = %d\n", p->mv_fields.bits.extended_mv_range);
1899 va_TraceMsg(trace_ctx, "\textended_dmv_flag = %d\n", p->mv_fields.bits.extended_dmv_flag);
1900 va_TraceMsg(trace_ctx, "\textended_dmv_range = %d\n", p->mv_fields.bits.extended_dmv_range);
1901 va_TraceMsg(trace_ctx, "\tdquant = %d\n", p->pic_quantizer_fields.bits.dquant);
1902 va_TraceMsg(trace_ctx, "\tquantizer = %d\n", p->pic_quantizer_fields.bits.quantizer);
1903 va_TraceMsg(trace_ctx, "\thalf_qp = %d\n", p->pic_quantizer_fields.bits.half_qp);
1904 va_TraceMsg(trace_ctx, "\tpic_quantizer_scale = %d\n", p->pic_quantizer_fields.bits.pic_quantizer_scale);
1905 va_TraceMsg(trace_ctx, "\tpic_quantizer_type = %d\n", p->pic_quantizer_fields.bits.pic_quantizer_type);
1906 va_TraceMsg(trace_ctx, "\tdq_frame = %d\n", p->pic_quantizer_fields.bits.dq_frame);
1907 va_TraceMsg(trace_ctx, "\tdq_profile = %d\n", p->pic_quantizer_fields.bits.dq_profile);
1908 va_TraceMsg(trace_ctx, "\tdq_sb_edge = %d\n", p->pic_quantizer_fields.bits.dq_sb_edge);
1909 va_TraceMsg(trace_ctx, "\tdq_db_edge = %d\n", p->pic_quantizer_fields.bits.dq_db_edge);
1910 va_TraceMsg(trace_ctx, "\tdq_binary_level = %d\n", p->pic_quantizer_fields.bits.dq_binary_level);
1911 va_TraceMsg(trace_ctx, "\talt_pic_quantizer = %d\n", p->pic_quantizer_fields.bits.alt_pic_quantizer);
1912 va_TraceMsg(trace_ctx, "\tvariable_sized_transform_flag = %d\n", p->transform_fields.bits.variable_sized_transform_flag);
1913 va_TraceMsg(trace_ctx, "\tmb_level_transform_type_flag = %d\n", p->transform_fields.bits.mb_level_transform_type_flag);
1914 va_TraceMsg(trace_ctx, "\tframe_level_transform_type = %d\n", p->transform_fields.bits.frame_level_transform_type);
1915 va_TraceMsg(trace_ctx, "\ttransform_ac_codingset_idx1 = %d\n", p->transform_fields.bits.transform_ac_codingset_idx1);
1916 va_TraceMsg(trace_ctx, "\ttransform_ac_codingset_idx2 = %d\n", p->transform_fields.bits.transform_ac_codingset_idx2);
1917 va_TraceMsg(trace_ctx, "\tintra_transform_dc_table = %d\n", p->transform_fields.bits.intra_transform_dc_table);
1918 va_TraceMsg(trace_ctx, NULL);
1921 static void va_TraceVASliceParameterBufferVC1(
1923 VAContextID context,
1927 unsigned int num_elements,
1931 VASliceParameterBufferVC1 *p = (VASliceParameterBufferVC1*)data;
1934 trace_ctx->trace_slice_no++;
1935 trace_ctx->trace_slice_size = p->slice_data_size;
1937 va_TraceMsg(trace_ctx, "\t--VASliceParameterBufferVC1\n");
1938 va_TraceMsg(trace_ctx, "\tslice_data_size = %d\n", p->slice_data_size);
1939 va_TraceMsg(trace_ctx, "\tslice_data_offset = %d\n", p->slice_data_offset);
1940 va_TraceMsg(trace_ctx, "\tslice_data_flag = %d\n", p->slice_data_flag);
1941 va_TraceMsg(trace_ctx, "\tmacroblock_offset = %d\n", p->macroblock_offset);
1942 va_TraceMsg(trace_ctx, "\tslice_vertical_position = %d\n", p->slice_vertical_position);
1943 va_TraceMsg(trace_ctx, NULL);
1946 void va_TraceBeginPicture(
1948 VAContextID context,
1949 VASurfaceID render_target
1954 TRACE_FUNCNAME(idx);
1956 va_TraceMsg(trace_ctx, "\tcontext = 0x%08x\n", context);
1957 va_TraceMsg(trace_ctx, "\trender_targets = 0x%08x\n", render_target);
1958 va_TraceMsg(trace_ctx, "\tframe_count = #%d\n", trace_ctx->trace_frame_no);
1959 va_TraceMsg(trace_ctx, NULL);
1961 trace_ctx->trace_rendertarget = render_target; /* for surface data dump after vaEndPicture */
1963 trace_ctx->trace_frame_no++;
1964 trace_ctx->trace_slice_no = 0;
1967 static void va_TraceMPEG2Buf(
1969 VAContextID context,
1973 unsigned int num_elements,
1978 case VAPictureParameterBufferType:
1979 va_TraceVAPictureParameterBufferMPEG2(dpy, context, buffer, type, size, num_elements, pbuf);
1981 case VAIQMatrixBufferType:
1982 va_TraceVAIQMatrixBufferMPEG2(dpy, context, buffer, type, size, num_elements, pbuf);
1984 case VABitPlaneBufferType:
1985 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
1987 case VASliceGroupMapBufferType:
1988 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
1990 case VASliceParameterBufferType:
1991 va_TraceVASliceParameterBufferMPEG2(dpy, context, buffer, type, size, num_elements, pbuf);
1993 case VASliceDataBufferType:
1994 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
1996 case VAMacroblockParameterBufferType:
1997 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
1999 case VAResidualDataBufferType:
2000 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2002 case VADeblockingParameterBufferType:
2003 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2005 case VAImageBufferType:
2007 case VAProtectedSliceDataBufferType:
2008 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2010 case VAEncCodedBufferType:
2012 case VAEncSequenceParameterBufferType:
2014 case VAEncPictureParameterBufferType:
2016 case VAEncSliceParameterBufferType:
2023 static void va_TraceVAEncSequenceParameterBufferH263(
2025 VAContextID context,
2029 unsigned int num_elements,
2032 VAEncSequenceParameterBufferH263 *p = (VAEncSequenceParameterBufferH263 *)data;
2035 va_TraceMsg(trace_ctx, "\t--VAEncSequenceParameterBufferH263\n");
2037 va_TraceMsg(trace_ctx, "\tintra_period = %d\n", p->intra_period);
2038 va_TraceMsg(trace_ctx, "\tbits_per_second = %d\n", p->bits_per_second);
2039 va_TraceMsg(trace_ctx, "\tframe_rate = %d\n", p->frame_rate);
2040 va_TraceMsg(trace_ctx, "\tinitial_qp = %d\n", p->initial_qp);
2041 va_TraceMsg(trace_ctx, "\tmin_qp = %d\n", p->min_qp);
2042 va_TraceMsg(trace_ctx, NULL);
2044 /* start a new sequce, coded log file can be truncated */
2045 trace_ctx->trace_sequence_start = 1;
2051 static void va_TraceVAEncPictureParameterBufferH263(
2053 VAContextID context,
2057 unsigned int num_elements,
2060 VAEncPictureParameterBufferH263 *p = (VAEncPictureParameterBufferH263 *)data;
2063 va_TraceMsg(trace_ctx, "\t--VAEncPictureParameterBufferH263\n");
2064 va_TraceMsg(trace_ctx, "\treference_picture = 0x%08x\n", p->reference_picture);
2065 va_TraceMsg(trace_ctx, "\treconstructed_picture = 0x%08x\n", p->reconstructed_picture);
2066 va_TraceMsg(trace_ctx, "\tcoded_buf = %08x\n", p->coded_buf);
2067 va_TraceMsg(trace_ctx, "\tpicture_width = %d\n", p->picture_width);
2068 va_TraceMsg(trace_ctx, "\tpicture_height = %d\n", p->picture_height);
2069 va_TraceMsg(trace_ctx, "\tpicture_type = 0x%08x\n", p->picture_type);
2070 va_TraceMsg(trace_ctx, NULL);
2072 trace_ctx->trace_codedbuf = p->coded_buf;
2077 static void va_TraceVAEncPictureParameterBufferJPEG(
2079 VAContextID context,
2083 unsigned int num_elements,
2086 VAEncPictureParameterBufferJPEG *p = (VAEncPictureParameterBufferJPEG *)data;
2091 va_TraceMsg(trace_ctx, "\t--VAEncPictureParameterBufferJPEG\n");
2092 va_TraceMsg(trace_ctx, "\treconstructed_picture = 0x%08x\n", p->reconstructed_picture);
2093 va_TraceMsg(trace_ctx, "\tcoded_buf = %08x\n", p->coded_buf);
2094 va_TraceMsg(trace_ctx, "\tpicture_width = %d\n", p->picture_width);
2095 va_TraceMsg(trace_ctx, "\tpicture_height = %d\n", p->picture_height);
2097 va_TraceMsg(trace_ctx, NULL);
2099 trace_ctx->trace_codedbuf = p->coded_buf;
2104 static void va_TraceVAEncQMatrixBufferJPEG(
2106 VAContextID context,
2110 unsigned int num_elements,
2113 VAQMatrixBufferJPEG *p = (VAQMatrixBufferJPEG *)data;
2116 va_TraceMsg(trace_ctx, "\t--VAQMatrixBufferJPEG\n");
2117 va_TraceMsg(trace_ctx, "\tload_lum_quantiser_matrix = %d", p->load_lum_quantiser_matrix);
2118 if (p->load_lum_quantiser_matrix) {
2120 for (i = 0; i < 64; i++) {
2122 va_TraceMsg(trace_ctx, "\n\t");
2123 va_TraceMsg(trace_ctx, "\t0x%02x", p->lum_quantiser_matrix[i]);
2125 va_TraceMsg(trace_ctx, "\n");
2127 va_TraceMsg(trace_ctx, "\tload_chroma_quantiser_matrix = %08x\n", p->load_chroma_quantiser_matrix);
2128 if (p->load_chroma_quantiser_matrix) {
2130 for (i = 0; i < 64; i++) {
2132 va_TraceMsg(trace_ctx, "\n\t");
2133 va_TraceMsg(trace_ctx, "\t0x%02x", p->chroma_quantiser_matrix[i]);
2135 va_TraceMsg(trace_ctx, "\n");
2138 va_TraceMsg(trace_ctx, NULL);
2143 static void va_TraceH263Buf(
2145 VAContextID context,
2149 unsigned int num_elements,
2154 case VAPictureParameterBufferType:/* print MPEG4 buffer */
2155 va_TraceVAPictureParameterBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf);
2157 case VAIQMatrixBufferType:/* print MPEG4 buffer */
2158 va_TraceVAIQMatrixBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf);
2160 case VABitPlaneBufferType:/* print MPEG4 buffer */
2161 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2163 case VASliceGroupMapBufferType:
2165 case VASliceParameterBufferType:/* print MPEG4 buffer */
2166 va_TraceVASliceParameterBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf);
2168 case VASliceDataBufferType:
2169 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2171 case VAMacroblockParameterBufferType:
2172 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2174 case VAResidualDataBufferType:
2175 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2177 case VADeblockingParameterBufferType:
2178 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2180 case VAImageBufferType:
2182 case VAProtectedSliceDataBufferType:
2183 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2185 case VAEncCodedBufferType:
2187 case VAEncSequenceParameterBufferType:
2188 va_TraceVAEncSequenceParameterBufferH263(dpy, context, buffer, type, size, num_elements, pbuf);
2190 case VAEncPictureParameterBufferType:
2191 va_TraceVAEncPictureParameterBufferH263(dpy, context, buffer, type, size, num_elements, pbuf);
2193 case VAEncSliceParameterBufferType:
2194 va_TraceVAEncSliceParameterBuffer(dpy, context, buffer, type, size, num_elements, pbuf);
2196 case VAEncPackedHeaderParameterBufferType:
2197 va_TraceVAEncPackedHeaderParameterBufferType(dpy, context, buffer, type, size, num_elements, pbuf);
2200 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2206 static void va_TraceJPEGBuf(
2208 VAContextID context,
2212 unsigned int num_elements,
2217 case VABitPlaneBufferType:
2218 case VASliceGroupMapBufferType:
2219 case VASliceDataBufferType:
2220 case VAMacroblockParameterBufferType:
2221 case VAResidualDataBufferType:
2222 case VADeblockingParameterBufferType:
2223 case VAImageBufferType:
2224 case VAProtectedSliceDataBufferType:
2225 case VAEncCodedBufferType:
2226 case VAEncSequenceParameterBufferType:
2227 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2229 case VAEncSliceParameterBufferType:
2230 va_TraceVAEncPictureParameterBufferJPEG(dpy, context, buffer, type, size, num_elements, pbuf);
2232 case VAPictureParameterBufferType:
2233 va_TraceVAPictureParameterBufferJPEG(dpy, context, buffer, type, size, num_elements, pbuf);
2235 case VAIQMatrixBufferType:
2236 va_TraceVAIQMatrixBufferJPEG(dpy, context, buffer, type, size, num_elements, pbuf);
2238 case VASliceParameterBufferType:
2239 va_TraceVASliceParameterBufferJPEG(dpy, context, buffer, type, size, num_elements, pbuf);
2241 case VAHuffmanTableBufferType:
2242 va_TraceVAHuffmanTableBufferJPEG(dpy, context, buffer, type, size, num_elements, pbuf);
2244 case VAEncPictureParameterBufferType:
2245 va_TraceVAEncPictureParameterBufferJPEG(dpy, context, buffer, type, size, num_elements, pbuf);
2247 case VAQMatrixBufferType:
2248 va_TraceVAEncQMatrixBufferJPEG(dpy, context, buffer, type, size, num_elements, pbuf);
2251 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2256 static void va_TraceMPEG4Buf(
2258 VAContextID context,
2262 unsigned int num_elements,
2267 case VAPictureParameterBufferType:
2268 va_TraceVAPictureParameterBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf);
2270 case VAIQMatrixBufferType:
2271 va_TraceVAIQMatrixBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf);
2273 case VABitPlaneBufferType:
2274 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2276 case VASliceGroupMapBufferType:
2278 case VASliceParameterBufferType:
2279 va_TraceVASliceParameterBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf);
2281 case VASliceDataBufferType:
2282 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2284 case VAMacroblockParameterBufferType:
2285 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2287 case VAResidualDataBufferType:
2288 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2290 case VADeblockingParameterBufferType:
2291 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2293 case VAImageBufferType:
2295 case VAProtectedSliceDataBufferType:
2296 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2298 case VAEncCodedBufferType:
2300 case VAEncSequenceParameterBufferType:
2301 va_TraceVAEncSequenceParameterBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf);
2303 case VAEncPictureParameterBufferType:
2304 va_TraceVAEncPictureParameterBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf);
2306 case VAEncSliceParameterBufferType:
2307 va_TraceVAEncSliceParameterBuffer(dpy, context, buffer, type, size, num_elements, pbuf);
2310 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2316 static void va_TraceH264Buf(
2318 VAContextID context,
2322 unsigned int num_elements,
2329 case VAPictureParameterBufferType:
2330 va_TraceVAPictureParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
2332 case VAIQMatrixBufferType:
2333 va_TraceVAIQMatrixBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
2335 case VABitPlaneBufferType:
2336 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2338 case VASliceGroupMapBufferType:
2339 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2341 case VASliceParameterBufferType:
2342 va_TraceVASliceParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
2344 case VASliceDataBufferType:
2345 va_TraceVABuffers(dpy, context, buffer, type, trace_ctx->trace_slice_size, num_elements, pbuf);
2347 case VAMacroblockParameterBufferType:
2348 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2350 case VAResidualDataBufferType:
2351 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2353 case VADeblockingParameterBufferType:
2354 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2356 case VAImageBufferType:
2358 case VAProtectedSliceDataBufferType:
2359 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2361 case VAEncCodedBufferType:
2363 case VAEncSequenceParameterBufferType:
2364 va_TraceVAEncSequenceParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
2366 case VAEncPictureParameterBufferType:
2367 va_TraceVAEncPictureParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
2369 case VAEncSliceParameterBufferType:
2370 if (size == sizeof(VAEncSliceParameterBuffer))
2371 va_TraceVAEncSliceParameterBuffer(dpy, context, buffer, type, size, num_elements, pbuf);
2373 va_TraceVAEncSliceParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
2375 case VAEncPackedHeaderParameterBufferType:
2376 va_TraceVAEncPackedHeaderParameterBufferType(dpy, context, buffer, type, size, num_elements, pbuf);
2379 case VAEncMiscParameterBufferType:
2380 va_TraceVAEncMiscParameterBuffer(dpy, context, buffer, type, size, num_elements, pbuf);
2383 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2389 static void va_TraceVC1Buf(
2391 VAContextID context,
2395 unsigned int num_elements,
2402 case VAPictureParameterBufferType:
2403 va_TraceVAPictureParameterBufferVC1(dpy, context, buffer, type, size, num_elements, pbuf);
2405 case VAIQMatrixBufferType:
2407 case VABitPlaneBufferType:
2408 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2410 case VASliceGroupMapBufferType:
2411 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2413 case VASliceParameterBufferType:
2414 va_TraceVASliceParameterBufferVC1(dpy, context, buffer, type, size, num_elements, pbuf);
2416 case VASliceDataBufferType:
2417 va_TraceVABuffers(dpy, context, buffer, type, trace_ctx->trace_slice_size, num_elements, pbuf);
2419 case VAMacroblockParameterBufferType:
2420 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2422 case VAResidualDataBufferType:
2423 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2425 case VADeblockingParameterBufferType:
2426 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2428 case VAImageBufferType:
2430 case VAProtectedSliceDataBufferType:
2431 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2433 case VAEncCodedBufferType:
2435 case VAEncSequenceParameterBufferType:
2436 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2438 case VAEncPictureParameterBufferType:
2439 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2441 case VAEncSliceParameterBufferType:
2442 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2445 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2451 va_TraceProcFilterParameterBufferDeinterlacing(
2453 VAContextID context,
2454 VAProcFilterParameterBufferBase *base
2457 VAProcFilterParameterBufferDeinterlacing *deint = (VAProcFilterParameterBufferDeinterlacing *)base;
2461 va_TraceMsg(trace_ctx, "\t type = %d\n", deint->type);
2462 va_TraceMsg(trace_ctx, "\t algorithm = %d\n", deint->algorithm);
2463 va_TraceMsg(trace_ctx, "\t flags = %d\n", deint->flags);
2467 va_TraceProcFilterParameterBufferColorBalance(
2469 VAContextID context,
2470 VAProcFilterParameterBufferBase *base
2473 VAProcFilterParameterBufferColorBalance *color_balance = (VAProcFilterParameterBufferColorBalance *)base;
2477 va_TraceMsg(trace_ctx, "\t type = %d\n", color_balance->type);
2478 va_TraceMsg(trace_ctx, "\t attrib = %d\n", color_balance->attrib);
2479 va_TraceMsg(trace_ctx, "\t value = %f\n", color_balance->value);
2483 va_TraceProcFilterParameterBufferBase(
2485 VAContextID context,
2486 VAProcFilterParameterBufferBase *base
2491 va_TraceMsg(trace_ctx, "\t type = %d\n", base->type);
2495 va_TraceProcFilterParameterBuffer(
2497 VAContextID context,
2498 VABufferID *filters,
2499 unsigned int num_filters
2504 unsigned int num_elements;
2505 VAProcFilterParameterBufferBase *base_filter = NULL;
2510 if (num_filters == 0 || filters == NULL) {
2511 va_TraceMsg(trace_ctx, "\t num_filters = %d\n", num_filters);
2512 va_TraceMsg(trace_ctx, "\t filters = %p\n", filters);
2516 va_TraceMsg(trace_ctx, "\t num_filters = %d\n", num_filters);
2518 /* get buffer type information */
2519 for (i = 0; i < num_filters; i++) {
2520 vaBufferInfo(dpy, context, filters[i], &type, &size, &num_elements);
2522 if (type != VAProcFilterParameterBufferType) {
2523 va_TraceMsg(trace_ctx, "\t filters[%d] = 0x%08x (INVALID)\n", i, filters[i]);
2526 va_TraceMsg(trace_ctx, "\t filters[%d] = 0x%08x\n", i, filters[i]);
2530 vaMapBuffer(dpy, filters[i], (void **)&base_filter);
2532 if (base_filter == NULL) {
2533 vaUnmapBuffer(dpy, filters[i]);
2537 switch (base_filter->type) {
2538 case VAProcFilterDeinterlacing:
2539 va_TraceProcFilterParameterBufferDeinterlacing(dpy,
2543 case VAProcFilterColorBalance:
2544 va_TraceProcFilterParameterBufferColorBalance(dpy,
2549 va_TraceProcFilterParameterBufferBase(dpy,
2555 vaUnmapBuffer(dpy, filters[i]);
2560 va_TraceVAProcPipelineParameterBuffer(
2562 VAContextID context,
2566 unsigned int num_elements,
2570 VAProcPipelineParameterBuffer *p = (VAProcPipelineParameterBuffer *)data;
2575 va_TraceMsg(trace_ctx, "\t--VAProcPipelineParameterBuffer\n");
2577 va_TraceMsg(trace_ctx, "\t surface = 0x%08x\n", p->surface);
2579 if (p->surface_region) {
2580 va_TraceMsg(trace_ctx, "\t surface_region\n");
2581 va_TraceMsg(trace_ctx, "\t x = %d\n", p->surface_region->x);
2582 va_TraceMsg(trace_ctx, "\t y = %d\n", p->surface_region->y);
2583 va_TraceMsg(trace_ctx, "\t width = %d\n", p->surface_region->width);
2584 va_TraceMsg(trace_ctx, "\t height = %d\n", p->surface_region->height);
2586 va_TraceMsg(trace_ctx, "\t surface_region = (NULL)\n");
2589 va_TraceMsg(trace_ctx, "\t surface_color_standard = %d\n", p->surface_color_standard);
2591 if (p->output_region) {
2592 va_TraceMsg(trace_ctx, "\t output_region\n");
2593 va_TraceMsg(trace_ctx, "\t x = %d\n", p->output_region->x);
2594 va_TraceMsg(trace_ctx, "\t y = %d\n", p->output_region->y);
2595 va_TraceMsg(trace_ctx, "\t width = %d\n", p->output_region->width);
2596 va_TraceMsg(trace_ctx, "\t height = %d\n", p->output_region->height);
2598 va_TraceMsg(trace_ctx, "\t output_region = (NULL)\n");
2601 va_TraceMsg(trace_ctx, "\t output_background_color = 0x%08x\n", p->output_background_color);
2602 va_TraceMsg(trace_ctx, "\t output_color_standard = %d\n", p->output_color_standard);
2603 va_TraceMsg(trace_ctx, "\t pipeline_flags = 0x%08x\n", p->pipeline_flags);
2604 va_TraceMsg(trace_ctx, "\t filter_flags = 0x%08x\n", p->filter_flags);
2606 va_TraceProcFilterParameterBuffer(dpy, context, p->filters, p->num_filters);
2608 va_TraceMsg(trace_ctx, "\t num_forward_references = 0x%08x\n", p->num_forward_references);
2610 if (p->num_forward_references) {
2611 va_TraceMsg(trace_ctx, "\t forward_references\n");
2613 if (p->forward_references) {
2614 /* only dump the first 5 forward references */
2615 for (i = 0; i < p->num_forward_references && i < 5; i++) {
2616 va_TraceMsg(trace_ctx, "\t forward_references[%d] = 0x%08x\n", i, p->forward_references[i]);
2619 for (i = 0; i < p->num_forward_references && i < 5; i++) {
2620 va_TraceMsg(trace_ctx, "\t forward_references[%d] = (NULL)\n", i);
2625 va_TraceMsg(trace_ctx, "\t num_backward_references = 0x%08x\n", p->num_backward_references);
2627 if (p->num_backward_references) {
2628 va_TraceMsg(trace_ctx, "\t backward_references\n");
2630 if (p->backward_references) {
2631 /* only dump the first 5 backward references */
2632 for (i = 0; i < p->num_backward_references && i < 5; i++) {
2633 va_TraceMsg(trace_ctx, "\t backward_references[%d] = 0x%08x\n", i, p->backward_references[i]);
2636 for (i = 0; i < p->num_backward_references && i < 5; i++) {
2637 va_TraceMsg(trace_ctx, "\t backward_references[%d] = (NULL)\n", i);
2642 /* FIXME: add other info later */
2644 va_TraceMsg(trace_ctx, NULL);
2650 VAContextID context,
2654 unsigned int num_elements,
2661 case VAProcPipelineParameterBufferType:
2662 va_TraceVAProcPipelineParameterBuffer(dpy, context, buffer, type, size, num_elements, pbuf);
2665 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2670 void va_TraceRenderPicture(
2672 VAContextID context,
2673 VABufferID *buffers,
2679 unsigned int num_elements;
2683 TRACE_FUNCNAME(idx);
2685 va_TraceMsg(trace_ctx, "\tcontext = 0x%08x\n", context);
2686 va_TraceMsg(trace_ctx, "\tnum_buffers = %d\n", num_buffers);
2687 if (buffers == NULL)
2690 for (i = 0; i < num_buffers; i++) {
2691 unsigned char *pbuf = NULL;
2694 /* get buffer type information */
2695 vaBufferInfo(dpy, context, buffers[i], &type, &size, &num_elements);
2697 va_TraceMsg(trace_ctx, "\t---------------------------\n");
2698 va_TraceMsg(trace_ctx, "\tbuffers[%d] = 0x%08x\n", i, buffers[i]);
2699 va_TraceMsg(trace_ctx, "\t type = %s\n", buffer_type_to_string(type));
2700 va_TraceMsg(trace_ctx, "\t size = %d\n", size);
2701 va_TraceMsg(trace_ctx, "\t num_elements = %d\n", num_elements);
2703 vaMapBuffer(dpy, buffers[i], (void **)&pbuf);
2707 switch (trace_ctx->trace_profile) {
2708 case VAProfileMPEG2Simple:
2709 case VAProfileMPEG2Main:
2710 for (j=0; j<num_elements; j++) {
2711 va_TraceMsg(trace_ctx, "\telement[%d] =\n", j);
2712 va_TraceMPEG2Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
2715 case VAProfileMPEG4Simple:
2716 case VAProfileMPEG4AdvancedSimple:
2717 case VAProfileMPEG4Main:
2718 for (j=0; j<num_elements; j++) {
2719 va_TraceMsg(trace_ctx, "\telement[%d] =\n", j);
2720 va_TraceMPEG4Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
2723 case VAProfileH264Baseline:
2724 case VAProfileH264Main:
2725 case VAProfileH264High:
2726 case VAProfileH264ConstrainedBaseline:
2727 for (j=0; j<num_elements; j++) {
2728 va_TraceMsg(trace_ctx, "\telement[%d] =\n", j);
2730 va_TraceH264Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
2733 case VAProfileVC1Simple:
2734 case VAProfileVC1Main:
2735 case VAProfileVC1Advanced:
2736 for (j=0; j<num_elements; j++) {
2737 va_TraceMsg(trace_ctx, "\telement[%d] =\n", j);
2739 va_TraceVC1Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
2742 case VAProfileH263Baseline:
2743 for (j=0; j<num_elements; j++) {
2744 va_TraceMsg(trace_ctx, "\telement[%d] =\n", j);
2746 va_TraceH263Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
2749 case VAProfileJPEGBaseline:
2750 for (j=0; j<num_elements; j++) {
2751 va_TraceMsg(trace_ctx, "\telement[%d] =\n", j);
2753 va_TraceJPEGBuf (dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
2758 for (j=0; j<num_elements; j++) {
2759 va_TraceMsg(trace_ctx, "\telement[%d] = ", j);
2761 va_TraceNoneBuf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
2769 vaUnmapBuffer(dpy, buffers[i]);
2772 va_TraceMsg(trace_ctx, NULL);
2775 void va_TraceEndPicture(
2777 VAContextID context,
2781 int encode, decode, jpeg;
2784 TRACE_FUNCNAME(idx);
2786 va_TraceMsg(trace_ctx, "\tcontext = 0x%08x\n", context);
2787 va_TraceMsg(trace_ctx, "\trender_targets = 0x%08x\n", trace_ctx->trace_rendertarget);
2789 /* avoid to create so many empty files */
2790 encode = (trace_ctx->trace_entrypoint == VAEntrypointEncSlice);
2791 decode = (trace_ctx->trace_entrypoint == VAEntrypointVLD);
2792 jpeg = (trace_ctx->trace_entrypoint == VAEntrypointEncPicture);
2794 /* trace encode source surface, can do it before HW completes rendering */
2795 if ((encode && (trace_flag & VA_TRACE_FLAG_SURFACE_ENCODE))||
2796 (jpeg && (trace_flag & VA_TRACE_FLAG_SURFACE_JPEG)))
2797 va_TraceSurface(dpy);
2799 /* trace coded buffer, do it after HW completes rendering */
2800 if ((encode || jpeg) && (trace_flag & VA_TRACE_FLAG_CODEDBUF)) {
2801 vaSyncSurface(dpy, trace_ctx->trace_rendertarget);
2802 va_TraceCodedBuf(dpy);
2805 /* trace decoded surface, do it after HW completes rendering */
2806 if (decode && ((trace_flag & VA_TRACE_FLAG_SURFACE_DECODE))) {
2807 vaSyncSurface(dpy, trace_ctx->trace_rendertarget);
2808 va_TraceSurface(dpy);
2811 va_TraceMsg(trace_ctx, NULL);
2815 void va_TraceSyncSurface(
2817 VASurfaceID render_target
2822 TRACE_FUNCNAME(idx);
2824 va_TraceMsg(trace_ctx, "\trender_target = 0x%08x\n", render_target);
2825 va_TraceMsg(trace_ctx, NULL);
2828 void va_TraceQuerySurfaceAttributes(
2831 VASurfaceAttrib *attrib_list,
2832 unsigned int *num_attribs
2837 TRACE_FUNCNAME(idx);
2838 va_TraceMsg(trace_ctx, "\tconfig = 0x%08x\n", config);
2839 va_TraceSurfaceAttributes(trace_ctx, attrib_list, num_attribs);
2841 va_TraceMsg(trace_ctx, NULL);
2846 void va_TraceQuerySurfaceStatus(
2848 VASurfaceID render_target,
2849 VASurfaceStatus *status /* out */
2854 TRACE_FUNCNAME(idx);
2856 va_TraceMsg(trace_ctx, "\trender_target = 0x%08x\n", render_target);
2858 va_TraceMsg(trace_ctx, "\tstatus = 0x%08x\n", *status);
2859 va_TraceMsg(trace_ctx, NULL);
2863 void va_TraceQuerySurfaceError(
2865 VASurfaceID surface,
2866 VAStatus error_status,
2867 void **error_info /*out*/
2872 TRACE_FUNCNAME(idx);
2873 va_TraceMsg(trace_ctx, "\tsurface = 0x%08x\n", surface);
2874 va_TraceMsg(trace_ctx, "\terror_status = 0x%08x\n", error_status);
2875 if (error_info && (error_status == VA_STATUS_ERROR_DECODING_ERROR)) {
2876 VASurfaceDecodeMBErrors *p = *error_info;
2877 while (p && (p->status != -1)) {
2878 va_TraceMsg(trace_ctx, "\t\tstatus = %d\n", p->status);
2879 va_TraceMsg(trace_ctx, "\t\tstart_mb = %d\n", p->start_mb);
2880 va_TraceMsg(trace_ctx, "\t\tend_mb = %d\n", p->end_mb);
2881 p++; /* next error record */
2884 va_TraceMsg(trace_ctx, NULL);
2887 void va_TraceMaxNumDisplayAttributes (
2894 TRACE_FUNCNAME(idx);
2896 va_TraceMsg(trace_ctx, "\tmax_display_attributes = %d\n", number);
2897 va_TraceMsg(trace_ctx, NULL);
2900 void va_TraceQueryDisplayAttributes (
2902 VADisplayAttribute *attr_list, /* out */
2903 int *num_attributes /* out */
2910 if (attr_list == NULL || num_attributes == NULL)
2913 va_TraceMsg(trace_ctx, "\tnum_attributes = %d\n", *num_attributes);
2915 for (i=0; i<*num_attributes; i++) {
2916 va_TraceMsg(trace_ctx, "\tattr_list[%d] =\n");
2917 va_TraceMsg(trace_ctx, "\t typ = 0x%08x\n", attr_list[i].type);
2918 va_TraceMsg(trace_ctx, "\t min_value = %d\n", attr_list[i].min_value);
2919 va_TraceMsg(trace_ctx, "\t max_value = %d\n", attr_list[i].max_value);
2920 va_TraceMsg(trace_ctx, "\t value = %d\n", attr_list[i].value);
2921 va_TraceMsg(trace_ctx, "\t flags = %d\n", attr_list[i].flags);
2923 va_TraceMsg(trace_ctx, NULL);
2927 static void va_TraceDisplayAttributes (
2929 VADisplayAttribute *attr_list,
2937 va_TraceMsg(trace_ctx, "\tnum_attributes = %d\n", num_attributes);
2938 if (attr_list == NULL)
2941 for (i=0; i<num_attributes; i++) {
2942 va_TraceMsg(trace_ctx, "\tattr_list[%d] =\n");
2943 va_TraceMsg(trace_ctx, "\t typ = 0x%08x\n", attr_list[i].type);
2944 va_TraceMsg(trace_ctx, "\t min_value = %d\n", attr_list[i].min_value);
2945 va_TraceMsg(trace_ctx, "\t max_value = %d\n", attr_list[i].max_value);
2946 va_TraceMsg(trace_ctx, "\t value = %d\n", attr_list[i].value);
2947 va_TraceMsg(trace_ctx, "\t flags = %d\n", attr_list[i].flags);
2949 va_TraceMsg(trace_ctx, NULL);
2953 void va_TraceGetDisplayAttributes (
2955 VADisplayAttribute *attr_list,
2961 TRACE_FUNCNAME(idx);
2963 va_TraceDisplayAttributes (dpy, attr_list, num_attributes);
2966 void va_TraceSetDisplayAttributes (
2968 VADisplayAttribute *attr_list,
2974 TRACE_FUNCNAME(idx);
2976 va_TraceDisplayAttributes (dpy, attr_list, num_attributes);
2980 void va_TracePutSurface (
2982 VASurfaceID surface,
2983 void *draw, /* the target Drawable */
2986 unsigned short srcw,
2987 unsigned short srch,
2990 unsigned short destw,
2991 unsigned short desth,
2992 VARectangle *cliprects, /* client supplied clip list */
2993 unsigned int number_cliprects, /* number of clip rects in the clip list */
2994 unsigned int flags /* de-interlacing flags */
2999 TRACE_FUNCNAME(idx);
3001 va_TraceMsg(trace_ctx, "\tsurface = 0x%08x\n", surface);
3002 va_TraceMsg(trace_ctx, "\tdraw = 0x%08x\n", draw);
3003 va_TraceMsg(trace_ctx, "\tsrcx = %d\n", srcx);
3004 va_TraceMsg(trace_ctx, "\tsrcy = %d\n", srcy);
3005 va_TraceMsg(trace_ctx, "\tsrcw = %d\n", srcw);
3006 va_TraceMsg(trace_ctx, "\tsrch = %d\n", srch);
3007 va_TraceMsg(trace_ctx, "\tdestx = %d\n", destx);
3008 va_TraceMsg(trace_ctx, "\tdesty = %d\n", desty);
3009 va_TraceMsg(trace_ctx, "\tdestw = %d\n", destw);
3010 va_TraceMsg(trace_ctx, "\tdesth = %d\n", desth);
3011 va_TraceMsg(trace_ctx, "\tcliprects = 0x%08x\n", cliprects);
3012 va_TraceMsg(trace_ctx, "\tnumber_cliprects = %d\n", number_cliprects);
3013 va_TraceMsg(trace_ctx, "\tflags = 0x%08x\n", flags);
3014 va_TraceMsg(trace_ctx, NULL);