1 /*
2 * Copyright (c) 2011 Intel Corporation. All Rights Reserved.
3 * Copyright (c) Imagination Technologies Limited, UK
4 *
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:
12 *
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial portions
15 * of the Software.
16 *
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.
24 *
25 */
26
27 #include <errno.h>
28 #include <stdlib.h>
29 #include <unistd.h>
30 #include <stdint.h>
31 #include <string.h>
32 #include <limits.h>
33
34 #include "psb_drv_debug.h"
35 #include "tng_hostdefs.h"
36 #include "tng_hostheader.h"
37 #include "tng_picmgmt.h"
38 #include "tng_jpegES.h"
39 #include "tng_trace.h"
40
41 #include "hwdefs/topazhp_core_regs.h"
42 #include "hwdefs/topazhp_multicore_regs_old.h"
43 #include "hwdefs/topaz_db_regs.h"
44 #include "hwdefs/topaz_vlc_regs.h"
45 #include "hwdefs/mvea_regs.h"
46 #include "hwdefs/topazhp_default_params.h"
47
48 unsigned int dump_address_content = 1;
49
50 #define PRINT_ARRAY_NEW( FEILD, NUM) \
51 for(i=0;i< NUM;i++) { \
52 if(i%6==0) \
53 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\n\t\t"); \
54 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t0x%x", data->FEILD[i]); } \
55 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\n\t\t}\n");
56
57 #define PRINT_ARRAY_INT( FEILD, NUM) \
58 do { \
59 int tmp; \
60 \
61 for(tmp=0;tmp< NUM;tmp++) { \
62 if(tmp%6==0) \
63 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\n\t\t"); \
64 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t0x%08x", FEILD[tmp]); \
65 } \
66 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\n\t\t}\n"); \
67 } while (0)
68
69
70 #define PRINT_ARRAY_BYTE( FEILD, NUM) \
71 do { \
72 int tmp; \
73 \
74 for(tmp=0;tmp< NUM;tmp++) { \
75 if(tmp%8==0) \
76 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\n\t\t"); \
77 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t0x%02x", FEILD[tmp]); \
78 } \
79 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\n\t\t}\n"); \
80 } while (0)
81
82
83 /*
84 #define PRINT_ARRAY( FEILD, NUM) \
85 for(i=0;i< NUM;i++) \
86 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t0x%x", data->FEILD[i]); \
87 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\n\t\t}\n");
88 */
89
90 #define PRINT_ARRAY( FEILD, NUM) PRINT_ARRAY_NEW(FEILD, NUM)
91
92 #define PRINT_ARRAY_ADDR(STR, FEILD, NUM) \
93 do { \
94 int i = 0; \
95 unsigned char *virt; \
96 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\n"); \
97 for (i=0;i< NUM;i++) { \
98 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t%s[%02d]=x%08x\n", STR, i, data->FEILD[i]); \
99 } \
100 } while (0)
101
102 static int MTX_HEADER_PARAMS_dump(MTX_HEADER_PARAMS *p);
103
DO_HEADER_dump(MTX_HEADER_PARAMS * data)104 static int DO_HEADER_dump(MTX_HEADER_PARAMS *data)
105 {
106 MTX_HEADER_PARAMS *p = data;
107 unsigned char *q=(unsigned char *)data;
108
109 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t(===RawBits===)");
110 PRINT_ARRAY_BYTE(q, 128);
111
112 MTX_HEADER_PARAMS_dump(p);
113
114 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\n\n");
115
116 return 0;
117 }
118
JPEG_MTX_DMA_dump(JPEG_MTX_DMA_SETUP * data)119 static void JPEG_MTX_DMA_dump(JPEG_MTX_DMA_SETUP *data)
120 {
121 int i;
122 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t ComponentPlane{\n");
123 for(i=0;i<MTX_MAX_COMPONENTS ;i++)
124 {
125 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t\t ui32PhysAddr=%d\n",data->ComponentPlane[i].ui32PhysAddr);
126 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32Stride=%d",data->ComponentPlane[i].ui32Stride);
127 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32Height=%d\n",data->ComponentPlane[i].ui32Height);
128 }
129 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t }\n");
130 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t MCUComponent{\n");
131 for(i=0;i<MTX_MAX_COMPONENTS ;i++)
132 {
133 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t\t ui32WidthBlocks=%d",data->MCUComponent[i].ui32WidthBlocks);
134 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32HeightBlocks=%d",data->MCUComponent[i].ui32HeightBlocks);
135 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32XLimit=%d\n",data->MCUComponent[i].ui32XLimit);
136 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32YLimit=%d\n",data->MCUComponent[i].ui32YLimit);
137 }
138 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t }\n");
139 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t ui32ComponentsInScan =%d\n", data->ui32ComponentsInScan);
140 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t ui32TableA =%d\n", data->ui32TableA);
141 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t ui16DataInterleaveStatus =%d\n", data->ui16DataInterleaveStatus);
142 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t ui16MaxPipes =%d\n", data->ui16MaxPipes);
143 //drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t apWritebackRegions {");
144 //PRINT_ARRAY( apWritebackRegions, WB_FIFO_SIZE);
145 }
146
ISSUE_BUFFER_dump(MTX_ISSUE_BUFFERS * data)147 static void ISSUE_BUFFER_dump(MTX_ISSUE_BUFFERS *data)
148 {
149 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t ui32MCUPositionOfScanAndPipeNo =%d\n", data->ui32MCUPositionOfScanAndPipeNo);
150 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t ui32MCUCntAndResetFlag =%d\n", data->ui32MCUCntAndResetFlag);
151 }
152
JPEG_TABLE_dump(JPEG_MTX_QUANT_TABLE * data)153 static void JPEG_TABLE_dump(JPEG_MTX_QUANT_TABLE *data)
154 {
155 int i;
156 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t aui8LumaQuantParams {");
157 PRINT_ARRAY( aui8LumaQuantParams, QUANT_TABLE_SIZE_BYTES);
158 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t aui8ChromaQuantParams {");
159 PRINT_ARRAY( aui8ChromaQuantParams, QUANT_TABLE_SIZE_BYTES);
160 }
161
IMG_FRAME_TEMPLATE_TYPE2Str(IMG_FRAME_TEMPLATE_TYPE tmp)162 static char *IMG_FRAME_TEMPLATE_TYPE2Str(IMG_FRAME_TEMPLATE_TYPE tmp)
163 {
164 switch (tmp){
165 case IMG_FRAME_IDR:return "IMG_FRAME_IDR";
166 case IMG_FRAME_INTRA:return "IMG_FRAME_INTRA";
167 case IMG_FRAME_INTER_P:return "IMG_FRAME_INTER_P";
168 case IMG_FRAME_INTER_B:return "IMG_FRAME_INTER_B";
169 case IMG_FRAME_INTER_P_IDR:return "IMG_FRAME_INTER_P_IDR";
170 case IMG_FRAME_UNDEFINED:return "IMG_FRAME_UNDEFINED";
171 }
172
173 return "Undefined";
174 }
175
apReconstructured_dump(context_ENC_p ctx)176 static int apReconstructured_dump(context_ENC_p ctx)
177 {
178 int i;
179 context_ENC_mem* ps_mem = &(ctx->ctx_mem[0]);
180 context_ENC_mem_size *ps_mem_size = &(ctx->ctx_mem_size);
181 IMG_MTX_VIDEO_CONTEXT* data = NULL;
182
183 psb_buffer_map(&(ps_mem->bufs_mtx_context), &(ps_mem->bufs_mtx_context.virtual_addr));
184 if (ps_mem->bufs_mtx_context.virtual_addr == NULL) {
185 drv_debug_msg(VIDEO_DEBUG_ERROR, "%s error: mapping mtx context\n", __FUNCTION__);
186 return 0;
187 }
188 data = (IMG_MTX_VIDEO_CONTEXT*)(ps_mem->bufs_mtx_context.virtual_addr);
189 if (data == NULL) {
190 drv_debug_msg(VIDEO_DEBUG_ERROR,"%s data pointer is NULL\n", __FUNCTION__);
191 return 0;
192 }
193
194 data = (IMG_MTX_VIDEO_CONTEXT*)(ps_mem->bufs_mtx_context.virtual_addr);
195
196 psb_buffer_map(&(ps_mem->bufs_recon_pictures), &(ps_mem->bufs_recon_pictures.virtual_addr));
197 if (ps_mem->bufs_recon_pictures.virtual_addr == NULL) {
198 drv_debug_msg(VIDEO_DEBUG_ERROR, "%s error: mapping reconstructed buf\n", __FUNCTION__);
199 return 0;
200 }
201
202 for (i = 0; i < 8; i++) {
203 if (dump_address_content && data->apReconstructured[i]) {
204 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\tapReconstructured[%02d]=x%08x\n", i, data->apReconstructured[i]);
205 PRINT_ARRAY_BYTE(ps_mem->bufs_recon_pictures.virtual_addr, 64);
206 } else {
207 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\tapReconstructured[%02d]=x%08x = { }\n", i, data->apReconstructured[i]);
208 }
209 }
210
211 psb_buffer_unmap(&(ps_mem->bufs_mtx_context));
212 psb_buffer_unmap(&(ps_mem->bufs_recon_pictures));
213 return 0;
214 }
215
apColocated_dump(context_ENC_p ctx)216 static int apColocated_dump(context_ENC_p ctx)
217 {
218 int i;
219 context_ENC_mem* ps_mem = &(ctx->ctx_mem[0]);
220 context_ENC_mem_size *ps_mem_size = &(ctx->ctx_mem_size);
221 IMG_MTX_VIDEO_CONTEXT* data = NULL;
222
223 psb_buffer_map(&(ps_mem->bufs_mtx_context), &(ps_mem->bufs_mtx_context.virtual_addr));
224 if (ps_mem->bufs_mtx_context.virtual_addr == NULL) {
225 drv_debug_msg(VIDEO_DEBUG_ERROR, "%s error: mapping mtx context\n", __FUNCTION__);
226 return 0;
227 }
228 data = (IMG_MTX_VIDEO_CONTEXT*)(ps_mem->bufs_mtx_context.virtual_addr);
229 if (data == NULL) {
230 drv_debug_msg(VIDEO_DEBUG_ERROR,"%s data pointer is NULL\n", __FUNCTION__);
231 return 0;
232 }
233
234 data = (IMG_MTX_VIDEO_CONTEXT*)(ps_mem->bufs_mtx_context.virtual_addr);
235
236 psb_buffer_map(&(ps_mem->bufs_colocated), &(ps_mem->bufs_colocated.virtual_addr));
237 if (ps_mem->bufs_colocated.virtual_addr == NULL) {
238 drv_debug_msg(VIDEO_DEBUG_ERROR, "%s error: mapping colocated buf\n", __FUNCTION__);
239 return 0;
240 }
241
242 for (i = 0; i < 8; i++) {
243 if (dump_address_content && data->apReconstructured[i]) {
244 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\tapColocated[%02d]=x%08x\n", i, data->apColocated[i]);
245 PRINT_ARRAY_BYTE(ps_mem->bufs_colocated.virtual_addr, 64);
246 } else {
247 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\tapColocated[%02d]=x%08x = { }\n", i, data->apColocated[i]);
248 }
249 }
250
251 psb_buffer_unmap(&(ps_mem->bufs_mtx_context));
252 psb_buffer_unmap(&(ps_mem->bufs_colocated));
253 return 0;
254 }
255
apPV_dump(context_ENC_p ctx)256 static int apPV_dump(context_ENC_p ctx)
257 {
258 int i;
259 context_ENC_mem* ps_mem = &(ctx->ctx_mem[0]);
260 context_ENC_mem_size *ps_mem_size = &(ctx->ctx_mem_size);
261 IMG_MTX_VIDEO_CONTEXT* data = NULL;
262
263 psb_buffer_map(&(ps_mem->bufs_mtx_context), &(ps_mem->bufs_mtx_context.virtual_addr));
264 if (ps_mem->bufs_mtx_context.virtual_addr == NULL) {
265 drv_debug_msg(VIDEO_DEBUG_ERROR, "%s error: mapping mtx context\n", __FUNCTION__);
266 return 0;
267 }
268 data = (IMG_MTX_VIDEO_CONTEXT*)(ps_mem->bufs_mtx_context.virtual_addr);
269 if (data == NULL) {
270 drv_debug_msg(VIDEO_DEBUG_ERROR,"%s data pointer is NULL\n", __FUNCTION__);
271 return 0;
272 }
273
274 data = (IMG_MTX_VIDEO_CONTEXT*)(ps_mem->bufs_mtx_context.virtual_addr);
275
276 psb_buffer_map(&(ps_mem->bufs_mv), &(ps_mem->bufs_mv.virtual_addr));
277 if (ps_mem->bufs_mv.virtual_addr == NULL) {
278 drv_debug_msg(VIDEO_DEBUG_ERROR, "%s error: mapping apMV buf\n", __FUNCTION__);
279 return 0;
280 }
281
282 for (i = 0; i < 16; i++) {
283 if (dump_address_content && data->apMV[i]) {
284 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\tapMV[%02d]=x%08x\n", i, data->apMV[i]);
285 PRINT_ARRAY_BYTE(ps_mem->bufs_mv.virtual_addr, 64);
286 } else {
287 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\tapMV[%02d]=x%08x = { }\n", i, data->apMV[i]);
288 }
289 }
290
291 psb_buffer_unmap(&(ps_mem->bufs_mtx_context));
292 psb_buffer_unmap(&(ps_mem->bufs_mv));
293 return 0;
294 }
295
apWritebackRegions_dump(context_ENC_p ctx)296 static int apWritebackRegions_dump(context_ENC_p ctx)
297 {
298 int i;
299 context_ENC_mem* ps_mem = &(ctx->ctx_mem[0]);
300 context_ENC_mem_size *ps_mem_size = &(ctx->ctx_mem_size);
301 IMG_MTX_VIDEO_CONTEXT* data = NULL;
302
303 psb_buffer_map(&(ps_mem->bufs_mtx_context), &(ps_mem->bufs_mtx_context.virtual_addr));
304 if (ps_mem->bufs_mtx_context.virtual_addr == NULL) {
305 drv_debug_msg(VIDEO_DEBUG_ERROR, "%s error: mapping mtx context\n", __FUNCTION__);
306 return 0;
307 }
308 data = (IMG_MTX_VIDEO_CONTEXT*)(ps_mem->bufs_mtx_context.virtual_addr);
309 if (data == NULL) {
310 drv_debug_msg(VIDEO_DEBUG_ERROR,"%s data pointer is NULL\n", __FUNCTION__);
311 return 0;
312 }
313
314 data = (IMG_MTX_VIDEO_CONTEXT*)(ps_mem->bufs_mtx_context.virtual_addr);
315
316 psb_buffer_map(&(ctx->bufs_writeback), &(ctx->bufs_writeback.virtual_addr));
317 if (ctx->bufs_writeback.virtual_addr == NULL) {
318 drv_debug_msg(VIDEO_DEBUG_ERROR, "%s error: mapping write back buf\n", __FUNCTION__);
319 return 0;
320 }
321
322 for (i = 0; i < 32; i++) {
323 if (dump_address_content && data->apWritebackRegions[i]) {
324 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\tapWritebackRegions[%02d]=x%08x\n", i, data->apWritebackRegions[i]);
325 PRINT_ARRAY_BYTE(ctx->bufs_writeback.virtual_addr, 64);
326 } else {
327 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\tapWritebackRegions[%02d]=x%08x = { }\n", i, data->apWritebackRegions[i]);
328 }
329 }
330
331 psb_buffer_unmap(&(ps_mem->bufs_mtx_context));
332 psb_buffer_unmap(&(ctx->bufs_writeback));
333 return 0;
334 }
335
apSliceParamsTemplates_dump(context_ENC_p ctx,IMG_UINT32 ui32StreamIndex,IMG_UINT32 ui32SliceBufIdx)336 int apSliceParamsTemplates_dump(context_ENC_p ctx, IMG_UINT32 ui32StreamIndex, IMG_UINT32 ui32SliceBufIdx)
337 {
338 //IMG_FRAME_TEMPLATE_TYPE eSliceType = (IMG_FRAME_TEMPLATE_TYPE)ui32SliceType;
339 context_ENC_mem *ps_mem = &(ctx->ctx_mem[ui32StreamIndex]);
340 SLICE_PARAMS *p = NULL;
341
342 psb_buffer_map(&(ps_mem->bufs_slice_template), &(ps_mem->bufs_slice_template.virtual_addr));
343 if (ps_mem->bufs_slice_template.virtual_addr == NULL) {
344 drv_debug_msg(VIDEO_DEBUG_ERROR, "%s error: mapping slice template\n", __FUNCTION__);
345 return 0;
346 }
347
348 p = (SLICE_PARAMS*)(ps_mem->bufs_slice_template.virtual_addr + (ctx->ctx_mem_size.slice_template * ui32SliceBufIdx));
349
350 unsigned char *ptmp = (unsigned char*)&p->sSliceHdrTmpl;
351 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\tui32Flags=0x%08x\n", p->ui32Flags);
352 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\tui32SliceConfig=0x%08x\n", p->ui32SliceConfig);
353 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\tui32IPEControl=0x%08x\n", p->ui32IPEControl);
354 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\tui32SeqConfig=0x%08x\n", p->ui32SeqConfig);
355 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\teTemplateType=%s\n", IMG_FRAME_TEMPLATE_TYPE2Str(p->eTemplateType));
356
357 //PRINT_ARRAY_BYTE(ptmp, 64);
358
359 MTX_HEADER_PARAMS_dump(&p->sSliceHdrTmpl);
360
361 psb_buffer_unmap(&(ps_mem->bufs_slice_template));
362
363 return 0;
364 }
365
apPicHdrTemplates_dump(context_ENC_p ctx,IMG_UINT32 ui32StreamIndex,IMG_UINT32 count)366 static int apPicHdrTemplates_dump(context_ENC_p ctx, IMG_UINT32 ui32StreamIndex, IMG_UINT32 count)
367 {
368 uint32_t i;
369 context_ENC_mem *ps_mem = &(ctx->ctx_mem[ui32StreamIndex]);
370 MTX_HEADER_PARAMS *data;
371
372 psb_buffer_map(&(ps_mem->bufs_pic_template), &(ps_mem->bufs_pic_template.virtual_addr));
373 if (ps_mem->bufs_pic_template.virtual_addr == NULL) {
374 drv_debug_msg(VIDEO_DEBUG_ERROR, "%s error: mapping pic template\n", __FUNCTION__);
375 return 0;
376 }
377
378 for (i = 0; i < count; i++) {
379 data = (MTX_HEADER_PARAMS *)(ps_mem->bufs_pic_template.virtual_addr + ctx->ctx_mem_size.pic_template * i);
380 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\tapPicHdrTemplates[%02d]=0x%08x {\n", i, data);
381 PRINT_ARRAY_BYTE(data, 64); \
382 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t}\n");
383 }
384
385 data = (MTX_HEADER_PARAMS *)ps_mem->bufs_pic_template.virtual_addr;
386 MTX_HEADER_PARAMS_dump(data);
387
388 psb_buffer_unmap(&(ps_mem->bufs_pic_template));
389 return 0;
390 }
391
auui32SliceMap_dump(context_ENC_p ctx)392 static int auui32SliceMap_dump(context_ENC_p ctx)
393 {
394 int i;
395 context_ENC_mem* ps_mem = &(ctx->ctx_mem[0]);
396 context_ENC_mem_size *ps_mem_size = &(ctx->ctx_mem_size);
397 IMG_MTX_VIDEO_CONTEXT* data = NULL;
398
399 psb_buffer_map(&(ps_mem->bufs_mtx_context), &(ps_mem->bufs_mtx_context.virtual_addr));
400 if (ps_mem->bufs_mtx_context.virtual_addr == NULL) {
401 drv_debug_msg(VIDEO_DEBUG_ERROR, "%s error: mapping mtx context\n", __FUNCTION__);
402 return 0;
403 }
404 data = (IMG_MTX_VIDEO_CONTEXT*)(ps_mem->bufs_mtx_context.virtual_addr);
405 if (data == NULL) {
406 drv_debug_msg(VIDEO_DEBUG_ERROR,"%s data pointer is NULL\n", __FUNCTION__);
407 return 0;
408 }
409
410 data = (IMG_MTX_VIDEO_CONTEXT*)(ps_mem->bufs_mtx_context.virtual_addr);
411
412 psb_buffer_map(&(ps_mem->bufs_slice_map), &(ps_mem->bufs_slice_map.virtual_addr));
413 if (ps_mem->bufs_slice_map.virtual_addr == NULL) {
414 drv_debug_msg(VIDEO_DEBUG_ERROR, "%s error: mapping slice map buf\n", __FUNCTION__);
415 return 0;
416 }
417
418 for (i = 0; i < 9; i++) {
419 if (dump_address_content && data->aui32SliceMap[i]) {
420 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\taui32SliceMap[%02d]=x%08x\n", i, data->aui32SliceMap[i]);
421 PRINT_ARRAY_BYTE(ps_mem->bufs_slice_map.virtual_addr, 64);
422 } else {
423 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\taui32SliceMap[%02d]=x%08x = { }\n", i, data->aui32SliceMap[i]);
424 }
425 }
426
427 psb_buffer_unmap(&(ps_mem->bufs_mtx_context));
428 psb_buffer_unmap(&(ps_mem->bufs_slice_map));
429 return 0;
430 }
431
apSeqHeader_dump(context_ENC_p ctx,IMG_UINT32 ui32StreamIndex)432 static int apSeqHeader_dump(context_ENC_p ctx, IMG_UINT32 ui32StreamIndex)
433 {
434 MTX_HEADER_PARAMS *data;
435 context_ENC_mem *ps_mem = &(ctx->ctx_mem[ui32StreamIndex]);
436 tng_cmdbuf_p cmdbuf = ctx->obj_context->tng_cmdbuf;
437 IMG_RC_PARAMS *psRCParams = &(ctx->sRCParams);
438 H264_VUI_PARAMS *psVuiParams = &(ctx->sVuiParams);
439
440 psb_buffer_map(&(ps_mem->bufs_seq_header), &(ps_mem->bufs_seq_header.virtual_addr));
441 if (ps_mem->bufs_seq_header.virtual_addr == NULL) {
442 drv_debug_msg(VIDEO_DEBUG_ERROR, "%s error: mapping seq header\n", __FUNCTION__);
443 return 0;
444 }
445
446 data = (MTX_HEADER_PARAMS *)ps_mem->bufs_seq_header.virtual_addr;
447
448 DO_HEADER_dump(data);
449
450 psb_buffer_unmap(&(ps_mem->bufs_seq_header));
451 return 0;
452 }
453
pFirstPassOutParamAddr_dump(context_ENC_p ctx)454 static int pFirstPassOutParamAddr_dump(context_ENC_p ctx)
455 {
456 int i;
457 context_ENC_mem* ps_mem = &(ctx->ctx_mem[0]);
458 context_ENC_mem_size *ps_mem_size = &(ctx->ctx_mem_size);
459 IMG_MTX_VIDEO_CONTEXT* data= NULL;
460
461 psb_buffer_map(&(ps_mem->bufs_mtx_context), &(ps_mem->bufs_mtx_context.virtual_addr));
462 if (ps_mem->bufs_mtx_context.virtual_addr == NULL) {
463 drv_debug_msg(VIDEO_DEBUG_ERROR, "%s error: mapping mtx ctx buf\n", __FUNCTION__);
464 return 0;
465 }
466
467 data = (IMG_MTX_VIDEO_CONTEXT*)(ps_mem->bufs_mtx_context.virtual_addr);
468
469 // if enabled, return the input-control buffer corresponding to this slot
470 psb_buffer_map(&(ps_mem->bufs_first_pass_out_params), &(ps_mem->bufs_first_pass_out_params.virtual_addr));
471 if (ps_mem->bufs_first_pass_out_params.virtual_addr == NULL) {
472 drv_debug_msg(VIDEO_DEBUG_ERROR, "%s error: mapping first pass out param buf\n", __FUNCTION__);
473 return 0;
474 }
475
476 for (i=0; i < 9; i++) {
477 if (dump_address_content && data->pFirstPassOutParamAddr[i]) {
478 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\tpFirstPassOutParamAddr[%02d]=x%08x\n", i, data->pFirstPassOutParamAddr[i]);
479 PRINT_ARRAY_BYTE(ps_mem->bufs_first_pass_out_params.virtual_addr, 64);
480 } else {
481 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\tpFirstPassOutParamAddr[%02d]=x%08x = { }\n", i, data->pFirstPassOutParamAddr[i]);
482 }
483 }
484
485 psb_buffer_unmap(&(ps_mem->bufs_mtx_context));
486 psb_buffer_unmap(&(ps_mem->bufs_first_pass_out_params));
487 return 0;
488 }
489
pFirstPassOutBestMultipassParamAddr_dump(context_ENC_p ctx)490 static int pFirstPassOutBestMultipassParamAddr_dump(context_ENC_p ctx)
491 {
492 int i;
493 context_ENC_mem* ps_mem = &(ctx->ctx_mem[0]);
494 context_ENC_mem_size *ps_mem_size = &(ctx->ctx_mem_size);
495 IMG_MTX_VIDEO_CONTEXT* data= NULL;
496
497 psb_buffer_map(&(ps_mem->bufs_mtx_context), &(ps_mem->bufs_mtx_context.virtual_addr));
498 if (ps_mem->bufs_mtx_context.virtual_addr == NULL) {
499 drv_debug_msg(VIDEO_DEBUG_ERROR, "%s error: mapping mtx ctx buf\n", __FUNCTION__);
500 return 0;
501 }
502
503 data = (IMG_MTX_VIDEO_CONTEXT*)(ps_mem->bufs_mtx_context.virtual_addr);
504
505 // if enabled, return the input-control buffer corresponding to this slot
506 psb_buffer_map(&(ps_mem->bufs_first_pass_out_best_multipass_param), &(ps_mem->bufs_first_pass_out_best_multipass_param.virtual_addr));
507 if (ps_mem->bufs_first_pass_out_best_multipass_param.virtual_addr == NULL) {
508 drv_debug_msg(VIDEO_DEBUG_ERROR, "%s error: mapping first pass out param buf\n", __FUNCTION__);
509 return 0;
510 }
511
512 for (i=0; i < 9; i++) {
513 if (dump_address_content && data->pFirstPassOutBestMultipassParamAddr[i]) {
514 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\tpFirstPassOutBestMultipassParamAddr[%02d]=x%08x\n", i, data->pFirstPassOutBestMultipassParamAddr[i]);
515 PRINT_ARRAY_BYTE(ps_mem->bufs_first_pass_out_best_multipass_param.virtual_addr, 64);
516 } else {
517 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\tpFirstPassOutBestMultipassParamAddr[%02d]=x%08x = { }\n", i, data->pFirstPassOutBestMultipassParamAddr[i]);
518 }
519 }
520
521 psb_buffer_unmap(&(ps_mem->bufs_mtx_context));
522 psb_buffer_unmap(&(ps_mem->bufs_first_pass_out_best_multipass_param));
523 return 0;
524 }
525
pMBCtrlInParamsAddr_dump(context_ENC_p ctx,IMG_UINT32 __maybe_unused ui32StreamIndex)526 static int pMBCtrlInParamsAddr_dump(context_ENC_p ctx, IMG_UINT32 __maybe_unused ui32StreamIndex)
527 {
528 int i;
529 context_ENC_mem* ps_mem = &(ctx->ctx_mem[0]);
530 context_ENC_mem_size *ps_mem_size = &(ctx->ctx_mem_size);
531 IMG_MTX_VIDEO_CONTEXT* data= NULL;
532
533 psb_buffer_map(&(ps_mem->bufs_mtx_context), &(ps_mem->bufs_mtx_context.virtual_addr));
534 if (ps_mem->bufs_mtx_context.virtual_addr == NULL) {
535 drv_debug_msg(VIDEO_DEBUG_ERROR, "%s error: mapping mtx ctx buf\n", __FUNCTION__);
536 return 0;
537 }
538
539 data = (IMG_MTX_VIDEO_CONTEXT*)(ps_mem->bufs_mtx_context.virtual_addr);
540
541 // if enabled, return the input-control buffer corresponding to this slot
542 psb_buffer_map(&(ps_mem->bufs_mb_ctrl_in_params), &(ps_mem->bufs_mb_ctrl_in_params.virtual_addr));
543 if (ps_mem->bufs_mb_ctrl_in_params.virtual_addr == NULL) {
544 drv_debug_msg(VIDEO_DEBUG_ERROR, "%s error: mapping mb ctrl buf\n", __FUNCTION__);
545 return 0;
546 }
547
548 for (i=0; i < 9; i++) {
549 if (dump_address_content && data->pMBCtrlInParamsAddr[i]) {
550 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\tpMBCtrlInParamsAddr[%02d]=x%08x\n", i, data->pMBCtrlInParamsAddr[i]);
551 PRINT_ARRAY_BYTE(ps_mem->bufs_mb_ctrl_in_params.virtual_addr, 64);
552 } else {
553 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\tpMBCtrlInParamsAddr[%02d]=x%08x = { }\n", i, data->pMBCtrlInParamsAddr[i]);
554 }
555 }
556
557 psb_buffer_unmap(&(ps_mem->bufs_mtx_context));
558 psb_buffer_unmap(&(ps_mem->bufs_mb_ctrl_in_params));
559 return 0;
560 }
561
apAboveParams_dump(context_ENC_p ctx)562 static int apAboveParams_dump(context_ENC_p ctx)
563 {
564 int i;
565 context_ENC_mem* ps_mem = &(ctx->ctx_mem[0]);
566 context_ENC_mem_size *ps_mem_size = &(ctx->ctx_mem_size);
567 IMG_MTX_VIDEO_CONTEXT* data= NULL;
568
569 psb_buffer_map(&(ps_mem->bufs_mtx_context), &(ps_mem->bufs_mtx_context.virtual_addr));
570 if (ps_mem->bufs_mtx_context.virtual_addr == NULL) {
571 drv_debug_msg(VIDEO_DEBUG_ERROR, "%s error: mapping mtx ctx buf\n", __FUNCTION__);
572 return 0;
573 }
574
575 data = (IMG_MTX_VIDEO_CONTEXT*)(ps_mem->bufs_mtx_context.virtual_addr);
576
577 // if enabled, return the input-control buffer corresponding to this slot
578 psb_buffer_map(&(ps_mem->bufs_above_params), &(ps_mem->bufs_above_params.virtual_addr));
579 if (ps_mem->bufs_above_params.virtual_addr == NULL) {
580 drv_debug_msg(VIDEO_DEBUG_ERROR, "%s error: mapping above param ctrl buf\n", __FUNCTION__);
581 return 0;
582 }
583
584 for (i=0; i < 2; i++) {
585 if (dump_address_content && data->apAboveParams[i]) {
586 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\tapAboveParams[%02d]=x%08x\n", i, data->apAboveParams[i]);
587 PRINT_ARRAY_BYTE(ps_mem->bufs_above_params.virtual_addr, 64);
588 } else {
589 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\tapAboveParams[%02d]=x%08x = { }\n", i, data->apAboveParams[i]);
590 }
591 }
592
593 psb_buffer_unmap(&(ps_mem->bufs_mtx_context));
594 psb_buffer_unmap(&(ps_mem->bufs_above_params));
595 return 0;
596 }
597
aui32LTRefHeader_dump(context_ENC_p ctx)598 static int aui32LTRefHeader_dump(context_ENC_p ctx)
599 {
600 int i;
601 context_ENC_mem* ps_mem = &(ctx->ctx_mem[0]);
602 context_ENC_mem_size *ps_mem_size = &(ctx->ctx_mem_size);
603 IMG_MTX_VIDEO_CONTEXT* data = NULL;
604
605 psb_buffer_map(&(ps_mem->bufs_mtx_context), &(ps_mem->bufs_mtx_context.virtual_addr));
606 if (ps_mem->bufs_mtx_context.virtual_addr == NULL) {
607 drv_debug_msg(VIDEO_DEBUG_ERROR, "%s error: mapping mtx context\n", __FUNCTION__);
608 return 0;
609 }
610 data = (IMG_MTX_VIDEO_CONTEXT*)(ps_mem->bufs_mtx_context.virtual_addr);
611 if (data == NULL) {
612 drv_debug_msg(VIDEO_DEBUG_ERROR,"%s data pointer is NULL\n", __FUNCTION__);
613 return 0;
614 }
615
616 data = (IMG_MTX_VIDEO_CONTEXT*)(ps_mem->bufs_mtx_context.virtual_addr);
617
618 psb_buffer_map(&(ps_mem->bufs_lt_ref_header), &(ps_mem->bufs_lt_ref_header.virtual_addr));
619 if (ps_mem->bufs_lt_ref_header.virtual_addr == NULL) {
620 drv_debug_msg(VIDEO_DEBUG_ERROR, "%s error: mapping lt ref buf\n", __FUNCTION__);
621 return 0;
622 }
623
624 for (i = 0; i < 9; i++) {
625 if (dump_address_content && data->aui32LTRefHeader[i]) {
626 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\taui32LTRefHeader[%02d]=x%08x\n", i, data->aui32LTRefHeader[i]);
627 PRINT_ARRAY_BYTE(ps_mem->bufs_lt_ref_header.virtual_addr, 64);
628 } else {
629 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\taui32LTRefHeader[%02d]=x%08x = { }\n", i, data->aui32LTRefHeader[i]);
630 }
631 }
632
633 psb_buffer_unmap(&(ps_mem->bufs_mtx_context));
634 psb_buffer_unmap(&(ps_mem->bufs_lt_ref_header));
635 return 0;
636 }
637
tng_trace_setvideo(context_ENC_p ctx,IMG_UINT32 ui32StreamID)638 void tng_trace_setvideo(context_ENC_p ctx, IMG_UINT32 ui32StreamID)
639 {
640 unsigned int i;
641
642 context_ENC_mem *ps_mem = &(ctx->ctx_mem[ui32StreamID]);
643 context_ENC_mem_size *ps_mem_size = &(ctx->ctx_mem_size);
644 IMG_MTX_VIDEO_CONTEXT* data= NULL;
645
646 psb_buffer_map(&(ps_mem->bufs_mtx_context), &(ps_mem->bufs_mtx_context.virtual_addr));
647 if (ps_mem->bufs_mtx_context.virtual_addr == NULL) {
648 drv_debug_msg(VIDEO_DEBUG_ERROR, "%s error: mapping mtx context\n", __FUNCTION__);
649 return ;
650 }
651
652 data = (IMG_MTX_VIDEO_CONTEXT*)(ps_mem->bufs_mtx_context.virtual_addr);
653
654 if (data == NULL) {
655 drv_debug_msg(VIDEO_DEBUG_ERROR,"%s data pointer is NULL\n", __FUNCTION__);
656 return ;
657 }
658
659 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t==========IMG_MTX_VIDEO_CONTEXT=============\n");
660 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui64ClockDivBitrate=%lld\n", data->ui64ClockDivBitrate);
661 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32WidthInMbs=%d\n", data->ui32WidthInMbs);
662 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32PictureHeightInMbs=%d\n", data->ui32PictureHeightInMbs);
663 #ifdef FORCED_REFERENCE
664 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t apTmpReconstructured {");
665 PRINT_ARRAY_ADDR("apTmpReconstructured", apTmpReconstructured, MAX_PIC_NODES);
666 #endif
667 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t apReconstructured {\n");
668 apReconstructured_dump(ctx);
669 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t apColocated {\n");
670 apColocated_dump(ctx);
671 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t apMV {\n");
672 apPV_dump(ctx);
673 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t apInterViewMV {");
674 // PRINT_ARRAY( apInterViewMV, 2 );
675 PRINT_ARRAY_ADDR("apInterViewMV", apInterViewMV, 2);
676
677 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32DebugCRCs=0x%x\n", data->ui32DebugCRCs);
678 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t apWritebackRegions {\n");
679 apWritebackRegions_dump(ctx);
680 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32InitialCPBremovaldelayoffset=0x%x\n", data->ui32InitialCPBremovaldelayoffset);
681 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32MaxBufferMultClockDivBitrate=0x%x\n", data->ui32MaxBufferMultClockDivBitrate);
682 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t pSEIBufferingPeriodTemplate=0x%x\n", data->pSEIBufferingPeriodTemplate);
683 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t pSEIPictureTimingTemplate=0x%x\n", data->pSEIPictureTimingTemplate);
684 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t b16EnableMvc=%d\n", data->b16EnableMvc);
685 //drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t b16EnableInterViewReference=%d\n", data->b16EnableInterViewReference);
686 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui16MvcViewIdx=0x%x\n", data->ui16MvcViewIdx);
687
688 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t apSliceParamsTemplates {\n");
689 //PRINT_ARRAY_ADDR( apSliceParamsTemplates, 5);
690 for (i=0; i<5; i++) {
691 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\tapSliceParamsTemplates[%d]=0x%08x {\n", i, data->apSliceParamsTemplates[i]);
692 apSliceParamsTemplates_dump(ctx, 0, i);
693 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t}\n");
694 }
695
696 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t apPicHdrTemplates {\n");
697 apPicHdrTemplates_dump(ctx, 0, 5);
698
699 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t aui32SliceMap {\n");
700 auui32SliceMap_dump(ctx);
701
702 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32FlatGopStruct=0x%x\n", data->ui32FlatGopStruct);
703 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t apSeqHeader =0x%x\n", data->apSeqHeader);
704 apSeqHeader_dump(ctx, 0);
705
706 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t apSubSetSeqHeader =0x%x\n", data->apSubSetSeqHeader);
707 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t b16NoSequenceHeaders =0x%x\n", data->b16NoSequenceHeaders);
708
709 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t b8WeightedPredictionEnabled=%d\n", data->b8WeightedPredictionEnabled);
710 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui8MTXWeightedImplicitBiPred=0x%x\n", data->ui8MTXWeightedImplicitBiPred);
711 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t aui32WeightedPredictionVirtAddr {");
712 PRINT_ARRAY(aui32WeightedPredictionVirtAddr, MAX_SOURCE_SLOTS_SL);
713 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32HierarGopStruct=0x%x\n", data->ui32HierarGopStruct);
714
715 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t pFirstPassOutParamAddr {\n");
716 pFirstPassOutParamAddr_dump(ctx);
717 #ifndef EXCLUDE_BEST_MP_DECISION_DATA
718 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t pFirstPassOutBestMultipassParamAddr {");
719 pFirstPassOutBestMultipassParamAddr_dump(ctx);
720 #endif
721 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t pMBCtrlInParamsAddr {\n");
722 pMBCtrlInParamsAddr_dump(ctx, 0);
723
724 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32InterIntraScale{");
725 PRINT_ARRAY( ui32InterIntraScale, SCALE_TBL_SZ);
726 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32SkippedCodedScale {");
727 PRINT_ARRAY( ui32SkippedCodedScale, SCALE_TBL_SZ);
728
729
730 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32PicRowStride=0x%x\n", data->ui32PicRowStride);
731
732 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t apAboveParams {\n");
733 apAboveParams_dump(ctx);
734
735 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32IdrPeriod =0x%x\n ", data->ui32IdrPeriod);
736 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32IntraLoopCnt =0x%x\n", data->ui32IntraLoopCnt);
737 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32BFrameCount =0x%x\n", data->ui32BFrameCount);
738 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t b8Hierarchical=%d\n", data->b8Hierarchical);
739 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui8MPEG2IntraDCPrecision =0x%x\n", data->ui8MPEG2IntraDCPrecision);
740
741 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t aui8PicOnLevel {");
742 PRINT_ARRAY(aui8PicOnLevel, MAX_REF_LEVELS);
743 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32VopTimeResolution=0x%x\n", data->ui32VopTimeResolution);
744 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32InitialQp=0x%x\n", data->ui32InitialQp);
745 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32BUSize=0x%x\n", data->ui32BUSize);
746 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t sMVSettingsIdr { \n\t\t\tui32MVCalc_Below=0x%x\n \t\t\tui32MVCalc_Colocated=0x%x\n \t\t\tui32MVCalc_Config=0x%x\n \t\t}\n", data->sMVSettingsIdr.ui32MVCalc_Below,data->sMVSettingsIdr.ui32MVCalc_Colocated, data->sMVSettingsIdr.ui32MVCalc_Config);
747
748 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t sMVSettingsNonB { \n");
749 for(i=0;i<MAX_BFRAMES +1;i++)
750 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t\tui32MVCalc_Below=0x%x ui32MVCalc_Colocated=0x%x ui32MVCalc_Config=0x%x }\n", data->sMVSettingsNonB[i].ui32MVCalc_Below,data->sMVSettingsNonB[i].ui32MVCalc_Colocated, data->sMVSettingsNonB[i].ui32MVCalc_Config);
751 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t}\n");
752
753 drv_debug_msg(VIDEO_ENCODE_PDUMP," \t ui32MVSettingsBTable=0x%x\n", data->ui32MVSettingsBTable);
754 drv_debug_msg(VIDEO_ENCODE_PDUMP," \t ui32MVSettingsHierarchical=0x%x\n", data->ui32MVSettingsHierarchical);
755
756 #ifdef FIRMWARE_BIAS
757 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t aui32DirectBias_P {");
758 PRINT_ARRAY_NEW(aui32DirectBias_P,27 );
759 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t aui32InterBias_P {");
760 PRINT_ARRAY_NEW(aui32InterBias_P,27 );
761 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t aui32DirectBias_B {");
762 PRINT_ARRAY_NEW(aui32DirectBias_B,27 );
763 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t aui32InterBias_B {");
764 PRINT_ARRAY_NEW(aui32InterBias_B,27 );
765 #endif
766 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t eFormat=%d\n", data->eFormat);
767 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t eStandard=%d\n", data->eStandard);
768 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t eRCMode=%d\n", data->eRCMode);
769 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t b8FirstPic=%d\n", data->b8FirstPic);
770 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t b8IsInterlaced=%d\n", data->b8IsInterlaced);
771 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t b8TopFieldFirst=%d\n", data->b8TopFieldFirst);
772 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t b8ArbitrarySO=%d\n", data->b8ArbitrarySO);
773 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t bOutputReconstructed=%d\n", data->bOutputReconstructed);
774 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t b8DisableBitStuffing=%d\n", data->b8DisableBitStuffing);
775 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t b8InsertHRDparams=%d\n", data->b8InsertHRDparams);
776 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui8MaxSlicesPerPicture=%d\n", data->ui8MaxSlicesPerPicture);
777 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui8NumPipes=%d\n", data->ui8NumPipes);
778 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t bCARC=%d\n", data->bCARC);
779 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t iCARCBaseline=%d\n", data->iCARCBaseline);
780 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t uCARCThreshold=%d\n", data->uCARCThreshold);
781 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t uCARCCutoff=%d\n", data->uCARCCutoff);
782 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t uCARCNegRange=%d\n", data->uCARCNegRange);
783 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t uCARCNegScale=%d\n", data->uCARCNegScale);
784 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t uCARCPosRange=%d\n", data->uCARCPosRange);
785 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t uCARCPosScale=%d\n", data->uCARCPosScale);
786 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t uCARCShift=%d\n", data->uCARCShift);
787 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32MVClip_Config=%d\n", data->ui32MVClip_Config);
788 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32PredCombControl=%d\n", data->ui32PredCombControl);
789 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32LRITC_Tile_Use_Config=%d\n", data->ui32LRITC_Tile_Use_Config);
790 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32LRITC_Cache_Chunk_Config=%d\n", data->ui32LRITC_Cache_Chunk_Config);
791 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32IPEVectorClipping=%d\n", data->ui32IPEVectorClipping);
792 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32H264CompControl=%d\n", data->ui32H264CompControl);
793 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32H264CompIntraPredModes=%d\n", data->ui32H264CompIntraPredModes);
794 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32IPCM_0_Config=%d\n", data->ui32IPCM_0_Config);
795 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32IPCM_1_Config=%d\n", data->ui32IPCM_1_Config);
796 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32SPEMvdClipRange=%d\n", data->ui32SPEMvdClipRange);
797 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32JMCompControl=%d\n", data->ui32JMCompControl);
798 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32MBHostCtrl=%d\n", data->ui32MBHostCtrl);
799 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32DeblockCtrl=%d\n", data->ui32DeblockCtrl);
800
801 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32SkipCodedInterIntra=%d\n", data->ui32SkipCodedInterIntra);
802 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32VLCControl=%d\n", data->ui32VLCControl);
803 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32VLCSliceControl=%d\n", data->ui32VLCSliceControl);
804 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32VLCSliceMBControl=%d\n", data->ui32VLCSliceMBControl);
805 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui16CQPOffset=%d\n", data->ui16CQPOffset);
806 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t b8CodedHeaderPerSlice=%d\n", data->b8CodedHeaderPerSlice);
807 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32FirstPicFlags=%d\n", data->ui32FirstPicFlags);
808 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32NonFirstPicFlags=%d\n", data->ui32NonFirstPicFlags);
809
810 #ifndef EXCLUDE_ADAPTIVE_ROUNDING
811 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t bMCAdaptiveRoundingDisable=%d\n",data->bMCAdaptiveRoundingDisable);
812 int j;
813 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui16MCAdaptiveRoundingOffsets[18][4]");
814 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\n");
815 for(i=0;i<18;i++){
816 for(j=0;j<4;j++)
817 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t\t0x%x", data-> ui16MCAdaptiveRoundingOffsets[i][j]);
818 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\n");
819 }
820 #endif
821
822 #ifdef FORCED_REFERENCE
823 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32PatchedReconAddress=0x%x\n", data->ui32PatchedReconAddress);
824 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32PatchedRef0Address=0x%x\n", data->ui32PatchedRef0Address);
825 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui32PatchedRef1Address=0x%x\n", data->ui32PatchedRef1Address);
826 #endif
827 #ifdef LTREFHEADER
828 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t aui32LTRefHeader {\n");
829 aui32LTRefHeader_dump(ctx);
830 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t i8SliceHeaderSlotNum=%d\n",data->i8SliceHeaderSlotNum);
831 #endif
832 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t b8ReconIsLongTerm=%d\n", data->b8ReconIsLongTerm);
833 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t b8Ref0IsLongTerm=%d\n", data->b8Ref0IsLongTerm);
834 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t b8Ref1IsLongTerm=%d\n", data->b8Ref1IsLongTerm);
835 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui8RefSpacing=0x%x\n", data->ui8RefSpacing);
836
837 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui8FirstPipe=0x%x\n", data->ui8FirstPipe);
838 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui8LastPipe=0x%x\n", data->ui8LastPipe);
839 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t ui8PipesToUseFlags=0x%x\n", data->ui8PipesToUseFlags);
840
841 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t sInParams {\n");
842 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t ui16MBPerFrm=%d\n",data->sInParams.ui16MBPerFrm);
843 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t ui16MBPerBU=%d\n", data->sInParams.ui16MBPerBU);
844 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t ui16BUPerFrm=%d\n",data->sInParams.ui16BUPerFrm);
845 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t ui16IntraPerio=%d\n",data->sInParams.ui16IntraPeriod);
846 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t ui16BFrames=%d\n", data->sInParams.ui16BFrames);
847 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t bHierarchicalMode=%d\n",data->sInParams.mode.h264.bHierarchicalMode);
848 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t i32BitsPerFrm=%d\n", data->sInParams.i32BitsPerFrm);
849 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t i32BitsPerBU=%d\n", data->sInParams.i32BitsPerBU);
850 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t i32BitsPerMB=%d\n", data->sInParams.mode.other.i32BitsPerMB);
851 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t i32BitRate=%d\n",data->sInParams.i32BitRate);
852 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t i32BufferSiz=%d\n",data->sInParams.i32BufferSize );
853 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t i32InitialLevel=%d\n", data->sInParams.i32InitialLevel);
854 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t i32InitialDelay=%d\n", data->sInParams.i32InitialDelay);
855 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t i32BitsPerGOP=%d\n", data->sInParams.mode.other.i32BitsPerGOP);
856 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t ui16AvQPVal=%d\n", data->sInParams.mode.other.ui16AvQPVal);
857 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t ui16MyInitQP=%d\n",data->sInParams.mode.other.ui16MyInitQP);
858 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t ui32RCScaleFactor=%d\n",data->sInParams.mode.h264.ui32RCScaleFactor);
859 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t bScDetectDis;=%d\n", data->sInParams.mode.h264.bScDetectDisable);
860 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t bFrmSkipDisable=%d\n",data->sInParams.bFrmSkipDisable);
861 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t bBUSkipDisable=%d\n",data->sInParams.mode.other.bBUSkipDisable);
862 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t ui8SeInitQP=%d\n", data->sInParams.ui8SeInitQP );
863 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t ui8MinQPVal=%d\n", data->sInParams.ui8MinQPVal );
864 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t ui8MaxQPVal=%d\n", data->sInParams.ui8MaxQPVal );
865 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t ui8MBPerRow=%d\n", data->sInParams.ui8MBPerRow );
866 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t ui8ScaleFactor=%d\n", data->sInParams.ui8ScaleFactor);
867 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t ui8HalfFrame=%d\n", data->sInParams.mode.other.ui8HalfFrameRate);
868 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t ui8FCode=%d\n", data->sInParams.mode.other.ui8FCode);
869 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t i32TransferRate=%d\n",data->sInParams.mode.h264.i32TransferRate);
870
871 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t}\n");
872
873 psb_buffer_unmap(&(ps_mem->bufs_mtx_context));
874
875 return;
876 }
877
878 struct header_token {
879 int token;
880 char *str;
881 } header_tokens[] = {
882 {ELEMENT_STARTCODE_RAWDATA,"ELEMENT_STARTCODE_RAWDATA=0"},
883 {ELEMENT_STARTCODE_MIDHDR,"ELEMENT_STARTCODE_MIDHDR"},
884 {ELEMENT_RAWDATA,"ELEMENT_RAWDATA"},
885 {ELEMENT_QP,"ELEMENT_QP"},
886 {ELEMENT_SQP,"ELEMENT_SQP"},
887 {ELEMENT_FRAMEQSCALE,"ELEMENT_FRAMEQSCALE"},
888 {ELEMENT_SLICEQSCALE,"ELEMENT_SLICEQSCALE"},
889 {ELEMENT_INSERTBYTEALIGN_H264,"ELEMENT_INSERTBYTEALIGN_H264"},
890 {ELEMENT_INSERTBYTEALIGN_MPG4,"ELEMENT_INSERTBYTEALIGN_MPG4"},
891 {ELEMENT_INSERTBYTEALIGN_MPG2,"ELEMENT_INSERTBYTEALIGN_MPG2"},
892 {ELEMENT_VBV_MPG2,"ELEMENT_VBV_MPG2"},
893 {ELEMENT_TEMPORAL_REF_MPG2,"ELEMENT_TEMPORAL_REF_MPG2"},
894 {ELEMENT_CURRMBNR,"ELEMENT_CURRMBNR"},
895 {ELEMENT_FRAME_NUM,"ELEMENT_FRAME_NUM"},
896 {ELEMENT_TEMPORAL_REFERENCE,"ELEMENT_TEMPORAL_REFERENCE"},
897 {ELEMENT_EXTENDED_TR,"ELEMENT_EXTENDED_TR"},
898 {ELEMENT_IDR_PIC_ID,"ELEMENT_IDR_PIC_ID"},
899 {ELEMENT_PIC_ORDER_CNT,"ELEMENT_PIC_ORDER_CNT"},
900 {ELEMENT_GOB_FRAME_ID,"ELEMENT_GOB_FRAME_ID"},
901 {ELEMENT_VOP_TIME_INCREMENT,"ELEMENT_VOP_TIME_INCREMENT"},
902 {ELEMENT_MODULO_TIME_BASE,"ELEMENT_MODULO_TIME_BASE"},
903 {ELEMENT_BOTTOM_FIELD,"ELEMENT_BOTTOM_FIELD"},
904 {ELEMENT_SLICE_NUM,"ELEMENT_SLICE_NUM"},
905 {ELEMENT_MPEG2_SLICE_VERTICAL_POS,"ELEMENT_MPEG2_SLICE_VERTICAL_POS"},
906 {ELEMENT_MPEG2_IS_INTRA_SLICE,"ELEMENT_MPEG2_IS_INTRA_SLICE"},
907 {ELEMENT_MPEG2_PICTURE_STRUCTURE,"ELEMENT_MPEG2_PICTURE_STRUCTURE"},
908 {ELEMENT_REFERENCE,"ELEMENT_REFERENCE"},
909 {ELEMENT_ADAPTIVE,"ELEMENT_ADAPTIVE"},
910 {ELEMENT_DIRECT_SPATIAL_MV_FLAG,"ELEMENT_DIRECT_SPATIAL_MV_FLAG"},
911 {ELEMENT_NUM_REF_IDX_ACTIVE,"ELEMENT_NUM_REF_IDX_ACTIVE"},
912 {ELEMENT_REORDER_L0,"ELEMENT_REORDER_L0"},
913 {ELEMENT_REORDER_L1,"ELEMENT_REORDER_L1"},
914 {ELEMENT_TEMPORAL_ID,"ELEMENT_TEMPORAL_ID"},
915 {ELEMENT_ANCHOR_PIC_FLAG,"ELEMENT_ANCHOR_PIC_FLAG"},
916 {BPH_SEI_NAL_INITIAL_CPB_REMOVAL_DELAY,"BPH_SEI_NAL_INITIAL_CPB_REMOVAL_DELAY"},
917 {BPH_SEI_NAL_INITIAL_CPB_REMOVAL_DELAY_OFFSET,"BPH_SEI_NAL_INITIAL_CPB_REMOVAL_DELAY_OFFSET"},
918 {PTH_SEI_NAL_CPB_REMOVAL_DELAY,"PTH_SEI_NAL_CPB_REMOVAL_DELAY"},
919 {PTH_SEI_NAL_DPB_OUTPUT_DELAY,"PTH_SEI_NAL_DPB_OUTPUT_DELAY"},
920 {ELEMENT_SLICEWEIGHTEDPREDICTIONSTRUCT,"ELEMENT_SLICEWEIGHTEDPREDICTIONSTRUCT"},
921 {ELEMENT_CUSTOM_QUANT,"ELEMENT_CUSTOM_QUANT"}
922 };
923
header_to_str(int token)924 static char *header_to_str(int token)
925 {
926 unsigned int i;
927 struct header_token *p;
928
929 for (i=0; i<sizeof(header_tokens)/sizeof(struct header_token); i++) {
930 p = &header_tokens[i];
931 if (p->token == token)
932 return p->str;
933 }
934
935 return "Invalid header token";
936 }
937
MTX_HEADER_PARAMS_dump(MTX_HEADER_PARAMS * p)938 static int MTX_HEADER_PARAMS_dump(MTX_HEADER_PARAMS *p)
939 {
940 MTX_HEADER_ELEMENT *last_element=NULL;
941 unsigned int i;
942
943 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\tui32Elements=%d\n", p->ui32Elements);
944 for (i=0; i<p->ui32Elements; i++) {
945 MTX_HEADER_ELEMENT *q = &(p->asElementStream[0]);
946
947 if (last_element) {
948 int ui8Offset = 0;
949 IMG_UINT8 *ui8P;
950
951 if (last_element->Element_Type==ELEMENT_STARTCODE_RAWDATA ||
952 last_element->Element_Type==ELEMENT_RAWDATA ||
953 last_element->Element_Type==ELEMENT_STARTCODE_MIDHDR)
954 {
955 //Add a new element aligned to word boundary
956 //Find RAWBit size in bytes (rounded to word boundary))
957 ui8Offset=last_element->ui8Size+8+31; // NumberofRawbits (excluding size of bit count field)+ size of the bitcount field
958 ui8Offset/=32; //Now contains rawbits size in words
959 ui8Offset+=1; //Now contains rawbits+element_type size in words
960 ui8Offset*=4; //Convert to number of bytes (total size of structure in bytes, aligned to word boundary).
961 }
962 else
963 {
964 ui8Offset=4;
965 }
966 ui8P=(IMG_UINT8 *) last_element;
967 ui8P+=ui8Offset;
968 q=(MTX_HEADER_ELEMENT *) ui8P;
969 }
970
971 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t----Head %d----\n",i);
972 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t\tElement_Type=%d(0x%x:%s)\n",
973 q->Element_Type, q->Element_Type, header_to_str(q->Element_Type));
974
975 if (q->Element_Type==ELEMENT_STARTCODE_RAWDATA ||
976 q->Element_Type==ELEMENT_RAWDATA ||
977 q->Element_Type==ELEMENT_STARTCODE_MIDHDR) {
978 int i, ui8Offset = 0;
979 IMG_UINT8 *ui8P;
980
981 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t\tui8Size=%d(0x%x)\n", q->ui8Size, q->ui8Size);
982 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t\t(====aui8Bits===)");
983
984 //Find RAWBit size in bytes (rounded to word boundary))
985 ui8Offset=q->ui8Size+8+31; // NumberofRawbits (excluding size of bit count field)+ size of the bitcount field
986 ui8Offset/=32; //Now contains rawbits size in words
987 //ui8Offset+=1; //Now contains rawbits+element_type size in words
988 ui8Offset*=4; //Convert to number of bytes (total size of structure in bytes, aligned to word boundar
989
990 ui8P = &q->aui8Bits;
991 for (i=0; i<ui8Offset; i++) {
992 if ((i%8) == 0)
993 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\n\t\t\t");
994 drv_debug_msg(VIDEO_ENCODE_PDUMP,"0x%02x\t", *ui8P);
995 ui8P++;
996 }
997 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\n");
998 } else {
999 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\t\t(no ui8Size/aui8Bits for this type header)\n");
1000 }
1001
1002 last_element = q;
1003 }
1004
1005 return 0;
1006 }
1007
eBufferType2str(IMG_REF_BUFFER_TYPE tmp)1008 static char *eBufferType2str(IMG_REF_BUFFER_TYPE tmp)
1009 {
1010 switch (tmp) {
1011 case IMG_BUFFER_REF0:
1012 return "IMG_BUFFER_REF0";
1013 case IMG_BUFFER_REF1:
1014 return "IMG_BUFFER_REF1";
1015 case IMG_BUFFER_RECON:
1016 return "IMG_BUFFER_RECON";
1017 default:
1018 return "Unknown Buffer Type";
1019 }
1020 }
1021
PROVIDEBUFFER_SOURCE_dump(void * data)1022 static void PROVIDEBUFFER_SOURCE_dump(void *data)
1023 {
1024 IMG_SOURCE_BUFFER_PARAMS *source = (IMG_SOURCE_BUFFER_PARAMS*) data;
1025
1026 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\tui32PhysAddrYPlane_Field0=0x%x\n",source->ui32PhysAddrYPlane_Field0);
1027 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\tui32PhysAddrUPlane_Field0=0x%x\n",source->ui32PhysAddrUPlane_Field0);
1028 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\tui32PhysAddrVPlane_Field0=0x%x\n",source->ui32PhysAddrVPlane_Field0);
1029 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\tui32PhysAddrYPlane_Field1=0x%x\n",source->ui32PhysAddrYPlane_Field1);
1030 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\tui32PhysAddrUPlane_Field1=0x%x\n",source->ui32PhysAddrUPlane_Field1);
1031 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\tui32PhysAddrVPlane_Field1=0x%x\n",source->ui32PhysAddrVPlane_Field1);
1032 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\tui32HostContext=%d\n",source->ui32HostContext);
1033 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\tui8DisplayOrderNum=%d\n",source->ui8DisplayOrderNum);
1034 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\tui8SlotNum=%d\n",source->ui8SlotNum);
1035 return ;
1036 }
1037
PROVIDEBUFFER_dump(unsigned int data)1038 static int PROVIDEBUFFER_dump(unsigned int data)
1039 {
1040 IMG_REF_BUFFER_TYPE eBufType = (data & MASK_MTX_MSG_PROVIDE_REF_BUFFER_USE) >> SHIFT_MTX_MSG_PROVIDE_REF_BUFFER_USE;
1041 //IMG_BUFFER_DATA *bufdata = p->sData;
1042 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\t\teBufferType=(%s)\n", eBufferType2str(eBufType));
1043 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\n\n");
1044
1045 return 0;
1046 }
1047
eSubtype2str(IMG_PICMGMT_TYPE eSubtype)1048 static char *eSubtype2str(IMG_PICMGMT_TYPE eSubtype)
1049 {
1050 switch (eSubtype) {
1051 case IMG_PICMGMT_REF_TYPE:return "IMG_PICMGMT_REF_TYPE";
1052 case IMG_PICMGMT_GOP_STRUCT:return "IMG_PICMGMT_GOP_STRUCT";
1053 case IMG_PICMGMT_SKIP_FRAME:return "IMG_PICMGMT_SKIP_FRAME";
1054 case IMG_PICMGMT_EOS:return "IMG_PICMGMT_EOS";
1055 case IMG_PICMGMT_FLUSH:return "IMG_PICMGMT_FLUSH";
1056 case IMG_PICMGMT_QUANT:return "IMG_PICMGMT_QUANT";
1057 default: return "Unknow";
1058 }
1059 }
PICMGMT_dump(IMG_UINT32 data)1060 int PICMGMT_dump(IMG_UINT32 data)
1061 {
1062 IMG_PICMGMT_TYPE eSubType = (data & MASK_MTX_MSG_PICMGMT_SUBTYPE) >> SHIFT_MTX_MSG_PICMGMT_SUBTYPE;
1063 IMG_FRAME_TYPE eFrameType = 0;
1064 IMG_UINT32 ui32FrameCount = 0;
1065
1066 drv_debug_msg(VIDEO_ENCODE_PDUMP,
1067 "\t\teSubtype=%d(%s)\n", eSubType, eSubtype2str(eSubType));
1068 drv_debug_msg(VIDEO_ENCODE_PDUMP,
1069 "\t\t(=====(additional data)=====\n");
1070 switch (eSubType) {
1071 case IMG_PICMGMT_REF_TYPE:
1072 eFrameType = (data & MASK_MTX_MSG_PICMGMT_DATA) >> SHIFT_MTX_MSG_PICMGMT_DATA;
1073 switch (eFrameType) {
1074 case IMG_INTRA_IDR:
1075 drv_debug_msg(VIDEO_ENCODE_PDUMP,
1076 "\t\teFrameType=IMG_INTRA_IDR\n");
1077 break;
1078 case IMG_INTRA_FRAME:
1079 drv_debug_msg(VIDEO_ENCODE_PDUMP,
1080 "\t\teFrameType=IMG_INTRA_FRAME\n");
1081 break;
1082 case IMG_INTER_P:
1083 drv_debug_msg(VIDEO_ENCODE_PDUMP,
1084 "\t\teFrameType=IMG_INTER_P\n");
1085 break;
1086 case IMG_INTER_B:
1087 drv_debug_msg(VIDEO_ENCODE_PDUMP,
1088 "\t\teFrameType=IMG_INTER_B\n");
1089 break;
1090 }
1091 break;
1092 case IMG_PICMGMT_EOS:
1093 ui32FrameCount = (data & MASK_MTX_MSG_PICMGMT_DATA) >> SHIFT_MTX_MSG_PICMGMT_DATA;
1094 drv_debug_msg(VIDEO_ENCODE_PDUMP,
1095 "\t\tui32FrameCount=%d\n", ui32FrameCount);
1096 break;
1097 default:
1098 break;
1099 }
1100 drv_debug_msg(VIDEO_ENCODE_PDUMP,"\n\n");
1101
1102 return 0;
1103 }
1104
1105
cmd2str(int cmdid)1106 static char * cmd2str(int cmdid)
1107 {
1108 switch (cmdid) {
1109 case MTX_CMDID_NULL: return "MTX_CMDID_NULL";
1110 case MTX_CMDID_SHUTDOWN: return "MTX_CMDID_SHUTDOWN";
1111 // Video Commands
1112 case MTX_CMDID_DO_HEADER: return "MTX_CMDID_DO_HEADER";
1113 case MTX_CMDID_ENCODE_FRAME:return "MTX_CMDID_ENCODE_FRAME";
1114 case MTX_CMDID_START_FRAME: return "MTX_CMDID_START_FRAME";
1115 case MTX_CMDID_ENCODE_SLICE:return "MTX_CMDID_ENCODE_SLICE";
1116 case MTX_CMDID_END_FRAME: return "MTX_CMDID_END_FRAME";
1117 case MTX_CMDID_SETVIDEO: return "MTX_CMDID_SETVIDEO";
1118 case MTX_CMDID_GETVIDEO: return "MTX_CMDID_GETVIDEO";
1119 case MTX_CMDID_PICMGMT: return "MTX_CMDID_PICMGMT";
1120 case MTX_CMDID_RC_UPDATE: return "MTX_CMDID_RC_UPDATE";
1121 case MTX_CMDID_PROVIDE_SOURCE_BUFFER:return "MTX_CMDID_PROVIDE_SOURCE_BUFFER";
1122 case MTX_CMDID_PROVIDE_REF_BUFFER: return "MTX_CMDID_PROVIDE_REF_BUFFER";
1123 case MTX_CMDID_PROVIDE_CODED_BUFFER: return "MTX_CMDID_PROVIDE_CODED_BUFFER";
1124 case MTX_CMDID_ABORT: return "MTX_CMDID_ABORT";
1125 // JPEG commands
1126 case MTX_CMDID_SETQUANT: return "MTX_CMDID_SETQUANT";
1127 case MTX_CMDID_SETUP_INTERFACE: return "MTX_CMDID_SETUP_INTERFACE";
1128 case MTX_CMDID_ISSUEBUFF: return "MTX_CMDID_ISSUEBUFF";
1129 case MTX_CMDID_SETUP: return "MTX_CMDID_SETUP";
1130 case MTX_CMDID_ENDMARKER:
1131 default:
1132 return "Invalid Command (%d)";
1133 }
1134 }
1135
tng_H264ES_trace_seq_params(VAEncSequenceParameterBufferH264 * psTraceSeqParams)1136 void tng_H264ES_trace_seq_params(VAEncSequenceParameterBufferH264 *psTraceSeqParams)
1137 {
1138 drv_debug_msg(VIDEO_DEBUG_GENERAL,"%s: level_idc = 0x%08x\n", __FUNCTION__, psTraceSeqParams->level_idc);
1139 drv_debug_msg(VIDEO_DEBUG_GENERAL,"%s: max_num_ref_frames = 0x%08x\n", __FUNCTION__, psTraceSeqParams->max_num_ref_frames);
1140 drv_debug_msg(VIDEO_DEBUG_GENERAL,"%s: intra_idr_period = 0x%08x\n", __FUNCTION__, psTraceSeqParams->intra_idr_period);
1141 drv_debug_msg(VIDEO_DEBUG_GENERAL,"%s: intra_period = 0x%08x\n", __FUNCTION__, psTraceSeqParams->intra_period);
1142 drv_debug_msg(VIDEO_DEBUG_GENERAL,"%s: ip_period = 0x%08x\n", __FUNCTION__, psTraceSeqParams->ip_period);
1143 drv_debug_msg(VIDEO_DEBUG_GENERAL,"%s: bits_per_second = 0x%08x\n", __FUNCTION__, psTraceSeqParams->bits_per_second);
1144
1145 drv_debug_msg(VIDEO_DEBUG_GENERAL,"%s: frame_cropping_flag = 0x%08x\n", __FUNCTION__, psTraceSeqParams->frame_cropping_flag);
1146 drv_debug_msg(VIDEO_DEBUG_GENERAL,"%s: frame_crop_left_offset = 0x%08x\n", __FUNCTION__, psTraceSeqParams->frame_crop_left_offset);
1147 drv_debug_msg(VIDEO_DEBUG_GENERAL,"%s: frame_crop_right_offset = 0x%08x\n", __FUNCTION__, psTraceSeqParams->frame_crop_right_offset);
1148 drv_debug_msg(VIDEO_DEBUG_GENERAL,"%s: frame_crop_top_offset = 0x%08x\n", __FUNCTION__, psTraceSeqParams->frame_crop_top_offset);
1149 drv_debug_msg(VIDEO_DEBUG_GENERAL,"%s: frame_crop_bottom_offset = 0x%08x\n", __FUNCTION__, psTraceSeqParams->frame_crop_bottom_offset);
1150 return;
1151 }
1152
1153
tng_H264ES_trace_pic_params(VAEncPictureParameterBufferH264 * psTracePicParams)1154 void tng_H264ES_trace_pic_params(VAEncPictureParameterBufferH264 *psTracePicParams)
1155 {
1156 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s: CurrPic.picture_id = 0x%08x\n",__FUNCTION__, psTracePicParams->CurrPic.picture_id);
1157 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s: coded_buf = 0x%08x\n",__FUNCTION__, psTracePicParams->coded_buf);
1158
1159 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s: ReferenceFrames[0] = 0x%08x\n",__FUNCTION__, psTracePicParams->ReferenceFrames[0].picture_id);
1160 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s: ReferenceFrames[1] = 0x%08x\n",__FUNCTION__, psTracePicParams->ReferenceFrames[1].picture_id);
1161 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s: ReferenceFrames[2] = 0x%08x\n",__FUNCTION__, psTracePicParams->ReferenceFrames[2].picture_id);
1162 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s: ReferenceFrames[3] = 0x%08x\n",__FUNCTION__, psTracePicParams->ReferenceFrames[3].picture_id);
1163
1164 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s: pic_fields = 0x%08x\n",__FUNCTION__, psTracePicParams->pic_fields.value);
1165 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s: pic_init_qp = 0x%08x\n",__FUNCTION__, psTracePicParams->pic_init_qp);
1166 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s: last_picture = 0x%08x\n",__FUNCTION__, psTracePicParams->last_picture);
1167 return;
1168 }
1169
1170
tng_H264ES_trace_slice_params(VAEncSliceParameterBufferH264 * psTraceSliceParams)1171 void tng_H264ES_trace_slice_params(VAEncSliceParameterBufferH264 *psTraceSliceParams)
1172 {
1173 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s: disable_deblocking_filter_idc = 0x%08x\n",__FUNCTION__, psTraceSliceParams->disable_deblocking_filter_idc);
1174 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s: macroblock_address = 0x%08x\n",__FUNCTION__, psTraceSliceParams->macroblock_address);
1175 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s: num_macroblocks = 0x%08x\n",__FUNCTION__, psTraceSliceParams->num_macroblocks);
1176 return;
1177 }
1178
tng_H264ES_trace_misc_rc_params(VAEncMiscParameterRateControl * psTraceMiscRcParams)1179 void tng_H264ES_trace_misc_rc_params(VAEncMiscParameterRateControl *psTraceMiscRcParams)
1180 {
1181 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s bits_per_second = 0x%08x\n", __FUNCTION__, psTraceMiscRcParams->bits_per_second);
1182 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s window_size = 0x%08x\n", __FUNCTION__, psTraceMiscRcParams->window_size);
1183 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s initial_qp = 0x%08x\n", __FUNCTION__, psTraceMiscRcParams->initial_qp);
1184 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s min_qp = 0x%08x\n", __FUNCTION__, psTraceMiscRcParams->min_qp);
1185 return;
1186 }
1187
1188 /*********************************************************************/
tng_trace_seq_header_params(H264_SEQUENCE_HEADER_PARAMS * psSHParams)1189 void tng_trace_seq_header_params(H264_SEQUENCE_HEADER_PARAMS *psSHParams)
1190 {
1191 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s ucProfile = %x\n", __FUNCTION__, psSHParams->ucProfile);
1192 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s ucLevel = %x\n", __FUNCTION__, psSHParams->ucLevel);
1193 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s ucWidth_in_mbs_minus1 = %x\n", __FUNCTION__, psSHParams->ucWidth_in_mbs_minus1);
1194 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s ucHeight_in_maps_units_minus1 = %x\n", __FUNCTION__, psSHParams->ucHeight_in_maps_units_minus1);
1195 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s log2_max_pic_order_cnt = %x\n", __FUNCTION__, psSHParams->log2_max_pic_order_cnt);
1196 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s max_num_ref_frames = %x\n", __FUNCTION__, psSHParams->max_num_ref_frames);
1197 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s gaps_in_frame_num_value = %x\n", __FUNCTION__, psSHParams->gaps_in_frame_num_value);
1198 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s ucFrame_mbs_only_flag = %x\n", __FUNCTION__, psSHParams->ucFrame_mbs_only_flag);
1199 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s VUI_Params_Present = %x\n", __FUNCTION__, psSHParams->VUI_Params_Present);
1200 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s seq_scaling_matrix_present_flag = %x\n", __FUNCTION__, psSHParams->seq_scaling_matrix_present_flag);
1201 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s bUseDefaultScalingList = %x\n", __FUNCTION__, psSHParams->bUseDefaultScalingList);
1202 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s bIsLossless = %x\n", __FUNCTION__, psSHParams->bIsLossless);
1203 if (psSHParams->VUI_Params_Present) {
1204 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s Time_Scale = %x\n", __FUNCTION__, psSHParams->VUI_Params.Time_Scale); //!< Time scale as defined in the H.264 specification
1205 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s bit_rate_value_minus1 = %x\n", __FUNCTION__, psSHParams->VUI_Params.bit_rate_value_minus1); //!< An inter framebitrate/64)-1
1206 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s cbp_size_value_minus1 = %x\n", __FUNCTION__, psSHParams->VUI_Params.cbp_size_value_minus1); //!< An inter frame(bitrate*1.5)/16
1207 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s CBR = %x\n", __FUNCTION__, psSHParams->VUI_Params.CBR); //!< CBR as defined in the H.264 specification
1208 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s initial_cpb_removal = %x\n", __FUNCTION__, psSHParams->VUI_Params.initial_cpb_removal_delay_length_minus1); //!< as defined in the H.264 specification
1209 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s cpb_removal_delay_length_minus1 = %x\n", __FUNCTION__, psSHParams->VUI_Params.cpb_removal_delay_length_minus1); //!< as defined in the H.264 specification
1210 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s dpb_output_delay_length_minus1 = %x\n", __FUNCTION__, psSHParams->VUI_Params.dpb_output_delay_length_minus1); //!< as defined in the H.264 specification
1211 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s time_offset_length = %x\n", __FUNCTION__, psSHParams->VUI_Params.time_offset_length); //!< as defined in the H.264 specification
1212 }
1213 }
1214
tng_trace_pic_header_params(H264_PICTURE_HEADER_PARAMS * psSHParams)1215 void tng_trace_pic_header_params(H264_PICTURE_HEADER_PARAMS *psSHParams)
1216 {
1217 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s pic_parameter_set_id; = %x\n", __FUNCTION__, psSHParams->pic_parameter_set_id);
1218 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s seq_parameter_set_id; = %x\n", __FUNCTION__, psSHParams->seq_parameter_set_id);
1219 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s entropy_coding_mode_flag; = %x\n", __FUNCTION__, psSHParams->entropy_coding_mode_flag);
1220 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s weighted_pred_flag; = %x\n", __FUNCTION__, psSHParams->weighted_pred_flag);
1221 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s weighted_bipred_idc; = %x\n", __FUNCTION__, psSHParams->weighted_bipred_idc);
1222 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s chroma_qp_index_offset; = %x\n", __FUNCTION__, psSHParams->chroma_qp_index_offset);
1223 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s constrained_intra_pred_flag; = %x\n", __FUNCTION__, psSHParams->constrained_intra_pred_flag);
1224 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s transform_8x8_mode_flag; = %x\n", __FUNCTION__, psSHParams->transform_8x8_mode_flag);
1225 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s pic_scaling_matrix_present_flag = %x\n", __FUNCTION__, psSHParams->pic_scaling_matrix_present_flag);
1226 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s bUseDefaultScalingList; = %x\n", __FUNCTION__, psSHParams->bUseDefaultScalingList);
1227 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s second_chroma_qp_index_offset; = %x\n", __FUNCTION__, psSHParams->second_chroma_qp_index_offset);
1228
1229 }
1230
tng_trace_slice_header_params(H264_SLICE_HEADER_PARAMS * psSlHParams)1231 void tng_trace_slice_header_params(H264_SLICE_HEADER_PARAMS *psSlHParams)
1232 {
1233 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s: start addr = 0x%08x\n", __FUNCTION__, psSlHParams);
1234 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.ui8Start_Code_Prefix_Size_Bytes 0x%08x\n", psSlHParams->ui8Start_Code_Prefix_Size_Bytes);
1235 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.SliceFrame_Type 0x%08x\n", psSlHParams->SliceFrame_Type);
1236 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.First_MB_Address 0x%08x\n", psSlHParams->First_MB_Address);
1237 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.Frame_Num_DO 0x%08x\n", psSlHParams->Frame_Num_DO);
1238 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.Idr_Pic_Id 0x%08x\n", psSlHParams->Idr_Pic_Id);
1239 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.log2_max_pic_order_cnt 0x%08x\n", psSlHParams->log2_max_pic_order_cnt);
1240 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.Picture_Num_DO 0x%08x\n", psSlHParams->Picture_Num_DO);
1241 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.Disable_Deblocking_Filter_Idc 0x%08x\n", psSlHParams->Disable_Deblocking_Filter_Idc);
1242 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.bPiCInterlace 0x%08x\n", psSlHParams->bPiCInterlace);
1243 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.bFieldType 0x%08x\n", psSlHParams->bFieldType);
1244 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.bReferencePicture 0x%08x\n", psSlHParams->bReferencePicture);
1245 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.iDebAlphaOffsetDiv2 0x%08x\n", psSlHParams->iDebAlphaOffsetDiv2);
1246 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.iDebBetaOffsetDiv2 0x%08x\n", psSlHParams->iDebBetaOffsetDiv2);
1247 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.direct_spatial_mv_pred_flag 0x%08x\n", psSlHParams->direct_spatial_mv_pred_flag);
1248 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.num_ref_idx_l0_active_minus1 0x%08x\n", psSlHParams->num_ref_idx_l0_active_minus1);
1249
1250 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.diff_ref_pic_num[0] 0x%08x\n", psSlHParams->diff_ref_pic_num[0]);
1251 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.diff_ref_pic_num[1] 0x%08x\n", psSlHParams->diff_ref_pic_num[1]);
1252 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.weighted_pred_flag 0x%08x\n", psSlHParams->weighted_pred_flag);
1253 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.weighted_bipred_idc 0x%08x\n", psSlHParams->weighted_bipred_idc);
1254
1255 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.luma_log2_weight_denom 0x%08x\n", psSlHParams->luma_log2_weight_denom);
1256 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.chroma_log2_weight_denom 0x%08x\n", psSlHParams->chroma_log2_weight_denom);
1257 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.luma_weight_l0_flag[0] 0x%08x\n", psSlHParams->luma_weight_l0_flag[0]);
1258 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.luma_weight_l0_flag[1] 0x%08x\n", psSlHParams->luma_weight_l0_flag[1]);
1259
1260 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.SlHParams.luma_weight_l0[0] 0x%08x\n", psSlHParams->luma_weight_l0[0]);
1261 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.SlHParams.luma_weight_l0[1] 0x%08x\n", psSlHParams->luma_weight_l0[1]);
1262 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.luma_offset_l0[0] 0x%08x\n", psSlHParams->luma_offset_l0[0]);
1263 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.luma_offset_l0[1] 0x%08x\n", psSlHParams->luma_offset_l0[1]);
1264
1265 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.chroma_weight_l0_flag[0] 0x%08x\n", psSlHParams->chroma_weight_l0_flag[0]);
1266 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.chroma_weight_l0_flag[1] 0x%08x\n", psSlHParams->chroma_weight_l0_flag[1]);
1267 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.chromaB_weight_l0[0] 0x%08x\n", psSlHParams->chromaB_weight_l0[0]);
1268 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.chromaB_offset_l0[0] 0x%08x\n", psSlHParams->chromaB_offset_l0[0]);
1269 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.chromaR_weight_l0[0] 0x%08x\n", psSlHParams->chromaR_weight_l0[0]);
1270 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.chromaR_offset_l0[0] 0x%08x\n", psSlHParams->chromaR_offset_l0[0]);
1271 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.chromaB_weight_l0[1] 0x%08x\n", psSlHParams->chromaB_weight_l0[1]);
1272 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.chromaB_offset_l0[1] 0x%08x\n", psSlHParams->chromaB_offset_l0[1]);
1273 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.chromaR_weight_l0[1] 0x%08x\n", psSlHParams->chromaR_weight_l0[1]);
1274 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.chromaR_offset_l0[1] 0x%08x\n", psSlHParams->chromaR_offset_l0[1]);
1275
1276 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.ui16MvcViewIdx 0x%08x\n", psSlHParams->ui16MvcViewIdx);
1277 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.bIsLongTermRef 0x%08x\n", psSlHParams->bIsLongTermRef);
1278 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.uLongTermRefNum 0x%08x\n", psSlHParams->uLongTermRefNum);
1279 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.bRefIsLongTermRef[0] 0x%08x\n", psSlHParams->bRefIsLongTermRef[0]);
1280 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.bRefIsLongTermRef[1] 0x%08x\n", psSlHParams->bRefIsLongTermRef[1]);
1281 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.uRefLongTermRefNum[0] 0x%08x\n", psSlHParams->uRefLongTermRefNum[0]);
1282 drv_debug_msg(VIDEO_DEBUG_GENERAL, "SlHParams.uRefLongTermRefNum[1] 0x%08x\n", psSlHParams->uRefLongTermRefNum[1]);
1283 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s: end \n", __FUNCTION__);
1284 }
1285
tng__trace_seqconfig(IMG_BOOL bIsBPicture,IMG_BOOL bFieldMode,IMG_UINT8 ui8SwapChromas,IMG_BOOL32 ui32FrameStoreFormat,IMG_UINT8 uiDeblockIDC)1286 void tng__trace_seqconfig(
1287 IMG_BOOL bIsBPicture,
1288 IMG_BOOL bFieldMode,
1289 IMG_UINT8 ui8SwapChromas,
1290 IMG_BOOL32 ui32FrameStoreFormat,
1291 IMG_UINT8 uiDeblockIDC)
1292 {
1293 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s ui32SeqConfig 0x%08x\n", __FUNCTION__, F_ENCODE(0, TOPAZHP_CR_TEMPORAL_PIC0_BELOW_IN_VALID) );
1294 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s ui32SeqConfig 0x%08x\n", __FUNCTION__, F_ENCODE(0, TOPAZHP_CR_TEMPORAL_PIC1_BELOW_IN_VALID) );
1295 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s ui32SeqConfig 0x%08x\n", __FUNCTION__, F_ENCODE(0, TOPAZHP_CR_ABOVE_OUT_OF_SLICE_VALID) );
1296 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s ui32SeqConfig 0x%08x\n", __FUNCTION__, F_ENCODE(1, TOPAZHP_CR_WRITE_TEMPORAL_PIC0_BELOW_VALID) );
1297 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s ui32SeqConfig 0x%08x\n", __FUNCTION__, F_ENCODE(0, TOPAZHP_CR_REF_PIC0_VALID) );
1298 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s ui32SeqConfig 0x%08x\n", __FUNCTION__, F_ENCODE(0, TOPAZHP_CR_REF_PIC1_VALID) );
1299 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s ui32SeqConfig 0x%08x\n", __FUNCTION__, F_ENCODE(!bIsBPicture, TOPAZHP_CR_REF_PIC1_EQUAL_PIC0) );
1300 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s ui32SeqConfig 0x%08x\n", __FUNCTION__, F_ENCODE(bFieldMode ? 1 : 0 , TOPAZHP_CR_FIELD_MODE) );
1301 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s ui32SeqConfig 0x%08x\n", __FUNCTION__, F_ENCODE(ui8SwapChromas, TOPAZHP_CR_FRAME_STORE_CHROMA_SWAP) );
1302 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s ui32SeqConfig 0x%08x\n", __FUNCTION__, F_ENCODE(ui32FrameStoreFormat, TOPAZHP_CR_FRAME_STORE_FORMAT) );
1303 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s ui32SeqConfig 0x%08x\n", __FUNCTION__, F_ENCODE(TOPAZHP_CR_ENCODER_STANDARD_H264, TOPAZHP_CR_ENCODER_STANDARD) );
1304 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s ui32SeqConfig 0x%08x\n", __FUNCTION__, F_ENCODE(uiDeblockIDC == 1 ? 0 : 1, TOPAZHP_CR_DEBLOCK_ENABLE));
1305 }
1306
tng__trace_seq_header(void * pointer)1307 void tng__trace_seq_header(void* pointer)
1308 {
1309 context_ENC_p ctx = NULL;
1310 if (pointer == NULL)
1311 return ;
1312
1313 ctx = (context_ENC_p)pointer;
1314
1315 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s: ucProfile = %d\n", __FUNCTION__, ctx->ui8ProfileIdc);
1316 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s: ucLevel = %d\n", __FUNCTION__, ctx->ui8LevelIdc);
1317 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s: ui16Width = %d\n", __FUNCTION__, ctx->ui16Width);
1318 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s: ui16PictureHeight = %d\n", __FUNCTION__, ctx->ui16PictureHeight);
1319 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s: ui32CustomQuantMask = %d\n", __FUNCTION__, ctx->ui32CustomQuantMask);
1320 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s: ui8FieldCount = %d\n", __FUNCTION__, ctx->ui8FieldCount);
1321 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s: ui8MaxNumRefFrames = %d\n", __FUNCTION__, ctx->ui8MaxNumRefFrames);
1322 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s: bPpsScaling = %d\n", __FUNCTION__, ctx->bPpsScaling);
1323 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s: bUseDefaultScalingList = %d\n", __FUNCTION__, ctx->bUseDefaultScalingList);
1324 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s: bEnableLossless = %d\n", __FUNCTION__, ctx->bEnableLossless);
1325 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s: bArbitrarySO = %d\n", __FUNCTION__, ctx->bArbitrarySO);
1326 drv_debug_msg(VIDEO_DEBUG_GENERAL, "%s: vui_flag = %d\n", __FUNCTION__, ctx->sVuiParams.vui_flag);
1327 }
1328
1329