aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbuddy.liong2013-11-12 16:02:28 -0600
committerbuddy.liong2013-11-15 16:26:38 -0600
commit2f4b8635e4c6717dfe963ea6d43d5aff000b0e12 (patch)
tree9638a0a2231f7796c3f6fe543ed6954d01049e4f /test_qnx
parent88e44817f587050b9bcd4f241f8ea10483fc2cf6 (diff)
downloadrepo-libdce-2f4b8635e4c6717dfe963ea6d43d5aff000b0e12.tar.gz
repo-libdce-2f4b8635e4c6717dfe963ea6d43d5aff000b0e12.tar.xz
repo-libdce-2f4b8635e4c6717dfe963ea6d43d5aff000b0e12.zip
[LIBDCE] Add non-TILER output buffer for dce_enc_test
Internal reference: DVT OMAPS00302160 To add capability for the QNX dce_enc_test to use buffer allocated through shmallocator instead of TILER memory on the output buffer. For input buffer, based on the TI encoder codec user guide document, it must be configured as 2D TILER buffer. Change-Id: I0cdda0ff1ddc607f9df41172bc45b6cf3010b95f Signed-off-by: buddy.liong <buddy.budiono@ti.com>
Diffstat (limited to 'test_qnx')
-rw-r--r--test_qnx/dce_enc_test/dce_enc_test.c232
1 files changed, 108 insertions, 124 deletions
diff --git a/test_qnx/dce_enc_test/dce_enc_test.c b/test_qnx/dce_enc_test/dce_enc_test.c
index b3a2594..dabba7a 100644
--- a/test_qnx/dce_enc_test/dce_enc_test.c
+++ b/test_qnx/dce_enc_test/dce_enc_test.c
@@ -50,6 +50,8 @@
50#include <ti/sdo/codecs/h264enc/ih264enc.h> 50#include <ti/sdo/codecs/h264enc/ih264enc.h>
51#include <ti/sdo/codecs/mpeg4enc/impeg4enc.h> 51#include <ti/sdo/codecs/mpeg4enc/impeg4enc.h>
52 52
53#include "ti/shmemallocator/SharedMemoryAllocatorUsr.h"
54
53 55
54#define OMAP5 56#define OMAP5
55 57
@@ -69,12 +71,9 @@
69/* align x to next highest multiple of 2^n */ 71/* align x to next highest multiple of 2^n */
70#define ALIGN2(x, n) (((x) + ((1 << (n)) - 1)) & ~((1 << (n)) - 1)) 72#define ALIGN2(x, n) (((x) + ((1 << (n)) - 1)) & ~((1 << (n)) - 1))
71 73
72// Profile the init and decode calls 74// Profile the init and encode calls
73//#define PROFILE_TIME 75//#define PROFILE_TIME
74 76
75// NON-TILER OUTPUT configuration
76//#define NON_TILER_OUTPUT
77
78enum { 77enum {
79 IVAHD_H264_ENCODE, 78 IVAHD_H264_ENCODE,
80 IVAHD_MPEG4_ENCODE, 79 IVAHD_MPEG4_ENCODE,
@@ -158,52 +157,7 @@ static void *tiler_alloc(int width, int height)
158 return (bufPtr); 157 return (bufPtr);
159} 158}
160 159
161#ifdef NON_TILER_OUTPUT 160static int allocate_nonTiler(shm_buf* shmBuf, int size)
162static XDAS_Int16
163get_mem_type (SSPtr paddr)
164{
165 if((0x60000000 <= paddr) && (paddr < 0x68000000)) {
166 return (XDM_MEMTYPE_TILED8);
167 }
168 if((0x68000000 <= paddr) && (paddr < 0x70000000)) {
169 return (XDM_MEMTYPE_TILED16);
170 }
171 if((0x70000000 <= paddr) && (paddr < 0x78000000)) {
172 return (XDM_MEMTYPE_TILED32);
173 }
174 if((0x78000000 <= paddr) && (paddr < 0x80000000)) {
175 return (XDM_MEMTYPE_RAW);
176 }
177 return (-1);
178}
179
180/*! @brief Start address of DDR region for 1GB RAM */
181#define DDR_1G_ADDRESS_START 0x80000000
182/*! @brief End address of DDR region for 1GB RAM */
183#define DDR_1G_ADDRESS_END 0xBFFFFFFF
184#define DDR_1G_DUCATI_OFFSET 0x40000000
185
186/*! @brief Start address of DDR region for 2GB RAM */
187#define DDR_2G_ADDRESS_START 0xC0000000
188/*! @brief End address of DDR region for 2GB RAM */
189#define DDR_2G_ADDRESS_END 0xFFFFFFFF
190#define DDR_2G_DUCATI_OFFSET 0xA0000000
191
192static Int
193SysLinkMemUtils_translateAddr (UInt32 physAddr)
194{
195 Int ret = 0;
196
197 if( physAddr >= DDR_1G_ADDRESS_START && physAddr <= DDR_1G_ADDRESS_END ) {
198 ret = physAddr + DDR_1G_DUCATI_OFFSET;
199 } else if( physAddr >= DDR_2G_ADDRESS_START && physAddr <= DDR_2G_ADDRESS_END ) {
200 ret = physAddr - DDR_2G_DUCATI_OFFSET;
201 }
202
203 return (ret);
204}
205
206static void *output_allocate_nonTiler(int size)
207{ 161{
208 DEBUG(" ----------------- create nonTILER size %d --------------------", size); 162 DEBUG(" ----------------- create nonTILER size %d --------------------", size);
209 163
@@ -212,39 +166,36 @@ static void *output_allocate_nonTiler(int size)
212 int32_t ret, len = 0; 166 int32_t ret, len = 0;
213 int64_t paddr = 0; 167 int64_t paddr = 0;
214 168
215 vaddr = mmap64(0, size, PROT_NOCACHE | PROT_READ | PROT_WRITE, MAP_ANON | MAP_PHYS | MAP_SHARED, NOFD, 0); 169 ret = SHM_alloc(size, shmBuf);
216 if( vaddr == MAP_FAILED ) { 170 if( ret < 0 ) {
217 ERROR("Failed to do memory mapping\n"); 171 ERROR("Failed to alloc shmem buffer\n");
218 return (NULL); 172 return (-ENOMEM);
219 } 173 }
174 vaddr = (uint64_t *) shmBuf->vir_addr;
175
176 DEBUG("nonTILER shmBuf->vir_addr =%08x, shmBuf->phy_addr =%08x ", (unsigned int) shmBuf->vir_addr, (unsigned int) shmBuf->phy_addr);
220 177
221 // Make sure the memory is contiguous
222 ret = mem_offset64(vaddr, NOFD, (size_t) size, &paddr, (size_t *) &len); 178 ret = mem_offset64(vaddr, NOFD, (size_t) size, &paddr, (size_t *) &len);
223 if( ret ) { 179 if( ret ) {
224 ERROR("Failed to check memory contiguous ret %d errno %d\n", ret, errno); 180 ERROR("Failed to check memory contiguous ret %d errno %d\n", ret, errno);
225 munmap(vaddr, size); 181 SHM_release(shmBuf);
226 return (NULL); 182 return (-ENOMEM);
227 } else if( len != (size)) { 183 } else if( len != (size)) {
228 ERROR("Failed to check len %d != %d\n", len, size); 184 ERROR("Failed to check len %d != %d\n", len, size);
229 munmap(vaddr, size); 185 SHM_release(shmBuf);
230 return (NULL); 186 return (-ENOMEM);
231 } 187 }
232 188
233 DEBUG("nonTILER buf virtual address =%08x, paddr=%08x return %08x", vaddr, (unsigned int) TilerMem_VirtToPhys(vaddr), SysLinkMemUtils_translateAddr(TilerMem_VirtToPhys(vaddr))); 189 DEBUG("shmBuf %p", shmBuf);
234 190 return 0;
235 // TODO: For IPC 3.x we need to return the virtual address instead of the physical address.
236 // return (void*) vaddr;
237 return ((void *) SysLinkMemUtils_translateAddr(TilerMem_VirtToPhys(vaddr)));
238
239} 191}
240 192
241static void output_enc_free(void *vaddr, int size) 193static void free_nonTiler(void *shmBuf)
242{ 194{
243 munmap(vaddr, size); 195 DEBUG("shmBuf %p", shmBuf);
196 SHM_release(shmBuf);
244} 197}
245 198
246#endif
247
248/* ************************************************************************* */ 199/* ************************************************************************* */
249/* utilities to allocate/manage 2d input buffers */ 200/* utilities to allocate/manage 2d input buffers */
250 201
@@ -377,13 +328,15 @@ uint64_t mark_microsecond(uint64_t *last)
377 328
378#endif 329#endif
379 330
380/* decoder body */ 331/* encoder body */
381int main(int argc, char * *argv) 332int main(int argc, char * *argv)
382{ 333{
383 Engine_Error ec; 334 Engine_Error ec;
384 XDAS_Int32 err; 335 XDAS_Int32 err;
385 char *output = NULL; 336 char *output = NULL;
386 char *output_mvbuf = NULL; 337 char *output_mvbuf = NULL;
338 shm_buf output_mvbuf_nonTiler;
339 shm_buf output_nonTiler;
387 int output_size = 0; 340 int output_size = 0;
388 int mvbufinfo_size = 0; 341 int mvbufinfo_size = 0;
389 char *in_pattern, *out_pattern; 342 char *in_pattern, *out_pattern;
@@ -396,6 +349,7 @@ int main(int argc, char * *argv)
396 int eof = 0; 349 int eof = 0;
397 int ivahd_encode_type; 350 int ivahd_encode_type;
398 char vid_codec[10]; 351 char vid_codec[10];
352 char tilerbuffer[10];
399 unsigned int codec_switch = 0; 353 unsigned int codec_switch = 0;
400 int bytesGenerated = 0; 354 int bytesGenerated = 0;
401 int frames_to_write = 0; 355 int frames_to_write = 0;
@@ -424,11 +378,11 @@ int main(int argc, char * *argv)
424 oned = FALSE; 378 oned = FALSE;
425 } 379 }
426 380
427 if( argc != 9 ) { 381 if( argc != 10 ) {
428 printf("usage: %s width height frames_to_write inpattern outpattern codec baseline/high level\n", argv[0]); 382 printf("usage: %s width height frames_to_write inpattern outpattern codec baseline/high level buffertype\n", argv[0]);
429 printf("example: %s 1920 1088 300 in.yuv out.h264 h264 baseline 10\n", argv[0]); 383 printf("example: %s 1920 1088 300 in.yuv out.h264 h264 baseline 10 tiler\n", argv[0]);
430 printf("example: %s 176 144 300 in.yuv out.m4v mpeg4 simple/baseline 0\n", argv[0]); 384 printf("example: %s 176 144 300 in.yuv out.m4v mpeg4 simple/baseline 0 non-tiler\n", argv[0]);
431 printf("example: %s 176 144 300 in.yuv out.m4v h263 simple/baseline 0\n", argv[0]); 385 printf("example: %s 176 144 300 in.yuv out.m4v h263 simple/baseline 0 tiler\n", argv[0]);
432 printf("Currently supported codecs: h264 or mpeg4 or h263\n"); 386 printf("Currently supported codecs: h264 or mpeg4 or h263\n");
433 printf("Run this command for help on the use case: use dce_enc_test\n"); 387 printf("Run this command for help on the use case: use dce_enc_test\n");
434 return (1); 388 return (1);
@@ -442,8 +396,10 @@ int main(int argc, char * *argv)
442 strcpy(vid_codec, argv[6]); 396 strcpy(vid_codec, argv[6]);
443 strcpy(profile, argv[7]); 397 strcpy(profile, argv[7]);
444 level = atoi(argv[8]); 398 level = atoi(argv[8]);
399 strcpy(tilerbuffer, argv[9]);
445 400
446 printf("Selected codec: %s\n", vid_codec); 401 printf("Selected codec: %s\n", vid_codec);
402 printf("Selected buffer: %s\n", tilerbuffer);
447 403
448 enum { 404 enum {
449 DCE_ENC_TEST_H264 = 1, 405 DCE_ENC_TEST_H264 = 1,
@@ -451,6 +407,10 @@ int main(int argc, char * *argv)
451 DCE_ENC_TEST_H263 = 3 407 DCE_ENC_TEST_H263 = 3
452 }; 408 };
453 409
410/*
411 * Configuration based on the input parameters
412 */
413
454 if((!(strcmp(vid_codec, "h264")))) { 414 if((!(strcmp(vid_codec, "h264")))) {
455 ivahd_encode_type = IVAHD_H264_ENCODE; 415 ivahd_encode_type = IVAHD_H264_ENCODE;
456 codec_switch = DCE_ENC_TEST_H264; 416 codec_switch = DCE_ENC_TEST_H264;
@@ -576,6 +536,9 @@ int main(int argc, char * *argv)
576 536
577 DEBUG("Engine_open successful engine=%p", engine); 537 DEBUG("Engine_open successful engine=%p", engine);
578 538
539/*
540 * inBufs handling
541 */
579 DEBUG("input buffer configuration width %d height %d", width, height); 542 DEBUG("input buffer configuration width %d height %d", width, height);
580 inBufs = dce_alloc(sizeof(IVIDEO2_BufDesc)); 543 inBufs = dce_alloc(sizeof(IVIDEO2_BufDesc));
581 544
@@ -594,14 +557,6 @@ int main(int argc, char * *argv)
594 inBufs->topFieldFirstFlag = 0; //Only valid for interlace content. 557 inBufs->topFieldFirstFlag = 0; //Only valid for interlace content.
595 inBufs->contentType = IVIDEO_PROGRESSIVE; 558 inBufs->contentType = IVIDEO_PROGRESSIVE;
596 559
597 // NOTE: FOR INTERLACED.
598 // For contentType = IVIDEO_INTERLACED
599 // inBufs->contentType = IVIDEO_INTERLACED;
600 // inBufs->dataLayout = IVIDEO_FIELD_SEPARATED;
601 // if stereoInfoPreset == IH264_STEREOINFO_DISABLE then
602 // inBufs->activeFrameRegion.bottomRight.y = height / 2;
603 // inBufs->imageRegion.bottomRight.y = height / 2;
604
605 inBufs->activeFrameRegion.topLeft.x = 0; 560 inBufs->activeFrameRegion.topLeft.x = 0;
606 inBufs->activeFrameRegion.topLeft.y = 0; 561 inBufs->activeFrameRegion.topLeft.y = 0;
607 inBufs->activeFrameRegion.bottomRight.x = width; 562 inBufs->activeFrameRegion.bottomRight.x = width;
@@ -625,13 +580,12 @@ int main(int argc, char * *argv)
625 inBufs->planeDesc[1].bufSize.tileMem.width = width; /* UV interleaved width is same a Y */ 580 inBufs->planeDesc[1].bufSize.tileMem.width = width; /* UV interleaved width is same a Y */
626 inBufs->planeDesc[1].bufSize.tileMem.height = height / 2; 581 inBufs->planeDesc[1].bufSize.tileMem.height = height / 2;
627 582
583 // INPUT BUFFER MUST BE TILED NV12. Encoder codec doesn't support non TILED input buffer.
628 buf = calloc(sizeof(InputBuffer), 1); 584 buf = calloc(sizeof(InputBuffer), 1);
629 DEBUG(" ----------------- create INPUT TILER buf 0x%x --------------------", (unsigned int)buf); 585 DEBUG(" ----------------- create INPUT TILER buf 0x%x --------------------", (unsigned int)buf);
630 buf->buf = tiler_alloc(width, height); 586 buf->buf = tiler_alloc(width, height);
631 if( buf->buf ) { 587 if( buf->buf ) {
632 //buf->y = TilerMem_VirtToPhys(buf->buf);
633 buf->y = (SSPtr)buf->buf; 588 buf->y = (SSPtr)buf->buf;
634 //buf->uv = TilerMem_VirtToPhys(buf->buf + (height * 4096));
635 buf->uv = (SSPtr)buf->buf + (height * 4096); 589 buf->uv = (SSPtr)buf->buf + (height * 4096);
636 590
637 DEBUG("INPUT TILER buf=%p, buf->buf=%p y=%08x, uv=%08x", buf, buf->buf, buf->y, buf->uv); 591 DEBUG("INPUT TILER buf=%p, buf->buf=%p y=%08x, uv=%08x", buf, buf->buf, buf->y, buf->uv);
@@ -647,6 +601,9 @@ int main(int argc, char * *argv)
647 601
648 DEBUG("input buffer configuration num_buffers %d width %d height %d", num_buffers, width, height); 602 DEBUG("input buffer configuration num_buffers %d width %d height %d", num_buffers, width, height);
649 603
604/*
605 * inArgs and outArgs configuration for static parameter passed during codec creation.
606 */
650 switch( codec_switch ) { 607 switch( codec_switch ) {
651 case DCE_ENC_TEST_H264 : 608 case DCE_ENC_TEST_H264 :
652 inArgs = dce_alloc(sizeof(IH264ENC_InArgs)); 609 inArgs = dce_alloc(sizeof(IH264ENC_InArgs));
@@ -944,6 +901,9 @@ int main(int argc, char * *argv)
944 901
945 DEBUG("VIDENC2_create successful codec=%p", codec); 902 DEBUG("VIDENC2_create successful codec=%p", codec);
946 903
904/*
905 * inArgs and outArgs configuration for dynamic parameter passed during codec control.
906 */
947 switch( codec_switch ) { 907 switch( codec_switch ) {
948 case DCE_ENC_TEST_H264 : 908 case DCE_ENC_TEST_H264 :
949 dynParams = dce_alloc(sizeof(IH264ENC_DynamicParams)); 909 dynParams = dce_alloc(sizeof(IH264ENC_DynamicParams));
@@ -1122,40 +1082,60 @@ int main(int argc, char * *argv)
1122 err = VIDENC2_control(codec, XDM_GETBUFINFO, dynParams, status); 1082 err = VIDENC2_control(codec, XDM_GETBUFINFO, dynParams, status);
1123 DEBUG("VIDENC2_control - XDM_GETBUFINFO err %d status numOutBuf %d OutBufSize %d MVBufInfo %d", err, status->bufInfo.minNumOutBufs, status->bufInfo.minOutBufSize[0].bytes, status->bufInfo.minOutBufSize[1].bytes); 1083 DEBUG("VIDENC2_control - XDM_GETBUFINFO err %d status numOutBuf %d OutBufSize %d MVBufInfo %d", err, status->bufInfo.minNumOutBufs, status->bufInfo.minOutBufSize[0].bytes, status->bufInfo.minOutBufSize[1].bytes);
1124 1084
1085/*
1086 * outBufs handling
1087 */
1125 outBufs = dce_alloc(sizeof(XDM2_BufDesc)); 1088 outBufs = dce_alloc(sizeof(XDM2_BufDesc));
1126 output_size = status->bufInfo.minOutBufSize[0].bytes; 1089 output_size = status->bufInfo.minOutBufSize[0].bytes;
1127 mvbufinfo_size = status->bufInfo.minOutBufSize[1].bytes; 1090 mvbufinfo_size = status->bufInfo.minOutBufSize[1].bytes;
1128 1091
1129 DEBUG("Output allocate through tiler 1D"); 1092 if (codec_switch == DCE_ENC_TEST_H264) {
1130 if( codec_switch == DCE_ENC_TEST_H264 ) {
1131 outBufs->numBufs = status->bufInfo.minNumOutBufs; // this value is 1 1093 outBufs->numBufs = status->bufInfo.minNumOutBufs; // this value is 1
1132 } else if( codec_switch == DCE_ENC_TEST_MPEG4 || codec_switch == DCE_ENC_TEST_H263 ) { 1094 } else if( codec_switch == DCE_ENC_TEST_MPEG4 || codec_switch == DCE_ENC_TEST_H263 ) {
1133 outBufs->numBufs = 1; 1095 outBufs->numBufs = 1;
1134 } 1096 }
1135 output = tiler_alloc(output_size, 0);
1136#ifdef NON_TILER_OUTPUT
1137 output = output_allocate_nonTiler(output_size);
1138#endif
1139 //outBufs->descs[0].buf = (XDAS_Int8 *)TilerMem_VirtToPhys(output);
1140 outBufs->descs[0].buf = (XDAS_Int8 *)output;
1141 1097
1098 if( !(strcmp(tilerbuffer, "tiler"))) {
1099 DEBUG("Output allocate through TILER 1D");
1100 tiler = 1;
1101 output = tiler_alloc(output_size, 0);
1102
1103 } else {
1104 DEBUG("Output allocate through NON-TILER");
1105 tiler = 0;
1106 err = allocate_nonTiler(&output_nonTiler, output_size);
1107 if( err < 0 ) {
1108 ERROR("fail: %d", err);
1109 goto shutdown;
1110 }
1111 output = (char*) output_nonTiler.vir_addr;
1112 }
1113
1114 outBufs->descs[0].buf = (XDAS_Int8 *)output;
1142 outBufs->descs[0].memType = XDM_MEMTYPE_RAW; 1115 outBufs->descs[0].memType = XDM_MEMTYPE_RAW;
1143 outBufs->descs[0].bufSize.bytes = output_size; 1116 outBufs->descs[0].bufSize.bytes = output_size;
1144 1117
1145 DEBUG("outBufs->descs[0].buf %p output %p", outBufs->descs[0].buf, output); 1118 DEBUG("Is TILER %d outBufs->descs[0].buf %p output %p output_nonTiler %p mvbufinfo_size %d", tiler, outBufs->descs[0].buf, output, &output_nonTiler, mvbufinfo_size);
1146
1147 if(mvbufinfo_size > 0){
1148#ifdef NON_TILER_OUTPUT
1149 output_mvbuf = output_allocate_nonTiler(mvbufinfo_size);
1150#endif
1151 1119
1152 output_mvbuf = tiler_alloc(mvbufinfo_size, 0); 1120 if (mvbufinfo_size > 0) {
1121 if (tiler) {
1122 output_mvbuf = tiler_alloc(mvbufinfo_size, 0);
1123 DEBUG("MVBufInfo: TILER outBufs->descs[1].buf %p output_mvbuf %p", outBufs->descs[1].buf, output_mvbuf);
1124 }
1125 else {
1126 err = allocate_nonTiler(&output_mvbuf_nonTiler, mvbufinfo_size);
1127 if( err < 0 ) {
1128 ERROR("fail: %d", err);
1129 goto shutdown;
1130 }
1131 output_mvbuf = (char*) output_mvbuf_nonTiler.vir_addr;
1132 DEBUG("MVBufInfo: NON-TILER outBufs->descs[1].buf %p output_mvbuf %p", outBufs->descs[1].buf, output_mvbuf);
1133 }
1153 outBufs->descs[1].buf = (XDAS_Int8 *)output_mvbuf; 1134 outBufs->descs[1].buf = (XDAS_Int8 *)output_mvbuf;
1154
1155 outBufs->descs[1].memType = XDM_MEMTYPE_RAW; 1135 outBufs->descs[1].memType = XDM_MEMTYPE_RAW;
1156 outBufs->descs[1].bufSize.bytes = mvbufinfo_size; 1136 outBufs->descs[1].bufSize.bytes = mvbufinfo_size;
1157 DEBUG("MVBufInfo: outBufs->descs[1].buf %p output_mvbuf %p", outBufs->descs[1].buf, output_mvbuf);
1158 } 1137 }
1138 DEBUG("output_mvbuf %p output_mvbuf_nonTiler %p", output_mvbuf, &output_mvbuf_nonTiler);
1159 1139
1160#ifdef DUMPINPUTDATA 1140#ifdef DUMPINPUTDATA
1161 char Buff1[100]; 1141 char Buff1[100];
@@ -1167,7 +1147,9 @@ int main(int argc, char * *argv)
1167 INFO("total_init_time %llu output_alloc_time %llu actual init time in: %lld us", total_init_time, output_alloc_time, total_init_time - output_alloc_time); 1147 INFO("total_init_time %llu output_alloc_time %llu actual init time in: %lld us", total_init_time, output_alloc_time, total_init_time - output_alloc_time);
1168#endif 1148#endif
1169 1149
1170 // Handling codec_config 1150/*
1151 * codec process
1152 */
1171 while( inBufs->numPlanes && outBufs->numBufs ) { 1153 while( inBufs->numPlanes && outBufs->numBufs ) {
1172 int n; 1154 int n;
1173 DEBUG("Looping on reading input inBufs->numPlanes %d outBufs->numBufs %d", inBufs->numPlanes, outBufs->numBufs); 1155 DEBUG("Looping on reading input inBufs->numPlanes %d outBufs->numBufs %d", inBufs->numPlanes, outBufs->numBufs);
@@ -1175,7 +1157,6 @@ int main(int argc, char * *argv)
1175 //Read the NV12 frame to input buffer to be encoded. 1157 //Read the NV12 frame to input buffer to be encoded.
1176 n = read_input(in_pattern, in_cnt, buf->buf); 1158 n = read_input(in_pattern, in_cnt, buf->buf);
1177 1159
1178
1179 if( n && (n != -1)) { 1160 if( n && (n != -1)) {
1180 eof = 0; 1161 eof = 0;
1181 inBufs->planeDesc[0].buf = (XDAS_Int8 *)buf->y; 1162 inBufs->planeDesc[0].buf = (XDAS_Int8 *)buf->y;
@@ -1230,7 +1211,9 @@ int main(int argc, char * *argv)
1230 } else if( codec_switch == DCE_ENC_TEST_MPEG4 || codec_switch == DCE_ENC_TEST_H263 ) { 1211 } else if( codec_switch == DCE_ENC_TEST_MPEG4 || codec_switch == DCE_ENC_TEST_H263 ) {
1231 mpeg4enc_inArgs = (IMPEG4ENC_InArgs *) inArgs; 1212 mpeg4enc_inArgs = (IMPEG4ENC_InArgs *) inArgs;
1232 } 1213 }
1214 inBufs->planeDesc[0].buf = NULL;
1233 inBufs->planeDesc[0].bufSize.bytes = 0; 1215 inBufs->planeDesc[0].bufSize.bytes = 0;
1216 inBufs->planeDesc[1].buf = NULL;
1234 inBufs->planeDesc[1].bufSize.bytes = 0; 1217 inBufs->planeDesc[1].bufSize.bytes = 0;
1235 outBufs->descs[0].buf = NULL; 1218 outBufs->descs[0].buf = NULL;
1236 outBufs->descs[1].buf = NULL; 1219 outBufs->descs[1].buf = NULL;
@@ -1267,10 +1250,11 @@ int main(int argc, char * *argv)
1267 } else if( codec_switch == DCE_ENC_TEST_MPEG4 || codec_switch == DCE_ENC_TEST_H263 ) { 1250 } else if( codec_switch == DCE_ENC_TEST_MPEG4 || codec_switch == DCE_ENC_TEST_H263 ) {
1268 mpeg4enc_inArgs = (IMPEG4ENC_InArgs *) inArgs; 1251 mpeg4enc_inArgs = (IMPEG4ENC_InArgs *) inArgs;
1269 } 1252 }
1253 inBufs->planeDesc[0].buf = NULL;
1270 inBufs->planeDesc[0].bufSize.bytes = 0; 1254 inBufs->planeDesc[0].bufSize.bytes = 0;
1255 inBufs->planeDesc[1].buf = NULL;
1271 inBufs->planeDesc[1].bufSize.bytes = 0; 1256 inBufs->planeDesc[1].bufSize.bytes = 0;
1272 outBufs->descs[0].buf = NULL; 1257 outBufs->descs[0].buf = NULL;
1273 outBufs->descs[1].buf = NULL;
1274 } 1258 }
1275 1259
1276#ifdef DUMPINPUTDATA 1260#ifdef DUMPINPUTDATA
@@ -1324,10 +1308,6 @@ int main(int argc, char * *argv)
1324 codec_process_time = mark_microsecond(NULL); 1308 codec_process_time = mark_microsecond(NULL);
1325#endif 1309#endif
1326 1310
1327#if 0
1328 err = VIDENC2_process(codec, inBufs, outBufs, inArgs, outArgs);
1329#endif
1330
1331 if( codec_switch == DCE_ENC_TEST_H264 ) { 1311 if( codec_switch == DCE_ENC_TEST_H264 ) {
1332 err = VIDENC2_process(codec, inBufs, outBufs, (VIDENC2_InArgs *) h264enc_inArgs, (VIDENC2_OutArgs *) h264enc_outArgs); 1312 err = VIDENC2_process(codec, inBufs, outBufs, (VIDENC2_InArgs *) h264enc_inArgs, (VIDENC2_OutArgs *) h264enc_outArgs);
1333 DEBUG("[DCE_ENC_TEST] VIDENC2_process - err %d", err); 1313 DEBUG("[DCE_ENC_TEST] VIDENC2_process - err %d", err);
@@ -1469,23 +1449,27 @@ out:
1469 dce_free(outArgs); 1449 dce_free(outArgs);
1470 } 1450 }
1471 1451
1472 printf("\nFreeing output %p...\n", output); 1452 printf("\nFreeing output %p... output_mvbuf %p...\n", output, output_mvbuf);
1473 if( output ) { 1453 if (tiler) {
1474 MemMgr_Free(output); 1454 if( output ) {
1475 } 1455 MemMgr_Free(output);
1476 if(output_mvbuf){ 1456 }
1477 printf("\nFreeing output %p...\n", output_mvbuf); 1457
1478 MemMgr_Free(output_mvbuf); 1458 if( output_mvbuf ){
1479 } 1459 printf("\nFreeing output %p...\n", output_mvbuf);
1480#ifdef NON_TILER_OUTPUT 1460 MemMgr_Free(output_mvbuf);
1481 if( output ) { 1461 }
1482 output_enc_free(output, output_size);
1483 } 1462 }
1484 if(output_mvbuf){ 1463 else {
1485 printf("\nFreeing mvbuf output %p...\n", output_mvbuf); 1464 if( output ) {
1486 output_enc_free(output_mvbuf, mvbufinfo_size); 1465 printf("\nFreeing output_nonTiler %p...\n", &output_nonTiler);
1466 free_nonTiler(&output_nonTiler);
1467 }
1468 if( output_mvbuf ){
1469 printf("\nFreeing output_mvbuf_nonTiler %p...\n", &output_mvbuf_nonTiler);
1470 free_nonTiler(&output_mvbuf_nonTiler);
1471 }
1487 } 1472 }
1488#endif
1489 1473
1490 printf("\nFreeing buf %p...\n", buf); 1474 printf("\nFreeing buf %p...\n", buf);
1491 if( buf ) { 1475 if( buf ) {