2 * Copyright (c) 2009-2011 Intel Corporation. All Rights Reserved.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sub license, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
12 * The above copyright notice and this permission notice (including the
13 * next paragraph) shall be included in all copies or substantial portions
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
19 * IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
20 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 #include "va_enc_h264.h"
28 #include "va_backend.h"
38 #include <sys/types.h>
45 * Env. to debug some issue, e.g. the decode/encode issue in a video conference scenerio:
46 * .LIBVA_TRACE=log_file: general VA parameters saved into log_file
47 * .LIBVA_TRACE_BUFDATA: dump VA buffer data into log_file (if not set, just calculate a checksum)
48 * .LIBVA_TRACE_CODEDBUF=coded_clip_file: save the coded clip into file coded_clip_file
49 * .LIBVA_TRACE_SURFACE=yuv_file: save surface YUV into file yuv_file. Use file name to determine
50 * decode/encode or jpeg surfaces
51 * .LIBVA_TRACE_LOGSIZE=numeric number: truncate the log_file or coded_clip_file, or decoded_yuv_file
52 * when the size is bigger than the number
60 /* LIBVA_TRACE_LOGSIZE */
61 static unsigned int trace_logsize = 0xffffffff; /* truncate the log when the size is bigger than it */
63 #define TRACE_CONTEXT_MAX 4
64 /* per context settings */
65 static struct _trace_context {
66 VADisplay dpy; /* should use context as the key */
69 FILE *trace_fp_log; /* save the log into a file */
70 char *trace_log_fn; /* file name */
72 /* LIBVA_TRACE_CODEDBUF */
73 FILE *trace_fp_codedbuf; /* save the encode result into a file */
74 char *trace_codedbuf_fn; /* file name */
76 /* LIBVA_TRACE_SURFACE */
77 FILE *trace_fp_surface; /* save the surface YUV into a file */
78 char *trace_surface_fn; /* file name */
80 VAContextID trace_context; /* current context */
82 VASurfaceID trace_rendertarget; /* current render target */
83 VAProfile trace_profile; /* current profile for buffers */
84 VAEntrypoint trace_entrypoint; /* current entrypoint */
85 VABufferID trace_codedbuf;
87 unsigned int trace_frame_no; /* current frame NO */
88 unsigned int trace_slice_no; /* current slice NO */
89 unsigned int trace_slice_size; /* current slice buffer size */
91 unsigned int trace_frame_width; /* current frame width */
92 unsigned int trace_frame_height; /* current frame height */
93 unsigned int trace_sequence_start; /* get a new sequence for encoding or not */
94 } trace_context[TRACE_CONTEXT_MAX]; /* trace five context at the same time */
96 #define DPY2INDEX(dpy) \
99 for (idx = 0; idx < TRACE_CONTEXT_MAX; idx++) \
100 if (trace_context[idx].dpy == dpy) \
103 if (idx == TRACE_CONTEXT_MAX) \
106 #define TRACE_FUNCNAME(idx) va_TraceMsg(idx, "==========%s\n", __func__);
108 /* Prototype declarations (functions defined in va.c) */
110 void va_errorMessage(const char *msg, ...);
111 void va_infoMessage(const char *msg, ...);
113 int va_parseConfig(char *env, char *env_value);
115 VAStatus vaBufferInfo(
117 VAContextID context, /* in */
118 VABufferID buf_id, /* in */
119 VABufferType *type, /* out */
120 unsigned int *size, /* out */
121 unsigned int *num_elements /* out */
124 VAStatus vaLockSurface(VADisplay dpy,
126 unsigned int *fourcc, /* following are output argument */
127 unsigned int *luma_stride,
128 unsigned int *chroma_u_stride,
129 unsigned int *chroma_v_stride,
130 unsigned int *luma_offset,
131 unsigned int *chroma_u_offset,
132 unsigned int *chroma_v_offset,
133 unsigned int *buffer_name,
137 VAStatus vaUnlockSurface(VADisplay dpy,
141 #define FILE_NAME_SUFFIX(env_value) \
143 int tmp = strnlen(env_value, sizeof(env_value)); \
144 int left = sizeof(env_value) - tmp; \
146 snprintf(env_value+tmp, \
153 void va_TraceInit(VADisplay dpy)
155 char env_value[1024];
156 unsigned short suffix = 0xffff & ((unsigned int)time(NULL));
160 for (trace_index = 0; trace_index < TRACE_CONTEXT_MAX; trace_index++)
161 if (trace_context[trace_index].dpy == 0)
164 if (trace_index == TRACE_CONTEXT_MAX)
167 memset(&trace_context[trace_index], 0, sizeof(struct _trace_context));
168 if (va_parseConfig("LIBVA_TRACE", &env_value[0]) == 0) {
169 FILE_NAME_SUFFIX(env_value);
170 trace_context[trace_index].trace_log_fn = strdup(env_value);
172 tmp = fopen(env_value, "w");
174 trace_context[trace_index].trace_fp_log = tmp;
175 va_infoMessage("LIBVA_TRACE is on, save log into %s\n", trace_context[trace_index].trace_log_fn);
176 trace_flag = VA_TRACE_FLAG_LOG;
178 va_errorMessage("Open file %s failed (%s)\n", env_value, strerror(errno));
181 /* may re-get the global settings for multiple context */
182 if (va_parseConfig("LIBVA_TRACE_LOGSIZE", &env_value[0]) == 0) {
183 trace_logsize = atoi(env_value);
184 va_infoMessage("LIBVA_TRACE_LOGSIZE is on, size is %d\n", trace_logsize);
187 if ((trace_flag & VA_TRACE_FLAG_LOG) && (va_parseConfig("LIBVA_TRACE_BUFDATA", NULL) == 0)) {
188 trace_flag |= VA_TRACE_FLAG_BUFDATA;
189 va_infoMessage("LIBVA_TRACE_BUFDATA is on, dump buffer into log file\n");
192 /* per-context setting */
193 if (va_parseConfig("LIBVA_TRACE_CODEDBUF", &env_value[0]) == 0) {
194 FILE_NAME_SUFFIX(env_value);
195 trace_context[trace_index].trace_codedbuf_fn = strdup(env_value);
196 va_infoMessage("LIBVA_TRACE_CODEDBUF is on, save codedbuf into log file %s\n",
197 trace_context[trace_index].trace_codedbuf_fn);
198 trace_flag |= VA_TRACE_FLAG_CODEDBUF;
201 if (va_parseConfig("LIBVA_TRACE_SURFACE", &env_value[0]) == 0) {
202 FILE_NAME_SUFFIX(env_value);
203 trace_context[trace_index].trace_surface_fn = strdup(env_value);
205 va_infoMessage("LIBVA_TRACE_SURFACE is on, save surface into %s\n",
206 trace_context[trace_index].trace_surface_fn);
208 /* for surface data dump, it is time-consume, and may
209 * cause some side-effect, so only trace the needed surfaces
210 * to trace encode surface, set the trace file name to sth like *enc*
211 * to trace decode surface, set the trace file name to sth like *dec*
212 * if no dec/enc in file name, set both
214 if (strstr(env_value, "dec"))
215 trace_flag |= VA_TRACE_FLAG_SURFACE_DECODE;
216 if (strstr(env_value, "enc"))
217 trace_flag |= VA_TRACE_FLAG_SURFACE_ENCODE;
218 if (strstr(env_value, "jpeg") || strstr(env_value, "jpg"))
219 trace_flag |= VA_TRACE_FLAG_SURFACE_JPEG;
222 trace_context[trace_index].dpy = dpy;
226 void va_TraceEnd(VADisplay dpy)
230 if (trace_context[idx].trace_fp_log)
231 fclose(trace_context[idx].trace_fp_log);
233 if (trace_context[idx].trace_fp_codedbuf)
234 fclose(trace_context[idx].trace_fp_codedbuf);
236 if (trace_context[idx].trace_fp_surface)
237 fclose(trace_context[idx].trace_fp_surface);
239 if (trace_context[idx].trace_log_fn)
240 free(trace_context[idx].trace_log_fn);
242 if (trace_context[idx].trace_codedbuf_fn)
243 free(trace_context[idx].trace_codedbuf_fn);
245 if (trace_context[idx].trace_surface_fn)
246 free(trace_context[idx].trace_surface_fn);
248 memset(&trace_context[idx], 0, sizeof(struct _trace_context));
252 static unsigned int file_size(FILE *fp)
256 fstat(fileno(fp), &buf);
262 static void truncate_file(FILE *fp)
264 ftruncate(fileno(fp), 0);
268 void va_TraceMsg(int idx, const char *msg, ...)
272 if (!(trace_flag & VA_TRACE_FLAG_LOG))
275 if (file_size(trace_context[idx].trace_fp_log) >= trace_logsize)
276 truncate_file(trace_context[idx].trace_fp_log);
279 vfprintf(trace_context[idx].trace_fp_log, msg, args);
282 fflush(trace_context[idx].trace_fp_log);
285 void va_TraceCodedBuf(VADisplay dpy)
287 VACodedBufferSegment *buf_list = NULL;
289 unsigned char check_sum = 0;
292 /* can only truncate at a sequence boudary */
293 if (((file_size(trace_context[idx].trace_fp_log) >= trace_logsize))
294 && trace_context[idx].trace_sequence_start) {
295 va_TraceMsg(idx, "==========truncate file %s\n", trace_context[idx].trace_codedbuf_fn);
296 truncate_file(trace_context[idx].trace_fp_log);
300 trace_context[idx].trace_sequence_start = 0; /* only truncate coded file when meet next new sequence */
302 va_status = vaMapBuffer(dpy, trace_context[idx].trace_codedbuf, (void **)(&buf_list));
303 if (va_status != VA_STATUS_SUCCESS)
306 va_TraceMsg(idx, "==========dump codedbuf into file %s\n", trace_context[idx].trace_codedbuf_fn);
308 while (buf_list != NULL) {
311 va_TraceMsg(idx, "\tsize = %d\n", buf_list->size);
312 if (trace_context[idx].trace_fp_codedbuf)
313 fwrite(buf_list->buf, buf_list->size, 1, trace_context[idx].trace_fp_codedbuf);
315 for (i=0; i<buf_list->size; i++)
316 check_sum ^= *((unsigned char *)buf_list->buf + i);
318 buf_list = buf_list->next;
320 vaUnmapBuffer(dpy,trace_context[idx].trace_codedbuf);
322 va_TraceMsg(idx, "\tchecksum = 0x%02x\n", check_sum);
323 va_TraceMsg(idx, NULL);
327 void va_TraceSurface(VADisplay dpy)
330 unsigned int fourcc; /* following are output argument */
331 unsigned int luma_stride;
332 unsigned int chroma_u_stride;
333 unsigned int chroma_v_stride;
334 unsigned int luma_offset;
335 unsigned int chroma_u_offset;
336 unsigned int chroma_v_offset;
337 unsigned int buffer_name;
339 unsigned char *Y_data, *UV_data, *tmp;
341 unsigned char check_sum = 0;
344 va_TraceMsg(idx, "==========dump surface data in file %s\n", trace_context[idx].trace_surface_fn);
346 if ((file_size(trace_context[idx].trace_fp_surface) >= trace_logsize)) {
347 va_TraceMsg(idx, "==========truncate file %s\n", trace_context[idx].trace_surface_fn);
348 truncate_file(trace_context[idx].trace_fp_surface);
350 va_TraceMsg(idx, NULL);
352 va_status = vaLockSurface(
354 trace_context[idx].trace_rendertarget,
356 &luma_stride, &chroma_u_stride, &chroma_v_stride,
357 &luma_offset, &chroma_u_offset, &chroma_v_offset,
358 &buffer_name, &buffer);
360 if (va_status != VA_STATUS_SUCCESS) {
361 va_TraceMsg(idx, "Error:vaLockSurface failed\n");
365 va_TraceMsg(idx, "\tfourcc = 0x%08x\n", fourcc);
366 va_TraceMsg(idx, "\twidth = %d\n", trace_context[idx].trace_frame_width);
367 va_TraceMsg(idx, "\theight = %d\n", trace_context[idx].trace_frame_height);
368 va_TraceMsg(idx, "\tluma_stride = %d\n", luma_stride);
369 va_TraceMsg(idx, "\tchroma_u_stride = %d\n", chroma_u_stride);
370 va_TraceMsg(idx, "\tchroma_v_stride = %d\n", chroma_v_stride);
371 va_TraceMsg(idx, "\tluma_offset = %d\n", luma_offset);
372 va_TraceMsg(idx, "\tchroma_u_offset = %d\n", chroma_u_offset);
373 va_TraceMsg(idx, "\tchroma_v_offset = %d\n", chroma_v_offset);
375 if (buffer == NULL) {
376 va_TraceMsg(idx, "Error:vaLockSurface return NULL buffer\n");
377 va_TraceMsg(idx, NULL);
379 vaUnlockSurface(dpy, trace_context[idx].trace_rendertarget);
382 va_TraceMsg(idx, "\tbuffer location = 0x%08x\n", buffer);
383 va_TraceMsg(idx, NULL);
385 Y_data = (unsigned char*)buffer;
386 UV_data = (unsigned char*)buffer + chroma_u_offset;
389 for (i=0; i<trace_context[idx].trace_frame_height; i++) {
390 if (trace_context[idx].trace_fp_surface)
391 fwrite(tmp, trace_context[idx].trace_frame_width, 1, trace_context[idx].trace_fp_surface);
393 tmp = Y_data + i * luma_stride;
396 if (fourcc == VA_FOURCC_NV12) {
397 for (i=0; i<trace_context[idx].trace_frame_height/2; i++) {
398 if (trace_context[idx].trace_fp_surface)
399 fwrite(tmp, trace_context[idx].trace_frame_width, 1, trace_context[idx].trace_fp_surface);
401 tmp = UV_data + i * chroma_u_stride;
405 vaUnlockSurface(dpy, trace_context[idx].trace_rendertarget);
407 va_TraceMsg(idx, NULL);
411 void va_TraceInitialize (
413 int *major_version, /* out */
414 int *minor_version /* out */
421 void va_TraceTerminate (
430 void va_TraceCreateConfig(
433 VAEntrypoint entrypoint,
434 VAConfigAttrib *attrib_list,
436 VAConfigID *config_id /* out */
440 int encode, decode, jpeg;
445 va_TraceMsg(idx, "\tprofile = %d\n", profile);
446 va_TraceMsg(idx, "\tentrypoint = %d\n", entrypoint);
447 va_TraceMsg(idx, "\tnum_attribs = %d\n", num_attribs);
448 for (i = 0; i < num_attribs; i++) {
449 va_TraceMsg(idx, "\t\tattrib_list[%d].type = 0x%08x\n", i, attrib_list[i].type);
450 va_TraceMsg(idx, "\t\tattrib_list[%d].value = 0x%08x\n", i, attrib_list[i].value);
452 va_TraceMsg(idx, NULL);
454 trace_context[idx].trace_profile = profile;
455 trace_context[idx].trace_entrypoint = entrypoint;
457 /* avoid to create so many empty files */
458 encode = (trace_context[idx].trace_entrypoint == VAEntrypointEncSlice);
459 decode = (trace_context[idx].trace_entrypoint == VAEntrypointVLD);
460 jpeg = (trace_context[idx].trace_entrypoint == VAEntrypointEncPicture);
461 if ((encode && (trace_flag & VA_TRACE_FLAG_SURFACE_ENCODE)) ||
462 (decode && (trace_flag & VA_TRACE_FLAG_SURFACE_DECODE)) ||
463 (jpeg && (trace_flag & VA_TRACE_FLAG_SURFACE_JPEG))) {
464 FILE *tmp = fopen(trace_context[idx].trace_surface_fn, "w");
467 trace_context[idx].trace_fp_surface = tmp;
469 va_errorMessage("Open file %s failed (%s)\n",
470 trace_context[idx].trace_surface_fn,
472 trace_context[idx].trace_fp_surface = NULL;
473 trace_flag &= ~(VA_TRACE_FLAG_SURFACE);
477 if (encode && (trace_flag & VA_TRACE_FLAG_CODEDBUF)) {
478 FILE *tmp = fopen(trace_context[idx].trace_codedbuf_fn, "w");
481 trace_context[idx].trace_fp_codedbuf = tmp;
483 va_errorMessage("Open file %s failed (%s)\n",
484 trace_context[idx].trace_codedbuf_fn,
486 trace_context[idx].trace_fp_codedbuf = NULL;
487 trace_flag &= ~VA_TRACE_FLAG_CODEDBUF;
493 void va_TraceCreateSurface(
499 VASurfaceID *surfaces /* out */
507 va_TraceMsg(idx, "\twidth = %d\n", width);
508 va_TraceMsg(idx, "\theight = %d\n", height);
509 va_TraceMsg(idx, "\tformat = %d\n", format);
510 va_TraceMsg(idx, "\tnum_surfaces = %d\n", num_surfaces);
512 for (i = 0; i < num_surfaces; i++)
513 va_TraceMsg(idx, "\t\tsurfaces[%d] = 0x%08x\n", i, surfaces[i]);
515 va_TraceMsg(idx, NULL);
519 void va_TraceCreateContext(
521 VAConfigID config_id,
525 VASurfaceID *render_targets,
526 int num_render_targets,
527 VAContextID *context /* out */
535 va_TraceMsg(idx, "\twidth = %d\n", picture_width);
536 va_TraceMsg(idx, "\theight = %d\n", picture_height);
537 va_TraceMsg(idx, "\tflag = 0x%08x\n", flag);
538 va_TraceMsg(idx, "\tnum_render_targets = %d\n", num_render_targets);
539 for (i=0; i<num_render_targets; i++)
540 va_TraceMsg(idx, "\t\trender_targets[%d] = 0x%08x\n", i, render_targets[i]);
541 va_TraceMsg(idx, "\tcontext = 0x%08x\n", *context);
542 va_TraceMsg(idx, NULL);
544 trace_context[idx].trace_context = *context;
546 trace_context[idx].trace_frame_no = 0;
547 trace_context[idx].trace_slice_no = 0;
549 trace_context[idx].trace_frame_width = picture_width;
550 trace_context[idx].trace_frame_height = picture_height;
554 static char * buffer_type_to_string(int type)
557 case VAPictureParameterBufferType: return "VAPictureParameterBufferType";
558 case VAIQMatrixBufferType: return "VAIQMatrixBufferType";
559 case VABitPlaneBufferType: return "VABitPlaneBufferType";
560 case VASliceGroupMapBufferType: return "VASliceGroupMapBufferType";
561 case VASliceParameterBufferType: return "VASliceParameterBufferType";
562 case VASliceDataBufferType: return "VASliceDataBufferType";
563 case VAProtectedSliceDataBufferType: return "VAProtectedSliceDataBufferType";
564 case VAMacroblockParameterBufferType: return "VAMacroblockParameterBufferType";
565 case VAResidualDataBufferType: return "VAResidualDataBufferType";
566 case VADeblockingParameterBufferType: return "VADeblockingParameterBufferType";
567 case VAImageBufferType: return "VAImageBufferType";
568 case VAEncCodedBufferType: return "VAEncCodedBufferType";
569 case VAEncSequenceParameterBufferType: return "VAEncSequenceParameterBufferType";
570 case VAEncPictureParameterBufferType: return "VAEncPictureParameterBufferType";
571 case VAEncSliceParameterBufferType: return "VAEncSliceParameterBufferType";
572 case VAEncMiscParameterBufferType: return "VAEncMiscParameterBufferType";
573 default: return "UnknowBuffer";
577 void va_TraceMapBuffer (
579 VABufferID buf_id, /* in */
580 void **pbuf /* out */
585 unsigned int num_elements;
587 VACodedBufferSegment *buf_list;
592 vaBufferInfo(dpy, trace_context[idx].trace_context, buf_id, &type, &size, &num_elements);
594 va_TraceMsg(idx, "\tbuf_id=0x%x\n", buf_id);
595 va_TraceMsg(idx, "\tbuf_type=%s\n", buffer_type_to_string(type));
596 va_TraceMsg(idx, "\tbuf_size=%s\n", size);
597 va_TraceMsg(idx, "\tbuf_elements=%s\n", &num_elements);
600 /* only trace CodedBuffer */
601 if (type != VAEncCodedBufferType)
604 buf_list = (VACodedBufferSegment *)(*pbuf);
605 while (buf_list != NULL) {
606 va_TraceMsg(idx, "\tCodedbuf[%d] =\n", i++);
608 va_TraceMsg(idx, "\t size = %d\n", buf_list->size);
609 va_TraceMsg(idx, "\t bit_offset = %d\n", buf_list->bit_offset);
610 va_TraceMsg(idx, "\t status = 0x%08x\n", buf_list->status);
611 va_TraceMsg(idx, "\t reserved = 0x%08x\n", buf_list->reserved);
612 va_TraceMsg(idx, "\t buf = 0x%08x\n", buf_list->buf);
614 buf_list = buf_list->next;
616 va_TraceMsg(idx, NULL);
619 static void va_TraceVABuffers(
625 unsigned int num_elements,
630 unsigned char *p = pbuf;
631 unsigned char check_sum = 0;
634 va_TraceMsg(idx, "%s\n", buffer_type_to_string(type));
636 for (i=0; i<size; i++) {
637 unsigned char value = p[i];
639 if ((trace_flag & VA_TRACE_FLAG_BUFDATA) && ((i%16) == 0))
640 va_TraceMsg(idx, "\n0x%08x:", i);
642 if (trace_flag & VA_TRACE_FLAG_BUFDATA)
643 va_TraceMsg(idx, " %02x", value);
648 va_TraceMsg(idx, "\tchecksum = 0x%02x\n", check_sum & 0xff);
649 va_TraceMsg(idx, NULL);
655 static void va_TraceVAPictureParameterBufferMPEG2(
661 unsigned int num_elements,
664 VAPictureParameterBufferMPEG2 *p=(VAPictureParameterBufferMPEG2 *)data;
667 va_TraceMsg(idx,"VAPictureParameterBufferMPEG2\n");
669 va_TraceMsg(idx,"\thorizontal size= %d\n", p->horizontal_size);
670 va_TraceMsg(idx,"\tvertical size= %d\n", p->vertical_size);
671 va_TraceMsg(idx,"\tforward reference picture= %d\n", p->forward_reference_picture);
672 va_TraceMsg(idx,"\tbackward reference picture= %d\n", p->backward_reference_picture);
673 va_TraceMsg(idx,"\tpicture coding type= %d\n", p->picture_coding_type);
674 va_TraceMsg(idx,"\tf mode= %d\n", p->f_code);
676 va_TraceMsg(idx,"\tpicture coding extension = %d\n", p->picture_coding_extension.value);
677 va_TraceMsg(idx,"\tintra_dc_precision= %d\n", p->picture_coding_extension.bits.intra_dc_precision);
678 va_TraceMsg(idx,"\tpicture_structure= %d\n", p->picture_coding_extension.bits.picture_structure);
679 va_TraceMsg(idx,"\ttop_field_first= %d\n", p->picture_coding_extension.bits.top_field_first);
680 va_TraceMsg(idx,"\tframe_pred_frame_dct= %d\n", p->picture_coding_extension.bits.frame_pred_frame_dct);
681 va_TraceMsg(idx,"\tconcealment_motion_vectors= %d\n", p->picture_coding_extension.bits.concealment_motion_vectors);
682 va_TraceMsg(idx,"\tq_scale_type= %d\n", p->picture_coding_extension.bits.q_scale_type);
683 va_TraceMsg(idx,"\tintra_vlc_format= %d\n", p->picture_coding_extension.bits.intra_vlc_format);
684 va_TraceMsg(idx,"\talternate_scan= %d\n", p->picture_coding_extension.bits.alternate_scan);
685 va_TraceMsg(idx,"\trepeat_first_field= %d\n", p->picture_coding_extension.bits.repeat_first_field);
686 va_TraceMsg(idx,"\tprogressive_frame= %d\n", p->picture_coding_extension.bits.progressive_frame);
687 va_TraceMsg(idx,"\tis_first_field= %d\n", p->picture_coding_extension.bits.is_first_field);
688 va_TraceMsg(idx, NULL);
694 static void va_TraceVAIQMatrixBufferMPEG2(
700 unsigned int num_elements,
703 VAIQMatrixBufferMPEG2 *p=(VAIQMatrixBufferMPEG2 *)data;
706 va_TraceMsg(idx,"VAIQMatrixBufferMPEG2\n");
708 va_TraceMsg(idx,"\tload_intra_quantiser_matrix = %d\n", p->load_intra_quantiser_matrix);
709 va_TraceMsg(idx,"\tload_non_intra_quantiser_matrix = %d\n", p->load_non_intra_quantiser_matrix);
710 va_TraceMsg(idx,"\tload_chroma_intra_quantiser_matrix = %d\n", p->load_chroma_intra_quantiser_matrix);
711 va_TraceMsg(idx,"\tload_chroma_non_intra_quantiser_matrix = %d\n", p->load_chroma_non_intra_quantiser_matrix);
712 va_TraceMsg(idx,"\tintra_quantiser_matrix = %d\n", p->intra_quantiser_matrix);
713 va_TraceMsg(idx,"\tnon_intra_quantiser_matrix = %d\n", p->non_intra_quantiser_matrix);
714 va_TraceMsg(idx,"\tchroma_intra_quantiser_matrix = %d\n", p->chroma_intra_quantiser_matrix);
715 va_TraceMsg(idx,"\tchroma_non_intra_quantiser_matrix = %d\n", p->chroma_non_intra_quantiser_matrix);
716 va_TraceMsg(idx, NULL);
722 static void va_TraceVASliceParameterBufferMPEG2(
728 unsigned int num_elements,
731 VASliceParameterBufferMPEG2 *p=(VASliceParameterBufferMPEG2 *)data;
735 trace_context[idx].trace_slice_no++;
737 trace_context[idx].trace_slice_size = p->slice_data_size;
739 va_TraceMsg(idx,"VASliceParameterBufferMPEG2\n");
741 va_TraceMsg(idx,"\tslice_data_size = %d\n", p->slice_data_size);
742 va_TraceMsg(idx,"\tslice_data_offset = %d\n", p->slice_data_offset);
743 va_TraceMsg(idx,"\tslice_data_flag = %d\n", p->slice_data_flag);
744 va_TraceMsg(idx,"\tmacroblock_offset = %d\n", p->macroblock_offset);
745 va_TraceMsg(idx,"\tslice_horizontal_position = %d\n", p->slice_horizontal_position);
746 va_TraceMsg(idx,"\tslice_vertical_position = %d\n", p->slice_vertical_position);
747 va_TraceMsg(idx,"\tquantiser_scale_code = %d\n", p->quantiser_scale_code);
748 va_TraceMsg(idx,"\tintra_slice_flag = %d\n", p->intra_slice_flag);
749 va_TraceMsg(idx, NULL);
755 static void va_TraceVAPictureParameterBufferMPEG4(
761 unsigned int num_elements,
765 VAPictureParameterBufferMPEG4 *p=(VAPictureParameterBufferMPEG4 *)data;
769 va_TraceMsg(idx,"*VAPictureParameterBufferMPEG4\n");
770 va_TraceMsg(idx,"\tvop_width = %d\n", p->vop_width);
771 va_TraceMsg(idx,"\tvop_height = %d\n", p->vop_height);
772 va_TraceMsg(idx,"\tforward_reference_picture = %d\n", p->forward_reference_picture);
773 va_TraceMsg(idx,"\tbackward_reference_picture = %d\n", p->backward_reference_picture);
774 va_TraceMsg(idx,"\tvol_fields value = %d\n", p->vol_fields.value);
775 va_TraceMsg(idx,"\tshort_video_header= %d\n", p->vol_fields.bits.short_video_header);
776 va_TraceMsg(idx,"\tchroma_format= %d\n", p->vol_fields.bits.chroma_format);
777 va_TraceMsg(idx,"\tinterlaced= %d\n", p->vol_fields.bits.interlaced);
778 va_TraceMsg(idx,"\tobmc_disable= %d\n", p->vol_fields.bits.obmc_disable);
779 va_TraceMsg(idx,"\tsprite_enable= %d\n", p->vol_fields.bits.sprite_enable);
780 va_TraceMsg(idx,"\tsprite_warping_accuracy= %d\n", p->vol_fields.bits.sprite_warping_accuracy);
781 va_TraceMsg(idx,"\tquant_type= %d\n", p->vol_fields.bits.quant_type);
782 va_TraceMsg(idx,"\tquarter_sample= %d\n", p->vol_fields.bits.quarter_sample);
783 va_TraceMsg(idx,"\tdata_partitioned= %d\n", p->vol_fields.bits.data_partitioned);
784 va_TraceMsg(idx,"\treversible_vlc= %d\n", p->vol_fields.bits.reversible_vlc);
785 va_TraceMsg(idx,"\tresync_marker_disable= %d\n", p->vol_fields.bits.resync_marker_disable);
786 va_TraceMsg(idx,"\tno_of_sprite_warping_points = %d\n", p->no_of_sprite_warping_points);
787 va_TraceMsg(idx,"\tsprite_trajectory_du =");
789 va_TraceMsg(idx,"\t%d", p->sprite_trajectory_du[i]);
791 va_TraceMsg(idx,"\n");
792 va_TraceMsg(idx,"\tsprite_trajectory_dv =");
794 va_TraceMsg(idx,"\t%d", p->sprite_trajectory_dv[i]);
795 va_TraceMsg(idx,"\n");
796 va_TraceMsg(idx,"\tvop_fields value = %d\n", p->vop_fields.value);
797 va_TraceMsg(idx,"\tvop_coding_type= %d\n", p->vop_fields.bits.vop_coding_type);
798 va_TraceMsg(idx,"\tbackward_reference_vop_coding_type= %d\n", p->vop_fields.bits.backward_reference_vop_coding_type);
799 va_TraceMsg(idx,"\tvop_rounding_type= %d\n", p->vop_fields.bits.vop_rounding_type);
800 va_TraceMsg(idx,"\tintra_dc_vlc_thr= %d\n", p->vop_fields.bits.intra_dc_vlc_thr);
801 va_TraceMsg(idx,"\ttop_field_first= %d\n", p->vop_fields.bits.top_field_first);
802 va_TraceMsg(idx,"\talternate_vertical_scan_flag= %d\n", p->vop_fields.bits.alternate_vertical_scan_flag);
803 va_TraceMsg(idx,"\tvop_fcode_forward = %d\n", p->vop_fcode_forward);
804 va_TraceMsg(idx,"\tvop_fcode_backward = %d\n", p->vop_fcode_backward);
805 va_TraceMsg(idx,"\tnum_gobs_in_vop = %d\n", p->num_gobs_in_vop);
806 va_TraceMsg(idx,"\tnum_macroblocks_in_gob = %d\n", p->num_macroblocks_in_gob);
807 va_TraceMsg(idx,"\tTRB = %d\n", p->TRB);
808 va_TraceMsg(idx,"\tTRD = %d\n", p->TRD);
809 va_TraceMsg(idx, NULL);
815 static void va_TraceVAIQMatrixBufferMPEG4(
821 unsigned int num_elements,
825 VAIQMatrixBufferMPEG4 *p=(VAIQMatrixBufferMPEG4 *)data;
828 va_TraceMsg(idx,"VAIQMatrixBufferMPEG4\n");
830 va_TraceMsg(idx,"\tload_intra_quant_mat = %d\n", p->load_intra_quant_mat);
831 va_TraceMsg(idx,"\tload_non_intra_quant_mat = %d\n", p->load_non_intra_quant_mat);
832 va_TraceMsg(idx,"\tintra_quant_mat =\n");
834 va_TraceMsg(idx,"\t\t%d\n", p->intra_quant_mat[i]);
836 va_TraceMsg(idx,"\tnon_intra_quant_mat =\n");
838 va_TraceMsg(idx,"\t\t%d\n", p->non_intra_quant_mat[i]);
839 va_TraceMsg(idx, NULL);
844 static void va_TraceVAEncSequenceParameterBufferMPEG4(
850 unsigned int num_elements,
853 VAEncSequenceParameterBufferMPEG4 *p = (VAEncSequenceParameterBufferMPEG4 *)data;
856 va_TraceMsg(idx, "VAEncSequenceParameterBufferMPEG4\n");
858 va_TraceMsg(idx, "\tprofile_and_level_indication = %d\n", p->profile_and_level_indication);
859 va_TraceMsg(idx, "\tintra_period = %d\n", p->intra_period);
860 va_TraceMsg(idx, "\tvideo_object_layer_width = %d\n", p->video_object_layer_width);
861 va_TraceMsg(idx, "\tvideo_object_layer_height = %d\n", p->video_object_layer_height);
862 va_TraceMsg(idx, "\tvop_time_increment_resolution = %d\n", p->vop_time_increment_resolution);
863 va_TraceMsg(idx, "\tfixed_vop_rate = %d\n", p->fixed_vop_rate);
864 va_TraceMsg(idx, "\tfixed_vop_time_increment = %d\n", p->fixed_vop_time_increment);
865 va_TraceMsg(idx, "\tbits_per_second = %d\n", p->bits_per_second);
866 va_TraceMsg(idx, "\tframe_rate = %d\n", p->frame_rate);
867 va_TraceMsg(idx, "\tinitial_qp = %d\n", p->initial_qp);
868 va_TraceMsg(idx, "\tmin_qp = %d\n", p->min_qp);
869 va_TraceMsg(idx, NULL);
871 /* start a new sequce, coded log file can be truncated */
872 trace_context[idx].trace_sequence_start = 1;
877 static void va_TraceVAEncPictureParameterBufferMPEG4(
883 unsigned int num_elements,
886 VAEncPictureParameterBufferMPEG4 *p = (VAEncPictureParameterBufferMPEG4 *)data;
889 va_TraceMsg(idx, "VAEncPictureParameterBufferMPEG4\n");
890 va_TraceMsg(idx, "\treference_picture = 0x%08x\n", p->reference_picture);
891 va_TraceMsg(idx, "\treconstructed_picture = 0x%08x\n", p->reconstructed_picture);
892 va_TraceMsg(idx, "\tcoded_buf = %08x\n", p->coded_buf);
893 va_TraceMsg(idx, "\tpicture_width = %d\n", p->picture_width);
894 va_TraceMsg(idx, "\tpicture_height = %d\n", p->picture_height);
895 va_TraceMsg(idx, "\tmodulo_time_base = %d\n", p->modulo_time_base);
896 va_TraceMsg(idx, "\tvop_time_increment = %d\n", p->vop_time_increment);
897 va_TraceMsg(idx, "\tpicture_type = %d\n", p->picture_type);
898 va_TraceMsg(idx, NULL);
900 trace_context[idx].trace_codedbuf = p->coded_buf;
906 static void va_TraceVASliceParameterBufferMPEG4(
912 unsigned int num_elements,
915 VASliceParameterBufferMPEG4 *p=(VASliceParameterBufferMPEG4 *)data;
919 trace_context[idx].trace_slice_no++;
921 trace_context[idx].trace_slice_size = p->slice_data_size;
923 va_TraceMsg(idx,"VASliceParameterBufferMPEG4\n");
925 va_TraceMsg(idx,"\tslice_data_size = %d\n", p->slice_data_size);
926 va_TraceMsg(idx,"\tslice_data_offset = %d\n", p->slice_data_offset);
927 va_TraceMsg(idx,"\tslice_data_flag = %d\n", p->slice_data_flag);
928 va_TraceMsg(idx,"\tmacroblock_offset = %d\n", p->macroblock_offset);
929 va_TraceMsg(idx,"\tmacroblock_number = %d\n", p->macroblock_number);
930 va_TraceMsg(idx,"\tquant_scale = %d\n", p->quant_scale);
931 va_TraceMsg(idx, NULL);
937 static inline void va_TraceFlagIfNotZero(
939 const char *name, /* in */
940 unsigned int flag /* in */
944 va_TraceMsg(idx, "%s = %x\n", name, flag);
949 static void va_TraceVAPictureParameterBufferH264(
955 unsigned int num_elements,
959 VAPictureParameterBufferH264 *p = (VAPictureParameterBufferH264*)data;
963 va_TraceMsg(idx, "VAPictureParameterBufferH264\n");
965 va_TraceMsg(idx, "\tCurrPic.picture_id = 0x%08x\n", p->CurrPic.picture_id);
966 va_TraceMsg(idx, "\tCurrPic.frame_idx = %d\n", p->CurrPic.frame_idx);
967 va_TraceMsg(idx, "\tCurrPic.flags = %d\n", p->CurrPic.flags);
968 va_TraceMsg(idx, "\tCurrPic.TopFieldOrderCnt = %d\n", p->CurrPic.TopFieldOrderCnt);
969 va_TraceMsg(idx, "\tCurrPic.BottomFieldOrderCnt = %d\n", p->CurrPic.BottomFieldOrderCnt);
971 va_TraceMsg(idx, "\tReferenceFrames (TopFieldOrderCnt-BottomFieldOrderCnt-picture_id-frame_idx:\n");
972 for (i = 0; i < 16; i++)
974 if (p->ReferenceFrames[i].flags != VA_PICTURE_H264_INVALID) {
975 va_TraceMsg(idx, "\t\t%d-%d-0x%08x-%d\n",
976 p->ReferenceFrames[i].TopFieldOrderCnt,
977 p->ReferenceFrames[i].BottomFieldOrderCnt,
978 p->ReferenceFrames[i].picture_id,
979 p->ReferenceFrames[i].frame_idx);
981 va_TraceMsg(idx, "\t\tinv-inv-inv-inv\n");
983 va_TraceMsg(idx, "\n");
985 va_TraceMsg(idx, "\tpicture_width_in_mbs_minus1 = %d\n", p->picture_width_in_mbs_minus1);
986 va_TraceMsg(idx, "\tpicture_height_in_mbs_minus1 = %d\n", p->picture_height_in_mbs_minus1);
987 va_TraceMsg(idx, "\tbit_depth_luma_minus8 = %d\n", p->bit_depth_luma_minus8);
988 va_TraceMsg(idx, "\tbit_depth_chroma_minus8 = %d\n", p->bit_depth_chroma_minus8);
989 va_TraceMsg(idx, "\tnum_ref_frames = %d\n", p->num_ref_frames);
990 va_TraceMsg(idx, "\tseq fields = %d\n", p->seq_fields.value);
991 va_TraceMsg(idx, "\tchroma_format_idc = %d\n", p->seq_fields.bits.chroma_format_idc);
992 va_TraceMsg(idx, "\tresidual_colour_transform_flag = %d\n", p->seq_fields.bits.residual_colour_transform_flag);
993 va_TraceMsg(idx, "\tframe_mbs_only_flag = %d\n", p->seq_fields.bits.frame_mbs_only_flag);
994 va_TraceMsg(idx, "\tmb_adaptive_frame_field_flag = %d\n", p->seq_fields.bits.mb_adaptive_frame_field_flag);
995 va_TraceMsg(idx, "\tdirect_8x8_inference_flag = %d\n", p->seq_fields.bits.direct_8x8_inference_flag);
996 va_TraceMsg(idx, "\tMinLumaBiPredSize8x8 = %d\n", p->seq_fields.bits.MinLumaBiPredSize8x8);
997 va_TraceMsg(idx, "\tnum_slice_groups_minus1 = %d\n", p->num_slice_groups_minus1);
998 va_TraceMsg(idx, "\tslice_group_map_type = %d\n", p->slice_group_map_type);
999 va_TraceMsg(idx, "\tslice_group_change_rate_minus1 = %d\n", p->slice_group_change_rate_minus1);
1000 va_TraceMsg(idx, "\tpic_init_qp_minus26 = %d\n", p->pic_init_qp_minus26);
1001 va_TraceMsg(idx, "\tpic_init_qs_minus26 = %d\n", p->pic_init_qs_minus26);
1002 va_TraceMsg(idx, "\tchroma_qp_index_offset = %d\n", p->chroma_qp_index_offset);
1003 va_TraceMsg(idx, "\tsecond_chroma_qp_index_offset = %d\n", p->second_chroma_qp_index_offset);
1004 va_TraceMsg(idx, "\tpic_fields = 0x%03x\n", p->pic_fields.value);
1005 va_TraceFlagIfNotZero(idx, "\t\tentropy_coding_mode_flag", p->pic_fields.bits.entropy_coding_mode_flag);
1006 va_TraceFlagIfNotZero(idx, "\t\tweighted_pred_flag", p->pic_fields.bits.weighted_pred_flag);
1007 va_TraceFlagIfNotZero(idx, "\t\tweighted_bipred_idc", p->pic_fields.bits.weighted_bipred_idc);
1008 va_TraceFlagIfNotZero(idx, "\t\ttransform_8x8_mode_flag", p->pic_fields.bits.transform_8x8_mode_flag);
1009 va_TraceFlagIfNotZero(idx, "\t\tfield_pic_flag", p->pic_fields.bits.field_pic_flag);
1010 va_TraceFlagIfNotZero(idx, "\t\tconstrained_intra_pred_flag", p->pic_fields.bits.constrained_intra_pred_flag);
1011 va_TraceFlagIfNotZero(idx, "\t\tpic_order_present_flag", p->pic_fields.bits.pic_order_present_flag);
1012 va_TraceFlagIfNotZero(idx, "\t\tdeblocking_filter_control_present_flag", p->pic_fields.bits.deblocking_filter_control_present_flag);
1013 va_TraceFlagIfNotZero(idx, "\t\tredundant_pic_cnt_present_flag", p->pic_fields.bits.redundant_pic_cnt_present_flag);
1014 va_TraceFlagIfNotZero(idx, "\t\treference_pic_flag", p->pic_fields.bits.reference_pic_flag);
1015 va_TraceMsg(idx, "\tframe_num = %d\n", p->frame_num);
1016 va_TraceMsg(idx, NULL);
1021 static void va_TraceVASliceParameterBufferH264(
1023 VAContextID context,
1027 unsigned int num_elements,
1031 VASliceParameterBufferH264* p = (VASliceParameterBufferH264*)data;
1034 trace_context[idx].trace_slice_no++;
1035 trace_context[idx].trace_slice_size = p->slice_data_size;
1037 va_TraceMsg(idx, "VASliceParameterBufferH264\n");
1038 va_TraceMsg(idx, "\tslice_data_size = %d\n", p->slice_data_size);
1039 va_TraceMsg(idx, "\tslice_data_offset = %d\n", p->slice_data_offset);
1040 va_TraceMsg(idx, "\tslice_data_flag = %d\n", p->slice_data_flag);
1041 va_TraceMsg(idx, "\tslice_data_bit_offset = %d\n", p->slice_data_bit_offset);
1042 va_TraceMsg(idx, "\tfirst_mb_in_slice = %d\n", p->first_mb_in_slice);
1043 va_TraceMsg(idx, "\tslice_type = %d\n", p->slice_type);
1044 va_TraceMsg(idx, "\tdirect_spatial_mv_pred_flag = %d\n", p->direct_spatial_mv_pred_flag);
1045 va_TraceMsg(idx, "\tnum_ref_idx_l0_active_minus1 = %d\n", p->num_ref_idx_l0_active_minus1);
1046 va_TraceMsg(idx, "\tnum_ref_idx_l1_active_minus1 = %d\n", p->num_ref_idx_l1_active_minus1);
1047 va_TraceMsg(idx, "\tcabac_init_idc = %d\n", p->cabac_init_idc);
1048 va_TraceMsg(idx, "\tslice_qp_delta = %d\n", p->slice_qp_delta);
1049 va_TraceMsg(idx, "\tdisable_deblocking_filter_idc = %d\n", p->disable_deblocking_filter_idc);
1050 va_TraceMsg(idx, "\tslice_alpha_c0_offset_div2 = %d\n", p->slice_alpha_c0_offset_div2);
1051 va_TraceMsg(idx, "\tslice_beta_offset_div2 = %d\n", p->slice_beta_offset_div2);
1053 if (p->slice_type == 0 || p->slice_type == 1) {
1054 va_TraceMsg(idx, "\tRefPicList0 =");
1055 for (i = 0; i < p->num_ref_idx_l0_active_minus1 + 1; i++) {
1056 va_TraceMsg(idx, "%d-%d-0x%08x-%d\n", p->RefPicList0[i].TopFieldOrderCnt, p->RefPicList0[i].BottomFieldOrderCnt, p->RefPicList0[i].picture_id, p->RefPicList0[i].frame_idx);
1058 if (p->slice_type == 1) {
1059 va_TraceMsg(idx, "\tRefPicList1 =");
1060 for (i = 0; i < p->num_ref_idx_l1_active_minus1 + 1; i++)
1062 va_TraceMsg(idx, "%d-%d-0x%08x-%d\n", p->RefPicList1[i].TopFieldOrderCnt, p->RefPicList1[i].BottomFieldOrderCnt, p->RefPicList1[i].picture_id, p->RefPicList1[i].frame_idx);
1067 va_TraceMsg(idx, "\tluma_log2_weight_denom = %d\n", p->luma_log2_weight_denom);
1068 va_TraceMsg(idx, "\tchroma_log2_weight_denom = %d\n", p->chroma_log2_weight_denom);
1069 va_TraceMsg(idx, "\tluma_weight_l0_flag = %d\n", p->luma_weight_l0_flag);
1070 if (p->luma_weight_l0_flag) {
1071 for (i = 0; i <= p->num_ref_idx_l0_active_minus1; i++) {
1072 va_TraceMsg(idx, "\t%d ", p->luma_weight_l0[i]);
1073 va_TraceMsg(idx, "\t%d ", p->luma_offset_l0[i]);
1077 va_TraceMsg(idx, "\tchroma_weight_l0_flag = %d\n", p->chroma_weight_l0_flag);
1078 if (p->chroma_weight_l0_flag) {
1079 for (i = 0; i <= p->num_ref_idx_l0_active_minus1; i++) {
1080 va_TraceMsg(idx, "\t\t%d ", p->chroma_weight_l0[i][0]);
1081 va_TraceMsg(idx, "\t\t%d ", p->chroma_offset_l0[i][0]);
1082 va_TraceMsg(idx, "\t\t%d ", p->chroma_weight_l0[i][1]);
1083 va_TraceMsg(idx, "\t\t%d ", p->chroma_offset_l0[i][1]);
1087 va_TraceMsg(idx, "\tluma_weight_l1_flag = %d\n", p->luma_weight_l1_flag);
1088 if (p->luma_weight_l1_flag) {
1089 for (i = 0; i <= p->num_ref_idx_l1_active_minus1; i++) {
1090 va_TraceMsg(idx, "\t\t%d ", p->luma_weight_l1[i]);
1091 va_TraceMsg(idx, "\t\t%d ", p->luma_offset_l1[i]);
1095 va_TraceMsg(idx, "\tchroma_weight_l1_flag = %d\n", p->chroma_weight_l1_flag);
1096 if (p->chroma_weight_l1_flag) {
1097 for (i = 0; i <= p->num_ref_idx_l1_active_minus1; i++) {
1098 va_TraceMsg(idx, "\t\t%d ", p->chroma_weight_l1[i][0]);
1099 va_TraceMsg(idx, "\t\t%d ", p->chroma_offset_l1[i][0]);
1100 va_TraceMsg(idx, "\t\t%d ", p->chroma_weight_l1[i][1]);
1101 va_TraceMsg(idx, "\t\t%d ", p->chroma_offset_l1[i][1]);
1103 va_TraceMsg(idx, "\n");
1105 va_TraceMsg(idx, NULL);
1108 static void va_TraceVAIQMatrixBufferH264(
1110 VAContextID context,
1114 unsigned int num_elements,
1119 VAIQMatrixBufferH264* p = (VAIQMatrixBufferH264* )data;
1123 va_TraceMsg(idx, "VAIQMatrixBufferH264\n");
1125 va_TraceMsg(idx, "\tScalingList4x4[6][16]=\n");
1126 for (i = 0; i < 6; i++) {
1127 for (j = 0; j < 16; j++) {
1128 va_TraceMsg(idx, "\t%d\t", p->ScalingList4x4[i][j]);
1129 if ((j + 1) % 8 == 0)
1130 va_TraceMsg(idx, "\n");
1134 va_TraceMsg(idx, "\tScalingList8x8[2][64]=\n");
1135 for (i = 0; i < 2; i++) {
1136 for (j = 0; j < 64; j++) {
1137 va_TraceMsg(idx, "\t%d", p->ScalingList8x8[i][j]);
1138 if ((j + 1) % 8 == 0)
1139 va_TraceMsg(idx, "\n");
1143 va_TraceMsg(idx, NULL);
1148 static void va_TraceVAEncSequenceParameterBufferH264(
1150 VAContextID context,
1154 unsigned int num_elements,
1157 VAEncSequenceParameterBufferH264 *p = (VAEncSequenceParameterBufferH264 *)data;
1161 va_TraceMsg(idx, "VAEncSequenceParameterBufferH264\n");
1163 va_TraceMsg(idx, "\tseq_parameter_set_id = %d\n", p->seq_parameter_set_id);
1164 va_TraceMsg(idx, "\tlevel_idc = %d\n", p->level_idc);
1165 va_TraceMsg(idx, "\tintra_period = %d\n", p->intra_period);
1166 va_TraceMsg(idx, "\tintra_idr_period = %d\n", p->intra_idr_period);
1167 va_TraceMsg(idx, "\tip_period = %d\n", p->ip_period);
1168 va_TraceMsg(idx, "\tbits_per_second = %d\n", p->bits_per_second);
1169 va_TraceMsg(idx, "\tmax_num_ref_frames = %d\n", p->max_num_ref_frames);
1170 va_TraceMsg(idx, "\tpicture_width_in_mbs = %d\n", p->picture_width_in_mbs);
1171 va_TraceMsg(idx, "\tpicture_height_in_mbs = %d\n", p->picture_height_in_mbs);
1172 va_TraceMsg(idx, "\tchroma_format_idc = %d\n", p->seq_fields.bits.chroma_format_idc);
1173 va_TraceMsg(idx, "\tframe_mbs_only_flag = %d\n", p->seq_fields.bits.frame_mbs_only_flag);
1174 va_TraceMsg(idx, "\tmb_adaptive_frame_field_flag = %d\n", p->seq_fields.bits.mb_adaptive_frame_field_flag);
1175 va_TraceMsg(idx, "\tseq_scaling_matrix_present_flag = %d\n", p->seq_fields.bits.seq_scaling_matrix_present_flag);
1176 va_TraceMsg(idx, "\tdirect_8x8_inference_flag = %d\n", p->seq_fields.bits.direct_8x8_inference_flag);
1177 va_TraceMsg(idx, "\tlog2_max_frame_num_minus4 = %d\n", p->seq_fields.bits.log2_max_frame_num_minus4);
1178 va_TraceMsg(idx, "\tpic_order_cnt_type = %d\n", p->seq_fields.bits.pic_order_cnt_type);
1179 va_TraceMsg(idx, "\tlog2_max_pic_order_cnt_lsb_minus4 = %d\n", p->seq_fields.bits.log2_max_pic_order_cnt_lsb_minus4);
1180 va_TraceMsg(idx, "\tdelta_pic_order_always_zero_flag = %d\n", p->seq_fields.bits.delta_pic_order_always_zero_flag);
1181 va_TraceMsg(idx, "\tbit_depth_luma_minus8 = %d\n", p->bit_depth_luma_minus8);
1182 va_TraceMsg(idx, "\tbit_depth_chroma_minus8 = %d\n", p->bit_depth_chroma_minus8);
1183 va_TraceMsg(idx, "\tnum_ref_frames_in_pic_order_cnt_cycle = %d\n", p->num_ref_frames_in_pic_order_cnt_cycle);
1184 va_TraceMsg(idx, "\toffset_for_non_ref_pic = %d\n", p->offset_for_non_ref_pic);
1185 va_TraceMsg(idx, "\toffset_for_top_to_bottom_field = %d\n", p->offset_for_top_to_bottom_field);
1186 for(i = 0; i< p->max_num_ref_frames; ++i)
1187 va_TraceMsg(idx, "\toffset_for_ref_frame[%d] = %d\n", i, p->offset_for_ref_frame[i]);
1188 va_TraceMsg(idx, "\tframe_cropping_flag = %d\n", p->frame_cropping_flag);
1189 va_TraceMsg(idx, "\tframe_crop_left_offset = %d\n", p->frame_crop_left_offset);
1190 va_TraceMsg(idx, "\tframe_crop_right_offset = %d\n", p->frame_crop_right_offset);
1191 va_TraceMsg(idx, "\tframe_crop_top_offset = %d\n", p->frame_crop_top_offset);
1192 va_TraceMsg(idx, "\tframe_crop_bottom_offset = %d\n", p->frame_crop_bottom_offset);
1193 va_TraceMsg(idx, "\tvui_parameters_present_flag = %d\n", p->vui_parameters_present_flag);
1194 va_TraceMsg(idx, "\taspect_ratio_info_present_flag = %d\n", p->vui_fields.bits.aspect_ratio_info_present_flag);
1195 va_TraceMsg(idx, "\ttiming_info_present_flag = %d\n", p->vui_fields.bits.timing_info_present_flag);
1196 va_TraceMsg(idx, "\tbitstream_restriction_flag = %d\n", p->vui_fields.bits.bitstream_restriction_flag);
1197 va_TraceMsg(idx, "\tlog2_max_mv_length_horizontal = %d\n", p->vui_fields.bits.log2_max_mv_length_horizontal);
1198 va_TraceMsg(idx, "\tlog2_max_mv_length_vertical = %d\n", p->vui_fields.bits.log2_max_mv_length_vertical);
1199 va_TraceMsg(idx, "\taspect_ratio_idc = %d\n", p->aspect_ratio_idc);
1200 va_TraceMsg(idx, "\tsar_width = %d\n", p->sar_width);
1201 va_TraceMsg(idx, "\tsar_height = %d\n", p->sar_height);
1202 va_TraceMsg(idx, "\tnum_units_in_tick = %d\n", p->num_units_in_tick);
1203 va_TraceMsg(idx, "\ttime_scale = %d\n", p->time_scale);
1205 va_TraceMsg(idx, NULL);
1207 /* start a new sequce, coded log file can be truncated */
1208 trace_context[idx].trace_sequence_start = 1;
1214 static void va_TraceVAEncPictureParameterBufferH264(
1216 VAContextID context,
1220 unsigned int num_elements,
1223 VAEncPictureParameterBufferH264 *p = (VAEncPictureParameterBufferH264 *)data;
1227 va_TraceMsg(idx, "VAEncPictureParameterBufferH264\n");
1229 va_TraceMsg(idx, "\tCurrPic.picture_id = 0x%08x\n", p->CurrPic.picture_id);
1230 va_TraceMsg(idx, "\tCurrPic.frame_idx = %d\n", p->CurrPic.frame_idx);
1231 va_TraceMsg(idx, "\tCurrPic.flags = %d\n", p->CurrPic.flags);
1232 va_TraceMsg(idx, "\tCurrPic.TopFieldOrderCnt = %d\n", p->CurrPic.TopFieldOrderCnt);
1233 va_TraceMsg(idx, "\tCurrPic.BottomFieldOrderCnt = %d\n", p->CurrPic.BottomFieldOrderCnt);
1234 va_TraceMsg(idx, "\tReferenceFrames (TopFieldOrderCnt-BottomFieldOrderCnt-picture_id-frame_idx:\n");
1235 for (i = 0; i < 16; i++)
1237 if (p->ReferenceFrames[i].flags != VA_PICTURE_H264_INVALID) {
1238 va_TraceMsg(idx, "\t\t%d-%d-0x%08x-%d\n",
1239 p->ReferenceFrames[i].TopFieldOrderCnt,
1240 p->ReferenceFrames[i].BottomFieldOrderCnt,
1241 p->ReferenceFrames[i].picture_id,
1242 p->ReferenceFrames[i].frame_idx);
1244 va_TraceMsg(idx, "\t\tinv-inv-inv-inv\n");
1246 va_TraceMsg(idx, "\tcoded_buf = %08x\n", p->coded_buf);
1247 va_TraceMsg(idx, "\tpic_parameter_set_id = %d\n", p->pic_parameter_set_id);
1248 va_TraceMsg(idx, "\tseq_parameter_set_id = %d\n", p->seq_parameter_set_id);
1249 va_TraceMsg(idx, "\tlast_picture = 0x%08x\n", p->last_picture);
1250 va_TraceMsg(idx, "\tframe_num = %d\n", p->frame_num);
1251 va_TraceMsg(idx, "\tpic_init_qp = %d\n", p->pic_init_qp);
1252 va_TraceMsg(idx, "\tnum_ref_idx_l0_active_minus1 = %d\n", p->num_ref_idx_l0_active_minus1);
1253 va_TraceMsg(idx, "\tnum_ref_idx_l1_active_minus1 = %d\n", p->num_ref_idx_l1_active_minus1);
1254 va_TraceMsg(idx, "\tchroma_qp_index_offset = %d\n", p->chroma_qp_index_offset);
1255 va_TraceMsg(idx, "\tsecond_chroma_qp_index_offset = %d\n", p->second_chroma_qp_index_offset);
1256 va_TraceMsg(idx, "\tpic_fields = 0x%03x\n", p->pic_fields.value);
1257 va_TraceMsg(idx, "\tidr_pic_flag = %d\n", p->pic_fields.bits.idr_pic_flag);
1258 va_TraceMsg(idx, "\treference_pic_flag = %d\n", p->pic_fields.bits.reference_pic_flag);
1259 va_TraceMsg(idx, "\tentropy_coding_mode_flag = %d\n", p->pic_fields.bits.entropy_coding_mode_flag);
1260 va_TraceMsg(idx, "\tweighted_pred_flag = %d\n", p->pic_fields.bits.weighted_pred_flag);
1261 va_TraceMsg(idx, "\tweighted_bipred_idc = %d\n", p->pic_fields.bits.weighted_bipred_idc);
1262 va_TraceMsg(idx, "\tconstrained_intra_pred_flag = %d\n", p->pic_fields.bits.constrained_intra_pred_flag);
1263 va_TraceMsg(idx, "\ttransform_8x8_mode_flag = %d\n", p->pic_fields.bits.transform_8x8_mode_flag);
1264 va_TraceMsg(idx, "\tdeblocking_filter_control_present_flag = %d\n", p->pic_fields.bits.deblocking_filter_control_present_flag);
1265 va_TraceMsg(idx, "\tredundant_pic_cnt_present_flag = %d\n", p->pic_fields.bits.redundant_pic_cnt_present_flag);
1266 va_TraceMsg(idx, "\tpic_order_present_flag = %d\n", p->pic_fields.bits.pic_order_present_flag);
1267 va_TraceMsg(idx, "\tpic_scaling_matrix_present_flag = %d\n", p->pic_fields.bits.pic_scaling_matrix_present_flag);
1269 va_TraceMsg(idx, NULL);
1271 trace_context[idx].trace_codedbuf = p->coded_buf;
1276 static void va_TraceVAEncSliceParameterBuffer(
1278 VAContextID context,
1282 unsigned int num_elements,
1285 VAEncSliceParameterBuffer* p = (VAEncSliceParameterBuffer*)data;
1288 va_TraceMsg(idx, "VAEncSliceParameterBuffer\n");
1290 va_TraceMsg(idx, "\tstart_row_number = %d\n", p->start_row_number);
1291 va_TraceMsg(idx, "\tslice_height = %d\n", p->slice_height);
1292 va_TraceMsg(idx, "\tslice_flags.is_intra = %d\n", p->slice_flags.bits.is_intra);
1293 va_TraceMsg(idx, "\tslice_flags.disable_deblocking_filter_idc = %d\n", p->slice_flags.bits.disable_deblocking_filter_idc);
1294 va_TraceMsg(idx, "\tslice_flags.uses_long_term_ref = %d\n", p->slice_flags.bits.uses_long_term_ref);
1295 va_TraceMsg(idx, "\tslice_flags.is_long_term_ref = %d\n", p->slice_flags.bits.is_long_term_ref);
1296 va_TraceMsg(idx, NULL);
1301 static void va_TraceVAEncSliceParameterBufferH264(
1303 VAContextID context,
1307 unsigned int num_elements,
1310 VAEncSliceParameterBufferH264* p = (VAEncSliceParameterBufferH264*)data;
1314 va_TraceMsg(idx, "VAEncSliceParameterBufferH264\n");
1315 va_TraceMsg(idx, "\tmacroblock_address = %d\n", p->macroblock_address);
1316 va_TraceMsg(idx, "\tnum_macroblocks = %d\n", p->num_macroblocks);
1317 va_TraceMsg(idx, "\tmacroblock_info = %08x\n", p->macroblock_info);
1318 va_TraceMsg(idx, "\tslice_type = %d\n", p->slice_type);
1319 va_TraceMsg(idx, "\tpic_parameter_set_id = %d\n", p->pic_parameter_set_id);
1320 va_TraceMsg(idx, "\tidr_pic_id = %d\n", p->idr_pic_id);
1321 va_TraceMsg(idx, "\tpic_order_cnt_lsb = %d\n", p->pic_order_cnt_lsb);
1322 va_TraceMsg(idx, "\tdelta_pic_order_cnt_bottom = %d\n", p->delta_pic_order_cnt_bottom);
1323 va_TraceMsg(idx, "\tdelta_pic_order_cnt[0] = %d\n", p->delta_pic_order_cnt[0]);
1324 va_TraceMsg(idx, "\tdelta_pic_order_cnt[1] = %d\n", p->delta_pic_order_cnt[1]);
1325 va_TraceMsg(idx, "\tdirect_spatial_mv_pred_flag = %d\n", p->direct_spatial_mv_pred_flag);
1326 va_TraceMsg(idx, "\tnum_ref_idx_active_override_flag = %d\n", p->num_ref_idx_active_override_flag);
1327 va_TraceMsg(idx, "\tnum_ref_idx_l1_active_minus1 = %d\n", p->num_ref_idx_l1_active_minus1);
1328 va_TraceMsg(idx, "\tslice_beta_offset_div2 = %d\n", p->slice_beta_offset_div2);
1330 if (p->slice_type == 0 || p->slice_type == 1) {
1331 va_TraceMsg(idx, "\tRefPicList0 =");
1332 for (i = 0; i < p->num_ref_idx_l0_active_minus1 + 1; i++) {
1333 va_TraceMsg(idx, "%d-%d-0x%08x-%d\n", p->RefPicList0[i].TopFieldOrderCnt, p->RefPicList0[i].BottomFieldOrderCnt, p->RefPicList0[i].picture_id, p->RefPicList0[i].frame_idx);
1335 if (p->slice_type == 1) {
1336 va_TraceMsg(idx, "\tRefPicList1 =");
1337 for (i = 0; i < p->num_ref_idx_l1_active_minus1 + 1; i++)
1339 va_TraceMsg(idx, "%d-%d-0x%08x-%d\n", p->RefPicList1[i].TopFieldOrderCnt, p->RefPicList1[i].BottomFieldOrderCnt, p->RefPicList1[i].picture_id, p->RefPicList1[i].frame_idx);
1344 va_TraceMsg(idx, "\tluma_log2_weight_denom = %d\n", p->luma_log2_weight_denom);
1345 va_TraceMsg(idx, "\tchroma_log2_weight_denom = %d\n", p->chroma_log2_weight_denom);
1346 va_TraceMsg(idx, "\tluma_weight_l0_flag = %d\n", p->luma_weight_l0_flag);
1347 if (p->luma_weight_l0_flag) {
1348 for (i = 0; i <= p->num_ref_idx_l0_active_minus1; i++) {
1349 va_TraceMsg(idx, "\t%d ", p->luma_weight_l0[i]);
1350 va_TraceMsg(idx, "\t%d ", p->luma_offset_l0[i]);
1354 va_TraceMsg(idx, "\tchroma_weight_l0_flag = %d\n", p->chroma_weight_l0_flag);
1355 if (p->chroma_weight_l0_flag) {
1356 for (i = 0; i <= p->num_ref_idx_l0_active_minus1; i++) {
1357 va_TraceMsg(idx, "\t\t%d ", p->chroma_weight_l0[i][0]);
1358 va_TraceMsg(idx, "\t\t%d ", p->chroma_offset_l0[i][0]);
1359 va_TraceMsg(idx, "\t\t%d ", p->chroma_weight_l0[i][1]);
1360 va_TraceMsg(idx, "\t\t%d ", p->chroma_offset_l0[i][1]);
1364 va_TraceMsg(idx, "\tluma_weight_l1_flag = %d\n", p->luma_weight_l1_flag);
1365 if (p->luma_weight_l1_flag) {
1366 for (i = 0; i <= p->num_ref_idx_l1_active_minus1; i++) {
1367 va_TraceMsg(idx, "\t\t%d ", p->luma_weight_l1[i]);
1368 va_TraceMsg(idx, "\t\t%d ", p->luma_offset_l1[i]);
1372 va_TraceMsg(idx, "\tchroma_weight_l1_flag = %d\n", p->chroma_weight_l1_flag);
1373 if (p->chroma_weight_l1_flag) {
1374 for (i = 0; i <= p->num_ref_idx_l1_active_minus1; i++) {
1375 va_TraceMsg(idx, "\t\t%d ", p->chroma_weight_l1[i][0]);
1376 va_TraceMsg(idx, "\t\t%d ", p->chroma_offset_l1[i][0]);
1377 va_TraceMsg(idx, "\t\t%d ", p->chroma_weight_l1[i][1]);
1378 va_TraceMsg(idx, "\t\t%d ", p->chroma_offset_l1[i][1]);
1380 va_TraceMsg(idx, "\n");
1382 va_TraceMsg(idx, NULL);
1384 va_TraceMsg(idx, "\tcabac_init_idc = %d\n", p->cabac_init_idc);
1385 va_TraceMsg(idx, "\tslice_qp_delta = %d\n", p->slice_qp_delta);
1386 va_TraceMsg(idx, "\tdisable_deblocking_filter_idc = %d\n", p->disable_deblocking_filter_idc);
1387 va_TraceMsg(idx, "\tslice_alpha_c0_offset_div2 = %d\n", p->slice_alpha_c0_offset_div2);
1388 va_TraceMsg(idx, "\tslice_beta_offset_div2 = %d\n", p->slice_beta_offset_div2);
1389 va_TraceMsg(idx, NULL);
1394 static void va_TraceVAEncMiscParameterBuffer(
1396 VAContextID context,
1400 unsigned int num_elements,
1403 VAEncMiscParameterBuffer* tmp = (VAEncMiscParameterBuffer*)data;
1406 switch (tmp->type) {
1407 case VAEncMiscParameterTypeFrameRate:
1409 VAEncMiscParameterFrameRate *p = (VAEncMiscParameterFrameRate *)tmp->data;
1410 va_TraceMsg(idx, "VAEncMiscParameterFrameRate\n");
1411 va_TraceMsg(idx, "\tframerate = %d\n", p->framerate);
1415 case VAEncMiscParameterTypeRateControl:
1417 VAEncMiscParameterRateControl *p = (VAEncMiscParameterRateControl *)tmp->data;
1419 va_TraceMsg(idx, "VAEncMiscParameterRateControl\n");
1420 va_TraceMsg(idx, "\tbits_per_second = %d\n", p->bits_per_second);
1421 va_TraceMsg(idx, "\twindow_size = %d\n", p->window_size);
1422 va_TraceMsg(idx, "\tinitial_qp = %d\n", p->initial_qp);
1423 va_TraceMsg(idx, "\tmin_qp = %d\n", p->min_qp);
1426 case VAEncMiscParameterTypeMaxSliceSize:
1428 VAEncMiscParameterMaxSliceSize *p = (VAEncMiscParameterMaxSliceSize *)tmp->data;
1430 va_TraceMsg(idx, "VAEncMiscParameterTypeMaxSliceSize\n");
1431 va_TraceMsg(idx, "\tmax_slice_size = %d\n", p->max_slice_size);
1434 case VAEncMiscParameterTypeAIR:
1436 VAEncMiscParameterAIR *p = (VAEncMiscParameterAIR *)tmp->data;
1438 va_TraceMsg(idx, "VAEncMiscParameterAIR\n");
1439 va_TraceMsg(idx, "\tair_num_mbs = %d\n", p->air_num_mbs);
1440 va_TraceMsg(idx, "\tair_threshold = %d\n", p->air_threshold);
1441 va_TraceMsg(idx, "\tair_auto = %d\n", p->air_auto);
1444 case VAEncMiscParameterTypeHRD:
1446 VAEncMiscParameterHRD *p = (VAEncMiscParameterHRD *)tmp->data;
1448 va_TraceMsg(idx, "VAEncMiscParameterHRD\n");
1449 va_TraceMsg(idx, "\tinitial_buffer_fullness = %d\n", p->initial_buffer_fullness);
1450 va_TraceMsg(idx, "\tbuffer_size = %d\n", p->buffer_size);
1454 va_TraceMsg(idx, "invalid VAEncMiscParameterBuffer type = %d\n", tmp->type);
1457 va_TraceMsg(idx, NULL);
1463 static void va_TraceVAPictureParameterBufferVC1(
1465 VAContextID context,
1469 unsigned int num_elements,
1473 VAPictureParameterBufferVC1* p = (VAPictureParameterBufferVC1*)data;
1476 va_TraceMsg(idx, "VAPictureParameterBufferVC1\n");
1478 va_TraceMsg(idx, "\tforward_reference_picture = 0x%08x\n", p->forward_reference_picture);
1479 va_TraceMsg(idx, "\tbackward_reference_picture = 0x%08x\n", p->backward_reference_picture);
1480 va_TraceMsg(idx, "\tinloop_decoded_picture = 0x%08x\n", p->inloop_decoded_picture);
1482 va_TraceMsg(idx, "\tpulldown = %d\n", p->sequence_fields.bits.pulldown);
1483 va_TraceMsg(idx, "\tinterlace = %d\n", p->sequence_fields.bits.interlace);
1484 va_TraceMsg(idx, "\ttfcntrflag = %d\n", p->sequence_fields.bits.tfcntrflag);
1485 va_TraceMsg(idx, "\tfinterpflag = %d\n", p->sequence_fields.bits.finterpflag);
1486 va_TraceMsg(idx, "\tpsf = %d\n", p->sequence_fields.bits.psf);
1487 va_TraceMsg(idx, "\tmultires = %d\n", p->sequence_fields.bits.multires);
1488 va_TraceMsg(idx, "\toverlap = %d\n", p->sequence_fields.bits.overlap);
1489 va_TraceMsg(idx, "\tsyncmarker = %d\n", p->sequence_fields.bits.syncmarker);
1490 va_TraceMsg(idx, "\trangered = %d\n", p->sequence_fields.bits.rangered);
1491 va_TraceMsg(idx, "\tmax_b_frames = %d\n", p->sequence_fields.bits.max_b_frames);
1492 va_TraceMsg(idx, "\tprofile = %d\n", p->sequence_fields.bits.profile);
1493 va_TraceMsg(idx, "\tcoded_width = %d\n", p->coded_width);
1494 va_TraceMsg(idx, "\tcoded_height = %d\n", p->coded_height);
1495 va_TraceMsg(idx, "\tclosed_entry = %d\n", p->entrypoint_fields.bits.closed_entry);
1496 va_TraceMsg(idx, "\tbroken_link = %d\n", p->entrypoint_fields.bits.broken_link);
1497 va_TraceMsg(idx, "\tclosed_entry = %d\n", p->entrypoint_fields.bits.closed_entry);
1498 va_TraceMsg(idx, "\tpanscan_flag = %d\n", p->entrypoint_fields.bits.panscan_flag);
1499 va_TraceMsg(idx, "\tloopfilter = %d\n", p->entrypoint_fields.bits.loopfilter);
1500 va_TraceMsg(idx, "\tconditional_overlap_flag = %d\n", p->conditional_overlap_flag);
1501 va_TraceMsg(idx, "\tfast_uvmc_flag = %d\n", p->fast_uvmc_flag);
1502 va_TraceMsg(idx, "\trange_mapping_luma_flag = %d\n", p->range_mapping_fields.bits.luma_flag);
1503 va_TraceMsg(idx, "\trange_mapping_luma = %d\n", p->range_mapping_fields.bits.luma);
1504 va_TraceMsg(idx, "\trange_mapping_chroma_flag = %d\n", p->range_mapping_fields.bits.chroma_flag);
1505 va_TraceMsg(idx, "\trange_mapping_chroma = %d\n", p->range_mapping_fields.bits.chroma);
1506 va_TraceMsg(idx, "\tb_picture_fraction = %d\n", p->b_picture_fraction);
1507 va_TraceMsg(idx, "\tcbp_table = %d\n", p->cbp_table);
1508 va_TraceMsg(idx, "\tmb_mode_table = %d\n", p->mb_mode_table);
1509 va_TraceMsg(idx, "\trange_reduction_frame = %d\n", p->range_reduction_frame);
1510 va_TraceMsg(idx, "\trounding_control = %d\n", p->rounding_control);
1511 va_TraceMsg(idx, "\tpost_processing = %d\n", p->post_processing);
1512 va_TraceMsg(idx, "\tpicture_resolution_index = %d\n", p->picture_resolution_index);
1513 va_TraceMsg(idx, "\tluma_scale = %d\n", p->luma_scale);
1514 va_TraceMsg(idx, "\tluma_shift = %d\n", p->luma_shift);
1515 va_TraceMsg(idx, "\tpicture_type = %d\n", p->picture_fields.bits.picture_type);
1516 va_TraceMsg(idx, "\tframe_coding_mode = %d\n", p->picture_fields.bits.frame_coding_mode);
1517 va_TraceMsg(idx, "\ttop_field_first = %d\n", p->picture_fields.bits.top_field_first);
1518 va_TraceMsg(idx, "\tis_first_field = %d\n", p->picture_fields.bits.is_first_field);
1519 va_TraceMsg(idx, "\tintensity_compensation = %d\n", p->picture_fields.bits.intensity_compensation);
1520 va_TraceMsg(idx, "\tmv_type_mb = %d\n", p->raw_coding.flags.mv_type_mb);
1521 va_TraceMsg(idx, "\tdirect_mb = %d\n", p->raw_coding.flags.direct_mb);
1522 va_TraceMsg(idx, "\tskip_mb = %d\n", p->raw_coding.flags.skip_mb);
1523 va_TraceMsg(idx, "\tfield_tx = %d\n", p->raw_coding.flags.field_tx);
1524 va_TraceMsg(idx, "\tforward_mb = %d\n", p->raw_coding.flags.forward_mb);
1525 va_TraceMsg(idx, "\tac_pred = %d\n", p->raw_coding.flags.ac_pred);
1526 va_TraceMsg(idx, "\toverflags = %d\n", p->raw_coding.flags.overflags);
1527 va_TraceMsg(idx, "\tbp_mv_type_mb = %d\n", p->bitplane_present.flags.bp_mv_type_mb);
1528 va_TraceMsg(idx, "\tbp_direct_mb = %d\n", p->bitplane_present.flags.bp_direct_mb);
1529 va_TraceMsg(idx, "\tbp_skip_mb = %d\n", p->bitplane_present.flags.bp_skip_mb);
1530 va_TraceMsg(idx, "\tbp_field_tx = %d\n", p->bitplane_present.flags.bp_field_tx);
1531 va_TraceMsg(idx, "\tbp_forward_mb = %d\n", p->bitplane_present.flags.bp_forward_mb);
1532 va_TraceMsg(idx, "\tbp_ac_pred = %d\n", p->bitplane_present.flags.bp_ac_pred);
1533 va_TraceMsg(idx, "\tbp_overflags = %d\n", p->bitplane_present.flags.bp_overflags);
1534 va_TraceMsg(idx, "\treference_distance_flag = %d\n", p->reference_fields.bits.reference_distance_flag);
1535 va_TraceMsg(idx, "\treference_distance = %d\n", p->reference_fields.bits.reference_distance);
1536 va_TraceMsg(idx, "\tnum_reference_pictures = %d\n", p->reference_fields.bits.num_reference_pictures);
1537 va_TraceMsg(idx, "\treference_field_pic_indicator = %d\n", p->reference_fields.bits.reference_field_pic_indicator);
1538 va_TraceMsg(idx, "\tmv_mode = %d\n", p->mv_fields.bits.mv_mode);
1539 va_TraceMsg(idx, "\tmv_mode2 = %d\n", p->mv_fields.bits.mv_mode2);
1540 va_TraceMsg(idx, "\tmv_table = %d\n", p->mv_fields.bits.mv_table);
1541 va_TraceMsg(idx, "\ttwo_mv_block_pattern_table = %d\n", p->mv_fields.bits.two_mv_block_pattern_table);
1542 va_TraceMsg(idx, "\tfour_mv_switch = %d\n", p->mv_fields.bits.four_mv_switch);
1543 va_TraceMsg(idx, "\tfour_mv_block_pattern_table = %d\n", p->mv_fields.bits.four_mv_block_pattern_table);
1544 va_TraceMsg(idx, "\textended_mv_flag = %d\n", p->mv_fields.bits.extended_mv_flag);
1545 va_TraceMsg(idx, "\textended_mv_range = %d\n", p->mv_fields.bits.extended_mv_range);
1546 va_TraceMsg(idx, "\textended_dmv_flag = %d\n", p->mv_fields.bits.extended_dmv_flag);
1547 va_TraceMsg(idx, "\textended_dmv_range = %d\n", p->mv_fields.bits.extended_dmv_range);
1548 va_TraceMsg(idx, "\tdquant = %d\n", p->pic_quantizer_fields.bits.dquant);
1549 va_TraceMsg(idx, "\tquantizer = %d\n", p->pic_quantizer_fields.bits.quantizer);
1550 va_TraceMsg(idx, "\thalf_qp = %d\n", p->pic_quantizer_fields.bits.half_qp);
1551 va_TraceMsg(idx, "\tpic_quantizer_scale = %d\n", p->pic_quantizer_fields.bits.pic_quantizer_scale);
1552 va_TraceMsg(idx, "\tpic_quantizer_type = %d\n", p->pic_quantizer_fields.bits.pic_quantizer_type);
1553 va_TraceMsg(idx, "\tdq_frame = %d\n", p->pic_quantizer_fields.bits.dq_frame);
1554 va_TraceMsg(idx, "\tdq_profile = %d\n", p->pic_quantizer_fields.bits.dq_profile);
1555 va_TraceMsg(idx, "\tdq_sb_edge = %d\n", p->pic_quantizer_fields.bits.dq_sb_edge);
1556 va_TraceMsg(idx, "\tdq_db_edge = %d\n", p->pic_quantizer_fields.bits.dq_db_edge);
1557 va_TraceMsg(idx, "\tdq_binary_level = %d\n", p->pic_quantizer_fields.bits.dq_binary_level);
1558 va_TraceMsg(idx, "\talt_pic_quantizer = %d\n", p->pic_quantizer_fields.bits.alt_pic_quantizer);
1559 va_TraceMsg(idx, "\tvariable_sized_transform_flag = %d\n", p->transform_fields.bits.variable_sized_transform_flag);
1560 va_TraceMsg(idx, "\tmb_level_transform_type_flag = %d\n", p->transform_fields.bits.mb_level_transform_type_flag);
1561 va_TraceMsg(idx, "\tframe_level_transform_type = %d\n", p->transform_fields.bits.frame_level_transform_type);
1562 va_TraceMsg(idx, "\ttransform_ac_codingset_idx1 = %d\n", p->transform_fields.bits.transform_ac_codingset_idx1);
1563 va_TraceMsg(idx, "\ttransform_ac_codingset_idx2 = %d\n", p->transform_fields.bits.transform_ac_codingset_idx2);
1564 va_TraceMsg(idx, "\tintra_transform_dc_table = %d\n", p->transform_fields.bits.intra_transform_dc_table);
1565 va_TraceMsg(idx, NULL);
1568 static void va_TraceVASliceParameterBufferVC1(
1570 VAContextID context,
1574 unsigned int num_elements,
1578 VASliceParameterBufferVC1 *p = (VASliceParameterBufferVC1*)data;
1581 trace_context[idx].trace_slice_no++;
1582 trace_context[idx].trace_slice_size = p->slice_data_size;
1584 va_TraceMsg(idx, "VASliceParameterBufferVC1\n");
1585 va_TraceMsg(idx, "\tslice_data_size = %d\n", p->slice_data_size);
1586 va_TraceMsg(idx, "\tslice_data_offset = %d\n", p->slice_data_offset);
1587 va_TraceMsg(idx, "\tslice_data_flag = %d\n", p->slice_data_flag);
1588 va_TraceMsg(idx, "\tmacroblock_offset = %d\n", p->macroblock_offset);
1589 va_TraceMsg(idx, "\tslice_vertical_position = %d\n", p->slice_vertical_position);
1590 va_TraceMsg(idx, NULL);
1593 void va_TraceBeginPicture(
1595 VAContextID context,
1596 VASurfaceID render_target
1601 TRACE_FUNCNAME(idx);
1603 va_TraceMsg(idx, "\tcontext = 0x%08x\n", context);
1604 va_TraceMsg(idx, "\trender_targets = 0x%08x\n", render_target);
1605 va_TraceMsg(idx, "\tframe_count = #%d\n", trace_context[idx].trace_frame_no);
1606 va_TraceMsg(idx, NULL);
1608 trace_context[idx].trace_rendertarget = render_target; /* for surface data dump after vaEndPicture */
1610 trace_context[idx].trace_frame_no++;
1611 trace_context[idx].trace_slice_no = 0;
1614 static void va_TraceMPEG2Buf(
1616 VAContextID context,
1620 unsigned int num_elements,
1625 case VAPictureParameterBufferType:
1626 va_TraceVAPictureParameterBufferMPEG2(dpy, context, buffer, type, size, num_elements, pbuf);
1628 case VAIQMatrixBufferType:
1629 va_TraceVAIQMatrixBufferMPEG2(dpy, context, buffer, type, size, num_elements, pbuf);
1631 case VABitPlaneBufferType:
1632 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
1634 case VASliceGroupMapBufferType:
1635 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
1637 case VASliceParameterBufferType:
1638 va_TraceVASliceParameterBufferMPEG2(dpy, context, buffer, type, size, num_elements, pbuf);
1640 case VASliceDataBufferType:
1641 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
1643 case VAMacroblockParameterBufferType:
1644 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
1646 case VAResidualDataBufferType:
1647 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
1649 case VADeblockingParameterBufferType:
1650 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
1652 case VAImageBufferType:
1654 case VAProtectedSliceDataBufferType:
1655 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
1657 case VAEncCodedBufferType:
1659 case VAEncSequenceParameterBufferType:
1661 case VAEncPictureParameterBufferType:
1663 case VAEncSliceParameterBufferType:
1670 static void va_TraceVAEncSequenceParameterBufferH263(
1672 VAContextID context,
1676 unsigned int num_elements,
1679 VAEncSequenceParameterBufferH263 *p = (VAEncSequenceParameterBufferH263 *)data;
1682 va_TraceMsg(idx, "VAEncSequenceParameterBufferH263\n");
1684 va_TraceMsg(idx, "\tintra_period = %d\n", p->intra_period);
1685 va_TraceMsg(idx, "\tbits_per_second = %d\n", p->bits_per_second);
1686 va_TraceMsg(idx, "\tframe_rate = %d\n", p->frame_rate);
1687 va_TraceMsg(idx, "\tinitial_qp = %d\n", p->initial_qp);
1688 va_TraceMsg(idx, "\tmin_qp = %d\n", p->min_qp);
1689 va_TraceMsg(idx, NULL);
1691 /* start a new sequce, coded log file can be truncated */
1692 trace_context[idx].trace_sequence_start = 1;
1698 static void va_TraceVAEncPictureParameterBufferH263(
1700 VAContextID context,
1704 unsigned int num_elements,
1707 VAEncPictureParameterBufferH263 *p = (VAEncPictureParameterBufferH263 *)data;
1710 va_TraceMsg(idx, "VAEncPictureParameterBufferH263\n");
1711 va_TraceMsg(idx, "\treference_picture = 0x%08x\n", p->reference_picture);
1712 va_TraceMsg(idx, "\treconstructed_picture = 0x%08x\n", p->reconstructed_picture);
1713 va_TraceMsg(idx, "\tcoded_buf = %08x\n", p->coded_buf);
1714 va_TraceMsg(idx, "\tpicture_width = %d\n", p->picture_width);
1715 va_TraceMsg(idx, "\tpicture_height = %d\n", p->picture_height);
1716 va_TraceMsg(idx, "\tpicture_type = 0x%08x\n", p->picture_type);
1717 va_TraceMsg(idx, NULL);
1719 trace_context[idx].trace_codedbuf = p->coded_buf;
1724 static void va_TraceVAEncPictureParameterBufferJPEG(
1726 VAContextID context,
1730 unsigned int num_elements,
1733 VAEncPictureParameterBufferJPEG *p = (VAEncPictureParameterBufferJPEG *)data;
1736 va_TraceMsg(idx, "VAEncPictureParameterBufferJPEG\n");
1737 va_TraceMsg(idx, "\treconstructed_picture = 0x%08x\n", p->reconstructed_picture);
1738 va_TraceMsg(idx, "\tcoded_buf = %08x\n", p->coded_buf);
1739 va_TraceMsg(idx, "\tpicture_width = %d\n", p->picture_width);
1740 va_TraceMsg(idx, "\tpicture_height = %d\n", p->picture_height);
1741 va_TraceMsg(idx, NULL);
1743 trace_context[idx].trace_codedbuf = p->coded_buf;
1748 static void va_TraceVAEncQMatrixBufferJPEG(
1750 VAContextID context,
1754 unsigned int num_elements,
1757 VAQMatrixBufferJPEG *p = (VAQMatrixBufferJPEG *)data;
1760 va_TraceMsg(idx, "VAQMatrixBufferJPEG\n");
1761 va_TraceMsg(idx, "\tload_lum_quantiser_matrix = %d", p->load_lum_quantiser_matrix);
1762 if (p->load_lum_quantiser_matrix) {
1764 for (i = 0; i < 64; i++) {
1766 va_TraceMsg(idx, "\n\t");
1767 va_TraceMsg(idx, "\t0x%02x", p->lum_quantiser_matrix[i]);
1769 va_TraceMsg(idx, "\n");
1771 va_TraceMsg(idx, "\tload_chroma_quantiser_matrix = %08x\n", p->load_chroma_quantiser_matrix);
1772 if (p->load_chroma_quantiser_matrix) {
1774 for (i = 0; i < 64; i++) {
1776 va_TraceMsg(idx, "\n\t");
1777 va_TraceMsg(idx, "\t0x%02x", p->chroma_quantiser_matrix[i]);
1779 va_TraceMsg(idx, "\n");
1782 va_TraceMsg(idx, NULL);
1787 static void va_TraceH263Buf(
1789 VAContextID context,
1793 unsigned int num_elements,
1798 case VAPictureParameterBufferType:/* print MPEG4 buffer */
1799 va_TraceVAPictureParameterBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf);
1801 case VAIQMatrixBufferType:/* print MPEG4 buffer */
1802 va_TraceVAIQMatrixBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf);
1804 case VABitPlaneBufferType:/* print MPEG4 buffer */
1805 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
1807 case VASliceGroupMapBufferType:
1809 case VASliceParameterBufferType:/* print MPEG4 buffer */
1810 va_TraceVASliceParameterBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf);
1812 case VASliceDataBufferType:
1813 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
1815 case VAMacroblockParameterBufferType:
1816 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
1818 case VAResidualDataBufferType:
1819 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
1821 case VADeblockingParameterBufferType:
1822 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
1824 case VAImageBufferType:
1826 case VAProtectedSliceDataBufferType:
1827 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
1829 case VAEncCodedBufferType:
1831 case VAEncSequenceParameterBufferType:
1832 va_TraceVAEncSequenceParameterBufferH263(dpy, context, buffer, type, size, num_elements, pbuf);
1834 case VAEncPictureParameterBufferType:
1835 va_TraceVAEncPictureParameterBufferH263(dpy, context, buffer, type, size, num_elements, pbuf);
1837 case VAEncSliceParameterBufferType:
1838 va_TraceVAEncSliceParameterBuffer(dpy, context, buffer, type, size, num_elements, pbuf);
1846 static void va_TraceJPEGBuf(
1848 VAContextID context,
1852 unsigned int num_elements,
1857 case VAPictureParameterBufferType:/* print MPEG4 buffer */
1858 case VAIQMatrixBufferType:/* print MPEG4 buffer */
1859 case VABitPlaneBufferType:/* print MPEG4 buffer */
1860 case VASliceGroupMapBufferType:
1861 case VASliceParameterBufferType:/* print MPEG4 buffer */
1862 case VASliceDataBufferType:
1863 case VAMacroblockParameterBufferType:
1864 case VAResidualDataBufferType:
1865 case VADeblockingParameterBufferType:
1866 case VAImageBufferType:
1867 case VAProtectedSliceDataBufferType:
1868 case VAEncCodedBufferType:
1869 case VAEncSequenceParameterBufferType:
1870 case VAEncSliceParameterBufferType:
1871 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
1873 case VAEncPictureParameterBufferType:
1874 va_TraceVAEncPictureParameterBufferJPEG(dpy, context, buffer, type, size, num_elements, pbuf);
1876 case VAQMatrixBufferType:
1877 va_TraceVAEncQMatrixBufferJPEG(dpy, context, buffer, type, size, num_elements, pbuf);
1884 static void va_TraceMPEG4Buf(
1886 VAContextID context,
1890 unsigned int num_elements,
1895 case VAPictureParameterBufferType:
1896 va_TraceVAPictureParameterBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf);
1898 case VAIQMatrixBufferType:
1899 va_TraceVAIQMatrixBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf);
1901 case VABitPlaneBufferType:
1902 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
1904 case VASliceGroupMapBufferType:
1906 case VASliceParameterBufferType:
1907 va_TraceVASliceParameterBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf);
1909 case VASliceDataBufferType:
1910 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
1912 case VAMacroblockParameterBufferType:
1913 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
1915 case VAResidualDataBufferType:
1916 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
1918 case VADeblockingParameterBufferType:
1919 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
1921 case VAImageBufferType:
1923 case VAProtectedSliceDataBufferType:
1924 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
1926 case VAEncCodedBufferType:
1928 case VAEncSequenceParameterBufferType:
1929 va_TraceVAEncSequenceParameterBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf);
1931 case VAEncPictureParameterBufferType:
1932 va_TraceVAEncPictureParameterBufferMPEG4(dpy, context, buffer, type, size, num_elements, pbuf);
1934 case VAEncSliceParameterBufferType:
1935 va_TraceVAEncSliceParameterBuffer(dpy, context, buffer, type, size, num_elements, pbuf);
1943 static void va_TraceH264Buf(
1945 VAContextID context,
1949 unsigned int num_elements,
1956 case VAPictureParameterBufferType:
1957 va_TraceVAPictureParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
1959 case VAIQMatrixBufferType:
1960 va_TraceVAIQMatrixBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
1962 case VABitPlaneBufferType:
1963 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
1965 case VASliceGroupMapBufferType:
1966 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
1968 case VASliceParameterBufferType:
1969 va_TraceVASliceParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
1971 case VASliceDataBufferType:
1972 va_TraceVABuffers(dpy, context, buffer, type, trace_context[idx].trace_slice_size, num_elements, pbuf);
1974 case VAMacroblockParameterBufferType:
1975 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
1977 case VAResidualDataBufferType:
1978 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
1980 case VADeblockingParameterBufferType:
1981 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
1983 case VAImageBufferType:
1985 case VAProtectedSliceDataBufferType:
1986 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
1988 case VAEncCodedBufferType:
1990 case VAEncSequenceParameterBufferType:
1991 va_TraceVAEncSequenceParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
1993 case VAEncPictureParameterBufferType:
1994 va_TraceVAEncPictureParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
1996 case VAEncSliceParameterBufferType:
1997 va_TraceVAEncSliceParameterBufferH264(dpy, context, buffer, type, size, num_elements, pbuf);
1999 case VAEncMiscParameterBufferType:
2000 va_TraceVAEncMiscParameterBuffer(dpy, context, buffer, type, size, num_elements, pbuf);
2008 static void va_TraceVC1Buf(
2010 VAContextID context,
2014 unsigned int num_elements,
2021 case VAPictureParameterBufferType:
2022 va_TraceVAPictureParameterBufferVC1(dpy, context, buffer, type, size, num_elements, pbuf);
2024 case VAIQMatrixBufferType:
2026 case VABitPlaneBufferType:
2027 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2029 case VASliceGroupMapBufferType:
2030 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2032 case VASliceParameterBufferType:
2033 va_TraceVASliceParameterBufferVC1(dpy, context, buffer, type, size, num_elements, pbuf);
2035 case VASliceDataBufferType:
2036 va_TraceVABuffers(dpy, context, buffer, type, trace_context[idx].trace_slice_size, num_elements, pbuf);
2038 case VAMacroblockParameterBufferType:
2039 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2041 case VAResidualDataBufferType:
2042 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2044 case VADeblockingParameterBufferType:
2045 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2047 case VAImageBufferType:
2049 case VAProtectedSliceDataBufferType:
2050 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2052 case VAEncCodedBufferType:
2054 case VAEncSequenceParameterBufferType:
2055 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2057 case VAEncPictureParameterBufferType:
2058 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2060 case VAEncSliceParameterBufferType:
2061 va_TraceVABuffers(dpy, context, buffer, type, size, num_elements, pbuf);
2068 void va_TraceRenderPicture(
2070 VAContextID context,
2071 VABufferID *buffers,
2077 unsigned int num_elements;
2081 TRACE_FUNCNAME(idx);
2083 va_TraceMsg(idx, "\tcontext = 0x%08x\n", context);
2084 va_TraceMsg(idx, "\tnum_buffers = %d\n", num_buffers);
2085 for (i = 0; i < num_buffers; i++) {
2086 unsigned char *pbuf;
2089 /* get buffer type information */
2090 vaBufferInfo(dpy, context, buffers[i], &type, &size, &num_elements);
2092 va_TraceMsg(idx, "\t---------------------------\n");
2093 va_TraceMsg(idx, "\tbuffers[%d] = 0x%08x\n", i, buffers[i]);
2094 va_TraceMsg(idx, "\t type = %s\n", buffer_type_to_string(type));
2095 va_TraceMsg(idx, "\t size = %d\n", size);
2096 va_TraceMsg(idx, "\t num_elements = %d\n", num_elements);
2098 vaMapBuffer(dpy, buffers[i], (void **)&pbuf);
2100 switch (trace_context[idx].trace_profile) {
2101 case VAProfileMPEG2Simple:
2102 case VAProfileMPEG2Main:
2103 for (j=0; j<num_elements; j++) {
2104 va_TraceMsg(idx, "\t---------------------------\n", j);
2105 va_TraceMsg(idx, "\telement[%d] = ", j);
2106 va_TraceMPEG2Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
2109 case VAProfileMPEG4Simple:
2110 case VAProfileMPEG4AdvancedSimple:
2111 case VAProfileMPEG4Main:
2112 for (j=0; j<num_elements; j++) {
2113 va_TraceMsg(idx, "\t---------------------------\n", j);
2114 va_TraceMsg(idx, "\telement[%d] = ", j);
2115 va_TraceMPEG4Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
2118 case VAProfileH264Baseline:
2119 case VAProfileH264Main:
2120 case VAProfileH264High:
2121 case VAProfileH264ConstrainedBaseline:
2122 for (j=0; j<num_elements; j++) {
2123 va_TraceMsg(idx, "\t---------------------------\n", j);
2124 va_TraceMsg(idx, "\telement[%d] = ", j);
2126 va_TraceH264Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
2129 case VAProfileVC1Simple:
2130 case VAProfileVC1Main:
2131 case VAProfileVC1Advanced:
2132 for (j=0; j<num_elements; j++) {
2133 va_TraceMsg(idx, "\t---------------------------\n", j);
2134 va_TraceMsg(idx, "\telement[%d] = ", j);
2136 va_TraceVC1Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
2139 case VAProfileH263Baseline:
2140 for (j=0; j<num_elements; j++) {
2141 va_TraceMsg(idx, "\t---------------------------\n", j);
2142 va_TraceMsg(idx, "\telement[%d] = ", j);
2144 va_TraceH263Buf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
2147 case VAProfileJPEGBaseline:
2148 for (j=0; j<num_elements; j++) {
2149 va_TraceMsg(idx, "\t---------------------------\n", j);
2150 va_TraceMsg(idx, "\telement[%d] = ", j);
2152 va_TraceJPEGBuf(dpy, context, buffers[i], type, size, num_elements, pbuf + size*j);
2159 vaUnmapBuffer(dpy, buffers[i]);
2162 va_TraceMsg(idx, NULL);
2165 void va_TraceEndPicture(
2167 VAContextID context,
2171 int encode, decode, jpeg;
2174 TRACE_FUNCNAME(idx);
2176 if (endpic_done == 0) {
2177 va_TraceMsg(idx, "\tcontext = 0x%08x\n", context);
2178 va_TraceMsg(idx, "\trender_targets = 0x%08x\n", trace_context[idx].trace_rendertarget);
2181 encode = (trace_context[idx].trace_entrypoint == VAEntrypointEncSlice) &&
2182 (trace_flag & VA_TRACE_FLAG_SURFACE_ENCODE);
2183 decode = (trace_context[idx].trace_entrypoint == VAEntrypointVLD) &&
2184 (trace_flag & VA_TRACE_FLAG_SURFACE_DECODE);
2185 jpeg = (trace_context[idx].trace_entrypoint == VAEntrypointEncPicture) &&
2186 (trace_flag & VA_TRACE_FLAG_SURFACE_JPEG);
2188 /* want to trace encode source surface, do it before vaEndPicture */
2189 if ((encode || jpeg) && (endpic_done == 0))
2190 va_TraceSurface(dpy);
2192 /* want to trace encoode codedbuf, do it after vaEndPicture */
2193 if ((encode || jpeg) && (endpic_done == 1)) {
2194 /* force the pipleline finish rendering */
2195 vaSyncSurface(dpy, trace_context[idx].trace_rendertarget);
2196 va_TraceCodedBuf(dpy);
2199 /* want to trace decode dest surface, do it after vaEndPicture */
2200 if (decode && (endpic_done == 1)) {
2201 /* force the pipleline finish rendering */
2202 vaSyncSurface(dpy, trace_context[idx].trace_rendertarget);
2203 va_TraceSurface(dpy);
2205 va_TraceMsg(idx, NULL);
2208 void va_TraceSyncSurface(
2210 VASurfaceID render_target
2215 TRACE_FUNCNAME(idx);
2217 va_TraceMsg(idx, "\trender_target = 0x%08x\n", render_target);
2218 va_TraceMsg(idx, NULL);
2222 void va_TraceQuerySurfaceStatus(
2224 VASurfaceID render_target,
2225 VASurfaceStatus *status /* out */
2230 TRACE_FUNCNAME(idx);
2232 va_TraceMsg(idx, "\trender_target = 0x%08x\n", render_target);
2233 va_TraceMsg(idx, "\tstatus = 0x%08x\n", *status);
2234 va_TraceMsg(idx, NULL);
2238 void va_TraceQuerySurfaceError(
2240 VASurfaceID surface,
2241 VAStatus error_status,
2242 void **error_info /*out*/
2247 TRACE_FUNCNAME(idx);
2248 va_TraceMsg(idx, "\tsurface = 0x%08x\n", surface);
2249 va_TraceMsg(idx, "\terror_status = 0x%08x\n", error_status);
2250 if (error_status == VA_STATUS_ERROR_DECODING_ERROR) {
2251 VASurfaceDecodeMBErrors *p = *error_info;
2252 while (p->status != -1) {
2253 va_TraceMsg(idx, "\t\tstatus = %d\n", p->status);
2254 va_TraceMsg(idx, "\t\tstart_mb = %d\n", p->start_mb);
2255 va_TraceMsg(idx, "\t\tend_mb = %d\n", p->end_mb);
2256 p++; /* next error record */
2259 va_TraceMsg(idx, NULL);
2262 void va_TraceMaxNumDisplayAttributes (
2269 TRACE_FUNCNAME(idx);
2271 va_TraceMsg(idx, "\tmax_display_attributes = %d\n", number);
2272 va_TraceMsg(idx, NULL);
2275 void va_TraceQueryDisplayAttributes (
2277 VADisplayAttribute *attr_list, /* out */
2278 int *num_attributes /* out */
2285 va_TraceMsg(idx, "\tnum_attributes = %d\n", *num_attributes);
2287 for (i=0; i<*num_attributes; i++) {
2288 va_TraceMsg(idx, "\tattr_list[%d] =\n");
2289 va_TraceMsg(idx, "\t typ = 0x%08x\n", attr_list[i].type);
2290 va_TraceMsg(idx, "\t min_value = %d\n", attr_list[i].min_value);
2291 va_TraceMsg(idx, "\t max_value = %d\n", attr_list[i].max_value);
2292 va_TraceMsg(idx, "\t value = %d\n", attr_list[i].value);
2293 va_TraceMsg(idx, "\t flags = %d\n", attr_list[i].flags);
2295 va_TraceMsg(idx, NULL);
2299 static void va_TraceDisplayAttributes (
2301 VADisplayAttribute *attr_list,
2309 va_TraceMsg(idx, "\tnum_attributes = %d\n", num_attributes);
2310 for (i=0; i<num_attributes; i++) {
2311 va_TraceMsg(idx, "\tattr_list[%d] =\n");
2312 va_TraceMsg(idx, "\t typ = 0x%08x\n", attr_list[i].type);
2313 va_TraceMsg(idx, "\t min_value = %d\n", attr_list[i].min_value);
2314 va_TraceMsg(idx, "\t max_value = %d\n", attr_list[i].max_value);
2315 va_TraceMsg(idx, "\t value = %d\n", attr_list[i].value);
2316 va_TraceMsg(idx, "\t flags = %d\n", attr_list[i].flags);
2318 va_TraceMsg(idx, NULL);
2322 void va_TraceGetDisplayAttributes (
2324 VADisplayAttribute *attr_list,
2330 TRACE_FUNCNAME(idx);
2332 va_TraceDisplayAttributes (dpy, attr_list, num_attributes);
2335 void va_TraceSetDisplayAttributes (
2337 VADisplayAttribute *attr_list,
2343 TRACE_FUNCNAME(idx);
2345 va_TraceDisplayAttributes (dpy, attr_list, num_attributes);
2349 void va_TracePutSurface (
2351 VASurfaceID surface,
2352 void *draw, /* the target Drawable */
2355 unsigned short srcw,
2356 unsigned short srch,
2359 unsigned short destw,
2360 unsigned short desth,
2361 VARectangle *cliprects, /* client supplied clip list */
2362 unsigned int number_cliprects, /* number of clip rects in the clip list */
2363 unsigned int flags /* de-interlacing flags */
2368 TRACE_FUNCNAME(idx);
2370 va_TraceMsg(idx, "\tsurface = 0x%08x\n", surface);
2371 va_TraceMsg(idx, "\tdraw = 0x%08x\n", draw);
2372 va_TraceMsg(idx, "\tsrcx = %d\n", srcx);
2373 va_TraceMsg(idx, "\tsrcy = %d\n", srcy);
2374 va_TraceMsg(idx, "\tsrcw = %d\n", srcw);
2375 va_TraceMsg(idx, "\tsrch = %d\n", srch);
2376 va_TraceMsg(idx, "\tdestx = %d\n", destx);
2377 va_TraceMsg(idx, "\tdesty = %d\n", desty);
2378 va_TraceMsg(idx, "\tdestw = %d\n", destw);
2379 va_TraceMsg(idx, "\tdesth = %d\n", desth);
2380 va_TraceMsg(idx, "\tcliprects = 0x%08x\n", cliprects);
2381 va_TraceMsg(idx, "\tnumber_cliprects = %d\n", number_cliprects);
2382 va_TraceMsg(idx, "\tflags = 0x%08x\n", flags);
2383 va_TraceMsg(idx, NULL);