aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBuddy Liong2013-08-27 17:43:27 -0500
committerSaurabh Bipin Chandra2013-08-30 00:58:21 -0500
commit060b6ab4d13c30af1062df055889f86ccca3c6b7 (patch)
treea4c04e2ab1c6a6a030a544c82f059deb50dbd353 /test_qnx
parent30c8b47648b5ff316519e7054b9caa7131878ab6 (diff)
downloadrepo-libdce-060b6ab4d13c30af1062df055889f86ccca3c6b7.tar.gz
repo-libdce-060b6ab4d13c30af1062df055889f86ccca3c6b7.tar.xz
repo-libdce-060b6ab4d13c30af1062df055889f86ccca3c6b7.zip
[LIBDCE] Adding dce_enc_test
Adding dce_enc_test for H.264 baseline and High Profile. Adding MPEG4/H263 simple Profile. Change-Id: I29b5043210d3a79e5ab859c5781bb89584714dfa Signed-off-by: Buddy Liong <a0270631@ti.com>
Diffstat (limited to 'test_qnx')
-rw-r--r--test_qnx/Makefile2
-rw-r--r--test_qnx/dce_enc_test/Makefile2
-rw-r--r--test_qnx/dce_enc_test/arm/Makefile (renamed from test_qnx/arm/Makefile)16
-rw-r--r--test_qnx/dce_enc_test/arm/le.v7/Makefile (renamed from test_qnx/arm/le.v7/Makefile)2
-rw-r--r--test_qnx/dce_enc_test/common.mk50
-rw-r--r--test_qnx/dce_enc_test/dce_enc_test.c1540
-rw-r--r--test_qnx/dce_enc_test/dce_enc_test.use98
-rw-r--r--test_qnx/dce_test/Makefile2
-rw-r--r--test_qnx/dce_test/arm/Makefile8
-rw-r--r--test_qnx/dce_test/arm/le.v7/Makefile1
-rw-r--r--test_qnx/dce_test/common.mk (renamed from test_qnx/common.mk)100
-rw-r--r--test_qnx/dce_test/dce_test.c (renamed from test_qnx/dce_test.c)3
-rw-r--r--test_qnx/dce_test/dce_test.use (renamed from test_qnx/dce_test.use)76
13 files changed, 1801 insertions, 99 deletions
diff --git a/test_qnx/Makefile b/test_qnx/Makefile
index 5323e99..65f5c33 100644
--- a/test_qnx/Makefile
+++ b/test_qnx/Makefile
@@ -1,2 +1,2 @@
1LIST=CPU 1LIST=samples
2include recurse.mk 2include recurse.mk
diff --git a/test_qnx/dce_enc_test/Makefile b/test_qnx/dce_enc_test/Makefile
new file mode 100644
index 0000000..8dd3690
--- /dev/null
+++ b/test_qnx/dce_enc_test/Makefile
@@ -0,0 +1,2 @@
1LIST=dce_enc_test
2include recurse.mk
diff --git a/test_qnx/arm/Makefile b/test_qnx/dce_enc_test/arm/Makefile
index 6a18617..0e22650 100644
--- a/test_qnx/arm/Makefile
+++ b/test_qnx/dce_enc_test/arm/Makefile
@@ -1,8 +1,8 @@
1LIST=VARIANT 1LIST=VARIANT
2ifndef QRECURSE 2ifndef QRECURSE
3QRECURSE=recurse.mk 3QRECURSE=recurse.mk
4ifdef QCONFIG 4ifdef QCONFIG
5QRDIR=$(dir $(QCONFIG)) 5QRDIR=$(dir $(QCONFIG))
6endif 6endif
7endif 7endif
8include $(QRDIR)$(QRECURSE) 8include $(QRDIR)$(QRECURSE)
diff --git a/test_qnx/arm/le.v7/Makefile b/test_qnx/dce_enc_test/arm/le.v7/Makefile
index cc39927..2c76089 100644
--- a/test_qnx/arm/le.v7/Makefile
+++ b/test_qnx/dce_enc_test/arm/le.v7/Makefile
@@ -1 +1 @@
include ../../common.mk include ../../common.mk
diff --git a/test_qnx/dce_enc_test/common.mk b/test_qnx/dce_enc_test/common.mk
new file mode 100644
index 0000000..cdff60d
--- /dev/null
+++ b/test_qnx/dce_enc_test/common.mk
@@ -0,0 +1,50 @@
1###################### QNX DCE Enc Test App Build Config #######################
2
3#### Include qconfig.mk
4ifndef QCONFIG
5QCONFIG=qconfig.mk
6endif
7include $(QCONFIG)
8
9define PINFO
10PINFO DESCRIPTION=DCE Encoder Test
11endef
12
13NAME = dce_enc_test
14INSTALLDIR = bin
15
16# Different tool versions can easily be programmed by defining below variables
17# in your environment.
18CEVERSION ?= codec_engine_3_23_00_07
19FCVERSION ?= framework_components_3_23_03_17
20XDAISVERSION ?= xdais_7_23_00_06
21XDCVERSION ?= xdctools_3_25_00_48
22IPCHEADERS ?= $(INSTALL_ROOT_nto)
23IVAHDCODECS ?= ipumm/extrel/ti/ivahd_codecs
24
25# Generate the full package paths for tools
26CEPROD = $(TIVIDEOTOOLSROOT)/$(CEVERSION)
27FCPROD = $(TIVIDEOTOOLSROOT)/$(FCVERSION)
28XDAISPROD = $(TITOOLSROOT)/$(XDAISVERSION)
29XDCPROD = $(TITOOLSROOT)/$(XDCVERSION)
30
31#Add extra include path
32EXTRA_INCVPATH += $(CEPROD)/packages
33EXTRA_INCVPATH += $(FCPROD)/packages
34EXTRA_INCVPATH += $(XDAISPROD)/packages
35EXTRA_INCVPATH += $(XDCPROD)/packages
36EXTRA_INCVPATH += $(IVAHDCODECS)/packages
37EXTRA_INCVPATH += $(PROJECT_ROOT)/../../
38EXTRA_INCVPATH += $(IPCHEADERS)/usr/include/memmgr
39EXTRA_INCVPATH += $(IPCHEADERS)/usr/include/ti/syslink
40EXTRA_INCVPATH += $(IPCHEADERS)/usr/include
41
42CCOPTS+=-g -O0 -Dxdc_target_types__=qnx/targets/arm/std.h
43
44EXTRA_LIBVPATH += $(PROJECT_ROOT)/../nto/arm/so.le.v7 \
45 $(INSTALL_ROOT_nto)/armle-v7/usr/lib
46
47LDOPTS+= -ldce -lmemmgr -ltilerusr -lsharedmemallocator
48
49include $(MKFILES_ROOT)/qtargets.mk
50
diff --git a/test_qnx/dce_enc_test/dce_enc_test.c b/test_qnx/dce_enc_test/dce_enc_test.c
new file mode 100644
index 0000000..775b37a
--- /dev/null
+++ b/test_qnx/dce_enc_test/dce_enc_test.c
@@ -0,0 +1,1540 @@
1/*
2 * Copyright (c) 2013, Texas Instruments Incorporated
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32#include <xdc/std.h>
33#include <stdlib.h>
34#include <string.h>
35#include <stdio.h>
36#include <stdint.h>
37#include <sys/types.h>
38#include <sys/stat.h>
39#include <sys/time.h>
40#include <fcntl.h>
41#include <errno.h>
42#include <time.h>
43#include <sys/mman.h>
44
45#include <tilermem.h>
46#include <memmgr.h>
47#include <xdc/std.h>
48#include <ti/sdo/ce/Engine.h>
49#include <ti/sdo/ce/video2/videnc2.h>
50#include <ti/sdo/codecs/h264enc/ih264enc.h>
51#include <ti/sdo/codecs/mpeg4enc/impeg4enc.h>
52
53#include "libdce.h"
54
55#define OMAP5
56
57#define PRINT_DEBUG
58//#define H264_DEBUG
59
60#define ERROR(FMT, ...) printf("%s:%d:\t%s\terror: " FMT "\n", __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__)
61// enable below to print debug information
62#ifdef PRINT_DEBUG
63#define DEBUG(FMT, ...) printf("%s:%d:\t%s\tdebug: " FMT "\n", __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__)
64#else
65#define DEBUG(FMT, ...)
66#endif
67#define INFO(FMT, ...) printf("%s:%d:\t%s\tinfo: " FMT "\n", __FILE__, __LINE__, __FUNCTION__, ##__VA_ARGS__)
68#define MIN(a, b) (((a) < (b)) ? (a) : (b))
69
70/* align x to next highest multiple of 2^n */
71#define ALIGN2(x, n) (((x) + ((1 << (n)) - 1)) & ~((1 << (n)) - 1))
72
73// Profile the init and decode calls
74//#define PROFILE_TIME
75
76// NON-TILER OUTPUT configuration
77//#define NON_TILER_OUTPUT
78
79enum {
80 IVAHD_H264_ENCODE,
81 IVAHD_MPEG4_ENCODE,
82 IVAHD_H263_ENCODE
83};
84
85/*
86 * A very simple VIDENC2 client which will encode raw (unstrided) NV12 YUV frames
87 * and write out to either h264, MPEG4, or H.263 format.
88 */
89
90// GLOBAL VARIABLES
91int width, height, padded_width, padded_height, num_buffers, tiler;
92Engine_Handle engine = NULL;
93VIDENC2_Handle codec = NULL;
94VIDENC2_Params *params = NULL;
95VIDENC2_DynamicParams *dynParams = NULL;
96VIDENC2_Status *status = NULL;
97VIDENC2_DynamicParams *dynParams1 = NULL;
98VIDENC2_Status *status1 = NULL;
99IVIDEO2_BufDesc *inBufs = NULL;
100XDM2_BufDesc *outBufs = NULL;
101VIDENC2_InArgs *inArgs = NULL;
102VIDENC2_OutArgs *outArgs = NULL;
103
104// H.264 specific
105IH264ENC_InArgs *h264enc_inArgs = NULL;
106IH264ENC_OutArgs *h264enc_outArgs = NULL;
107IH264ENC_Params *h264enc_params = NULL;
108IH264ENC_DynamicParams *h264enc_dynParams = NULL;
109IH264ENC_Status *h264enc_status = NULL;
110
111// MPEG4/H.263 specific
112IMPEG4ENC_InArgs *mpeg4enc_inArgs = NULL;
113IMPEG4ENC_OutArgs *mpeg4enc_outArgs = NULL;
114IMPEG4ENC_Params *mpeg4enc_params = NULL;
115IMPEG4ENC_DynamicParams *mpeg4enc_dynParams = NULL;
116IMPEG4ENC_Status *mpeg4enc_status = NULL;
117
118unsigned int frameSize[64000]; /* Buffer for keeping frame sizes */
119static int input_offset = 0;
120
121static void *tiler_alloc(int width, int height)
122{
123 int dimensions;
124 void *bufPtr = NULL;
125 MemAllocBlock block;
126 MemAllocBlock blocks[2];
127
128 memset(&block, 0, sizeof(MemAllocBlock));
129 memset(blocks, 0, sizeof(MemAllocBlock) * 2);
130
131 if( !height ) {
132 DEBUG("tiler alloc 1D allocation width=%d", width);
133 /* 1d allocation: */
134 dimensions = 1;
135
136 block.pixelFormat = PIXEL_FMT_PAGE;
137 block.dim.len = width;
138 block.stride = 0;
139
140 bufPtr = MemMgr_Alloc(&block, dimensions);
141 } else {
142 DEBUG("tiler alloc 2D allocation width=%d height=%d", width, height);
143 /* 2d allocation: */
144 dimensions = 2;
145 blocks[0].pixelFormat = PIXEL_FMT_8BIT;
146 blocks[0].dim.area.width = width;
147 blocks[0].dim.area.height = height;
148 blocks[0].stride = 0;
149
150 blocks[1].pixelFormat = PIXEL_FMT_16BIT;
151 blocks[1].dim.area.width = width >> 1;
152 blocks[1].dim.area.height = height >> 1;
153 blocks[1].stride = 0;
154
155 bufPtr = MemMgr_Alloc(blocks, dimensions);
156 }
157 DEBUG("tiler alloc return bufPtr %p", bufPtr);
158
159 return (bufPtr);
160}
161
162#ifdef NON_TILER_OUTPUT
163static XDAS_Int16
164get_mem_type (SSPtr paddr)
165{
166 if((0x60000000 <= paddr) && (paddr < 0x68000000)) {
167 return (XDM_MEMTYPE_TILED8);
168 }
169 if((0x68000000 <= paddr) && (paddr < 0x70000000)) {
170 return (XDM_MEMTYPE_TILED16);
171 }
172 if((0x70000000 <= paddr) && (paddr < 0x78000000)) {
173 return (XDM_MEMTYPE_TILED32);
174 }
175 if((0x78000000 <= paddr) && (paddr < 0x80000000)) {
176 return (XDM_MEMTYPE_RAW);
177 }
178 return (-1);
179}
180
181/*! @brief Start address of DDR region for 1GB RAM */
182#define DDR_1G_ADDRESS_START 0x80000000
183/*! @brief End address of DDR region for 1GB RAM */
184#define DDR_1G_ADDRESS_END 0xBFFFFFFF
185#define DDR_1G_DUCATI_OFFSET 0x40000000
186
187/*! @brief Start address of DDR region for 2GB RAM */
188#define DDR_2G_ADDRESS_START 0xC0000000
189/*! @brief End address of DDR region for 2GB RAM */
190#define DDR_2G_ADDRESS_END 0xFFFFFFFF
191#define DDR_2G_DUCATI_OFFSET 0xA0000000
192
193static Int
194SysLinkMemUtils_translateAddr (UInt32 physAddr)
195{
196 Int ret = 0;
197
198 if( physAddr >= DDR_1G_ADDRESS_START && physAddr <= DDR_1G_ADDRESS_END ) {
199 ret = physAddr + DDR_1G_DUCATI_OFFSET;
200 } else if( physAddr >= DDR_2G_ADDRESS_START && physAddr <= DDR_2G_ADDRESS_END ) {
201 ret = physAddr - DDR_2G_DUCATI_OFFSET;
202 }
203
204 return (ret);
205}
206
207static void *output_allocate_nonTiler(int size)
208{
209 DEBUG(" ----------------- create nonTILER size %d --------------------", size);
210
211 // Allocation through mmap
212 uint64_t *vaddr;
213 int32_t ret, len = 0;
214 int64_t paddr = 0;
215
216 vaddr = mmap64(0, size, PROT_NOCACHE | PROT_READ | PROT_WRITE, MAP_ANON | MAP_PHYS | MAP_SHARED, NOFD, 0);
217 if( vaddr == MAP_FAILED ) {
218 ERROR("Failed to do memory mapping\n");
219 return (NULL);
220 }
221
222 // Make sure the memory is contiguous
223 ret = mem_offset64(vaddr, NOFD, (size_t) size, &paddr, (size_t *) &len);
224 if( ret ) {
225 ERROR("Failed to check memory contiguous ret %d errno %d\n", ret, errno);
226 munmap(vaddr, size);
227 return (NULL);
228 } else if( len != (size)) {
229 ERROR("Failed to check len %d != %d\n", len, size);
230 munmap(vaddr, size);
231 return (NULL);
232 }
233
234 DEBUG("nonTILER buf virtual address =%08x, paddr=%08x return %08x", vaddr, (unsigned int) TilerMem_VirtToPhys(vaddr), SysLinkMemUtils_translateAddr(TilerMem_VirtToPhys(vaddr)));
235
236 // TODO: For IPC 3.x we need to return the virtual address instead of the physical address.
237 // return (void*) vaddr;
238 return ((void *) SysLinkMemUtils_translateAddr(TilerMem_VirtToPhys(vaddr)));
239
240}
241
242static void output_enc_free(void *vaddr, int size)
243{
244 munmap(vaddr, size);
245}
246
247#endif
248
249/* ************************************************************************* */
250/* utilities to allocate/manage 2d input buffers */
251
252typedef struct InputBuffer InputBuffer;
253
254struct InputBuffer {
255 char *buf; /* virtual address for local access, 4kb stride */
256 SSPtr y, uv; /* physical addresses of Y and UV for remote access */
257 InputBuffer *next; /* next free buffer */
258 bool tiler;
259 uint32_t len;
260};
261
262/* ************************************************************************* */
263
264/* get file path.. return path is only valid until next time this is called */
265static const char *get_path(const char *pattern, int cnt)
266{
267 static int len = 0;
268 static char *path = NULL;
269
270 /* It would be better to not assume the pattern doesn't expand to
271 * less than 10 chars it's original length..
272 */
273 if((strlen(pattern) + 10) > len ) {
274 len = strlen(pattern) + 10;
275 path = realloc(path, len);
276 }
277
278 snprintf(path, len - 1, pattern, cnt);
279
280 return (path);
281}
282
283//#define DUMPINPUTDATA
284//#define TMPDUMPDATA
285//#define DUMPOUTPUTDATA
286
287#ifdef DUMPINPUTDATA
288FILE *inputDump;
289#endif
290
291#ifdef TMPDUMPDATA
292FILE *tmpDump;
293#endif
294
295#ifdef DUMPOUTPUTDATA
296FILE *outputDump;
297#endif
298
299
300/* helper to read one frame NV12 of input */
301int read_input(const char *pattern, int cnt, char *input)
302{
303 int sz = 0, n = 0, num_planes, i, buf_height;
304 int *pTmpBuffer = NULL, *pTmpBufferPos = NULL;
305
306 const char *path = get_path(pattern, cnt);
307 int fd = open(path, O_RDONLY);
308
309 //DEBUG("Open file fd %d errno %d", fd, errno);
310 /* if we can't find the file, then at the end of stream */
311 if( fd < 0 ) {
312 DEBUG("open input file failed");
313 return (0);
314 }
315
316 sz = width * height * 3 / 2;
317 pTmpBuffer = calloc(sz, 1);
318 pTmpBufferPos = pTmpBuffer;
319
320 //Read 1 frame of NV12 YUV into input. Since it's TILER - stride = 4096
321 lseek(fd, input_offset, SEEK_SET);
322 n = read(fd, pTmpBuffer, sz); //reading 1 input frame width * height * 3/2
323 DEBUG("reading input[%p] size of n = %d where input_offset is %d", input, n, input_offset);
324 if( n ) {
325 input_offset += n;
326 } else {
327 sz = -1; //cannot read more input
328 free(pTmpBuffer);
329 close(fd);
330
331 DEBUG("sz=%d", sz);
332 return (sz);
333 }
334
335#ifdef TMPDUMPDATA
336 char Buff[100];
337 int static GlobalCount = 0;
338#endif
339
340 for( num_planes = 0; num_planes < 2; num_planes++ ) {
341 if( num_planes ) { //UV location
342 buf_height = height / 2;
343 } else { //Y location
344 buf_height = height;
345 }
346
347 for( i = 0; i < buf_height; i++ ) {
348 memcpy(input, pTmpBufferPos, width);
349
350#ifdef TMPDUMPDATA
351
352 if( GlobalCount < buf_height ) {
353 DEBUG("[DCE_ENC_TEST] GlobalCount %d\n", GlobalCount);
354 sprintf(Buff, "/sd/dce_enc_dump/dcefiledump%d.bin", GlobalCount);
355 tmpDump = fopen(Buff, "wb+");
356 if( tmpDump == NULL ) {
357 DEBUG("[DCE_ENC_TEST] Error opening /sd/dce_enc_dump/dcefiledump\n");
358 } else {
359 GlobalCount++;
360 //DEBUG("Before Input [%p]\n", input);
361 fwrite(input, 1, width, tmpDump);
362
363 fflush(tmpDump);
364 fclose(tmpDump);
365 tmpDump = NULL;
366 }
367 }
368
369#endif
370 pTmpBufferPos = (int *) ((int)pTmpBufferPos + width);
371 input = (char *) ((int)input + 4096);
372 //DEBUG("After Input [%p]\n", input);
373
374 }
375 }
376
377 free(pTmpBuffer);
378 close(fd);
379
380 DEBUG("sz=%d", sz);
381 return (sz);
382}
383
384/* helper to write one frame of output */
385int write_output(const char *pattern, int cnt, char *output, int bytesToWrite)
386{
387 int sz = 0;
388 const char *path = get_path(pattern, cnt);
389 int fd = open(path, O_WRONLY | O_CREAT | O_APPEND, 0644);
390
391 if( fd < 0 ) {
392 ERROR("could open output file: %s (%d)", path, errno);
393 return (0);
394 }
395
396 char *p = output;
397 sz = write(fd, p, bytesToWrite);
398
399 DEBUG("Writing of bytesToWrite [%d] output sz %d \n", bytesToWrite, sz);
400
401 close(fd);
402
403 return (sz);
404}
405
406#ifdef PROFILE_TIME
407/* for timing in microsecond */
408uint64_t mark_microsecond(uint64_t *last)
409{
410 struct timespec time;
411 uint64_t t1 = 0;
412
413 clock_gettime(CLOCK_REALTIME, &time);
414 t1 = timespec2nsec(&time);
415 t1 = t1 / 1000;
416 if( last ) {
417 return (t1 - *last);
418 }
419 return (t1);
420}
421
422#endif
423
424/* decoder body */
425int main(int argc, char * *argv)
426{
427 Engine_Error ec;
428 XDAS_Int32 err;
429 char *output = NULL;
430 int output_size = 0;
431 char *in_pattern, *out_pattern;
432 int in_cnt = 0, out_cnt = 0;
433 int oned;
434 InputBuffer *buf = NULL;
435 char profile[10];
436 int profile_value;
437 int level;
438 int eof = 0;
439 int ivahd_encode_type;
440 char vid_codec[10];
441 unsigned int codec_switch = 0;
442 int bytesGenerated = 0;
443 int frames_to_write = 0;
444
445#ifdef PROFILE_TIME
446 uint64_t init_start_time = 0;
447 uint64_t codec_process_time = 0;
448 uint64_t total_init_time = 0;
449 uint64_t input_alloc_time = 0;
450#endif
451
452#if 0
453 int loop = 0;
454
455 while( loop == 0 ) {
456 loop = 0;
457 }
458
459#endif
460
461 if((argc >= 2) && !strcmp(argv[1], "-1")) {
462 oned = TRUE;
463 argc--;
464 argv++;
465 } else {
466 oned = FALSE;
467 }
468
469 if( argc != 9 ) {
470 printf("usage: %s width height frames_to_write inpattern outpattern codec baseline/high level\n", argv[0]);
471 printf("example: %s 1920 1088 300 in.yuv out.h264 h264 baseline 10\n", argv[0]);
472 printf("example: %s 176 144 300 in.yuv out.m4v mpeg4 simple/baseline 0\n", argv[0]);
473 printf("example: %s 176 144 300 in.yuv out.m4v h263 simple/baseline 0\n", argv[0]);
474 printf("Currently supported codecs: h264 or mpeg4 or h263\n");
475 printf("Run this command for help on the use case: use dce_enc_test\n");
476 return (1);
477 }
478
479 width = atoi(argv[1]);
480 height = atoi(argv[2]);
481 frames_to_write = atoi(argv[3]);
482 in_pattern = argv[4];
483 out_pattern = argv[5];
484 strcpy(vid_codec, argv[6]);
485 strcpy(profile, argv[7]);
486 level = atoi(argv[8]);
487
488 printf("Selected codec: %s\n", vid_codec);
489
490 enum {
491 DCE_ENC_TEST_H264 = 1,
492 DCE_ENC_TEST_MPEG4 = 2,
493 DCE_ENC_TEST_H263 = 3
494 };
495
496 if((!(strcmp(vid_codec, "h264")))) {
497 ivahd_encode_type = IVAHD_H264_ENCODE;
498 codec_switch = DCE_ENC_TEST_H264;
499 if((!(strcmp(profile, "baseline")))) {
500 profile_value = IH264_BASELINE_PROFILE;
501 } else if((!(strcmp(profile, "high")))) {
502 profile_value = IH264_HIGH_PROFILE;
503 } else {
504 printf("Wrong profile value. Please use: baseline or high. See 'use dce_enc_test'.\n");
505 return (1);
506 }
507
508 switch( level ) {
509 case IH264_LEVEL_10 :
510 case IH264_LEVEL_1b :
511 case IH264_LEVEL_11 :
512 case IH264_LEVEL_12 :
513 case IH264_LEVEL_13 :
514 case IH264_LEVEL_20 :
515 case IH264_LEVEL_21 :
516 case IH264_LEVEL_22 :
517 case IH264_LEVEL_30 :
518 case IH264_LEVEL_31 :
519 case IH264_LEVEL_32 :
520 case IH264_LEVEL_40 :
521 case IH264_LEVEL_41 :
522 case IH264_LEVEL_42 :
523 case IH264_LEVEL_50 :
524 case IH264_LEVEL_51 :
525 printf("Acceptable H.264 level value = %d\n", level);
526 break;
527 default :
528 printf("Wrong level value. Please use the correct level value for H.264. See 'use dce_enc_test'.\n");
529 return (1);
530 }
531 } else if( !(strcmp(vid_codec, "mpeg4"))) {
532
533 ivahd_encode_type = IVAHD_MPEG4_ENCODE;
534 codec_switch = DCE_ENC_TEST_MPEG4;
535
536 if((!(strcmp(profile, "simple")))) {
537 profile_value = 3;
538 } else {
539 printf("Wrong profile value. Please use: simple. See 'use dce_enc_test'.\n");
540 return (1);
541 }
542
543 switch( level ) {
544 case IMPEG4ENC_SP_LEVEL_0 :
545 case IMPEG4ENC_SP_LEVEL_0B :
546 case IMPEG4ENC_SP_LEVEL_1 :
547 case IMPEG4ENC_SP_LEVEL_2 :
548 case IMPEG4ENC_SP_LEVEL_3 :
549 case IMPEG4ENC_SP_LEVEL_4A :
550 case IMPEG4ENC_SP_LEVEL_5 :
551 case IMPEG4ENC_SP_LEVEL_6 :
552 printf("Acceptable MPEG4 level value = %d\n", level);
553 break;
554 default :
555 printf("Wrong level value. Please use the correct level value for MPEG4. See 'use dce_enc_test'.\n");
556 return (1);
557 }
558 } else if( !(strcmp(vid_codec, "h263"))) {
559
560 ivahd_encode_type = IVAHD_H263_ENCODE;
561 codec_switch = DCE_ENC_TEST_H263;
562
563 if((!(strcmp(profile, "simple")))) {
564 profile_value = 3;
565 } else {
566 printf("Wrong profile value. Please use: simple. See 'use dce_enc_test'.\n");
567 return (1);
568 }
569
570 switch( level ) {
571 case IMPEG4ENC_H263_LEVEL_10 :
572 case IMPEG4ENC_H263_LEVEL_20 :
573 case IMPEG4ENC_H263_LEVEL_30 :
574 case IMPEG4ENC_H263_LEVEL_40 :
575 case IMPEG4ENC_H263_LEVEL_45 :
576 case IMPEG4ENC_H263_LEVEL_50 :
577 case IMPEG4ENC_H263_LEVEL_60 :
578 case IMPEG4ENC_H263_LEVEL_70 :
579 printf("Acceptable H263 level value = %d\n", level);
580 break;
581 default :
582 printf("Wrong level value. Please use the correct level value for H263. See 'use dce_enc_test'.\n");
583 return (1);
584 }
585 } else {
586 printf("No valid codec entry. Please use: h264 or mpeg4 or h263\n");
587 return (1);
588 }
589
590 DEBUG("width=%d, height=%d", width, height);
591
592 /* output buffer parameters is TILER with width and height */
593 width = ALIGN2(width, 4); /* round up to MB */
594 height = ALIGN2(height, 1); /* round up to MB */
595
596 switch( codec_switch ) {
597 case DCE_ENC_TEST_H264 :
598 case DCE_ENC_TEST_MPEG4 :
599 case DCE_ENC_TEST_H263 :
600 num_buffers = 1;
601 break;
602 default :
603 ERROR("Unrecognized codec to encode");
604 }
605
606 DEBUG("width=%d, height=%d, num_buffers=%d",
607 width, height, num_buffers);
608
609#ifdef PROFILE_TIME
610 init_start_time = mark_microsecond(NULL);
611#endif
612 engine = Engine_open("ivahd_vidsvr", NULL, &ec);
613
614 if( !engine ) {
615 ERROR("fail");
616 goto out;
617 }
618
619 DEBUG("Engine_open successful engine=%p", engine);
620
621 DEBUG("input buffer configuration width %d height %d", width, height);
622 inBufs = dce_alloc(sizeof(IVIDEO2_BufDesc));
623
624 DEBUG("Input allocate through tiler");
625
626#ifdef PROFILE_TIME
627 uint64_t alloc_time_start = mark_microsecond(NULL);
628#endif
629
630 inBufs->numPlanes = 2;
631 inBufs->imageRegion.topLeft.x = 0;
632 inBufs->imageRegion.topLeft.y = 0;
633 inBufs->imageRegion.bottomRight.x = width;
634 inBufs->imagePitch[0] = 4096;
635
636 inBufs->topFieldFirstFlag = 0; //Only valid for interlace content.
637 inBufs->contentType = IVIDEO_PROGRESSIVE;
638
639 // NOTE: FOR INTERLACED.
640 // For contentType = IVIDEO_INTERLACED
641 // inBufs->contentType = IVIDEO_INTERLACED;
642 // inBufs->dataLayout = IVIDEO_FIELD_SEPARATED;
643 // if stereoInfoPreset == IH264_STEREOINFO_DISABLE then
644 // inBufs->activeFrameRegion.bottomRight.y = height / 2;
645 // inBufs->imageRegion.bottomRight.y = height / 2;
646
647 inBufs->activeFrameRegion.topLeft.x = 0;
648 inBufs->activeFrameRegion.topLeft.y = 0;
649 inBufs->activeFrameRegion.bottomRight.x = width;
650 inBufs->activeFrameRegion.bottomRight.y = height;
651
652 inBufs->imageRegion.bottomRight.y = height;
653 inBufs->chromaFormat = XDM_YUV_420SP;
654
655 inBufs->secondFieldOffsetWidth[0] = 0;
656 inBufs->secondFieldOffsetHeight[0] = 0;
657
658 inBufs->planeDesc[0].memType = XDM_MEMTYPE_TILED8;
659 inBufs->planeDesc[0].bufSize.tileMem.width = width;
660 inBufs->planeDesc[0].bufSize.tileMem.height = height;
661
662 inBufs->imagePitch[1] = 4096;
663 inBufs->secondFieldOffsetWidth[1] = 1;
664 inBufs->secondFieldOffsetHeight[1] = 0;
665
666 inBufs->planeDesc[1].memType = XDM_MEMTYPE_TILED16;
667 inBufs->planeDesc[1].bufSize.tileMem.width = width / 2; /* UV interleaved width is same a Y */
668 inBufs->planeDesc[1].bufSize.tileMem.height = height / 2;
669
670 buf = calloc(sizeof(InputBuffer), 1);
671 DEBUG(" ----------------- create TILER buf 0x%x --------------------", (unsigned int)buf);
672 buf->buf = tiler_alloc(width, height);
673 if( buf->buf ) {
674 //buf->y = TilerMem_VirtToPhys(buf->buf);
675 buf->y = (SSPtr)buf->buf;
676 //buf->uv = TilerMem_VirtToPhys(buf->buf + (height * 4096));
677 buf->uv = (SSPtr)buf->buf + (height * 4096);
678
679 DEBUG("buf=%p, buf->buf=%p y=%08x, uv=%08x", buf, buf->buf, buf->y, buf->uv);
680 } else {
681 ERROR(" ---------------- tiler_alloc failed --------------------");
682 free(buf);
683 goto shutdown;
684 }
685
686#ifdef PROFILE_TIME
687 input_alloc_time = mark_microsecond(&alloc_time_start);
688#endif
689
690 DEBUG("input buffer configuration num_buffers %d width %d height %d", num_buffers, width, height);
691
692 switch( codec_switch ) {
693 case DCE_ENC_TEST_H264 :
694 inArgs = dce_alloc(sizeof(IH264ENC_InArgs));
695 inArgs->size = sizeof(IH264ENC_InArgs);
696
697 outArgs = dce_alloc(sizeof(IH264ENC_OutArgs));
698 outArgs->size = sizeof(IH264ENC_OutArgs);
699 h264enc_outArgs = (IH264ENC_OutArgs *) outArgs;
700
701 params = dce_alloc(sizeof(IH264ENC_Params));
702 params->size = sizeof(IH264ENC_Params);
703 break;
704 case DCE_ENC_TEST_MPEG4 :
705 case DCE_ENC_TEST_H263 :
706 inArgs = dce_alloc(sizeof(IMPEG4ENC_InArgs));
707 inArgs->size = sizeof(IMPEG4ENC_InArgs);
708
709 outArgs = dce_alloc(sizeof(IMPEG4ENC_OutArgs));
710 outArgs->size = sizeof (IMPEG4ENC_OutArgs);
711 mpeg4enc_outArgs = (IMPEG4ENC_OutArgs *) outArgs;
712
713 params = dce_alloc(sizeof(IMPEG4ENC_Params));
714 params->size = sizeof(IMPEG4ENC_Params);
715 break;
716 default :
717 ERROR("Unrecognized codec to encode");
718 }
719
720 params->encodingPreset = XDM_USER_DEFINED; //XDM_USER_DEFINED; //XDM_EncodingPreset
721 params->rateControlPreset = IVIDEO_USER_DEFINED;
722 params->maxHeight = height;
723 params->maxWidth = width;
724 params->dataEndianness = XDM_BYTE; //XDM_DataFormat
725 params->maxBitRate = -1; //IGNORED
726 params->minBitRate = 0;
727 params->inputChromaFormat = XDM_YUV_420SP; //XDM_ChromaFormat
728 params->inputContentType = IVIDEO_PROGRESSIVE; //IVIDEO_ContentType
729 params->operatingMode = IVIDEO_ENCODE_ONLY; //IVIDEO_OperatingMode
730 params->profile = profile_value;
731 params->level = level;
732 params->inputDataMode = IVIDEO_ENTIREFRAME; //IVIDEO_DataMode
733 params->outputDataMode = IVIDEO_ENTIREFRAME; //IVIDEO_DataMode
734 params->numInputDataUnits = 1;
735 params->numOutputDataUnits = 1;
736 params->metadataType[0] = IVIDEO_METADATAPLANE_NONE;
737 params->metadataType[1] = IVIDEO_METADATAPLANE_NONE;
738 params->metadataType[2] = IVIDEO_METADATAPLANE_NONE;
739
740 DEBUG("dce_alloc VIDENC2_Params successful params=%p", params);
741
742 switch( codec_switch ) {
743 case DCE_ENC_TEST_H264 :
744 DEBUG("H.264 Encoding with profile_value %d level %d", profile_value, level);
745 params->maxInterFrameInterval = 1; //1,31 if IVIDEO_ContentType is IVIDEO_PROGRESSIVE
746
747 //Miscellaneous
748 h264enc_params = (IH264ENC_Params *) params;
749 h264enc_params->interlaceCodingType = IH264_INTERLACE_DEFAULT;
750 h264enc_params->bottomFieldIntra = 0;
751 h264enc_params->gopStructure = IH264ENC_GOPSTRUCTURE_DEFAULT; // IH264ENC_GOPSTRUCTURE_NONUNIFORM
752 h264enc_params->entropyCodingMode = IH264_ENTROPYCODING_DEFAULT; // IH264_ENTROPYCODING_CAVLC - BASE PROFILE
753 h264enc_params->transformBlockSize = IH264_TRANSFORM_4x4; // BASE PROFILE
754 h264enc_params->log2MaxFNumMinus4 = 10;
755 h264enc_params->picOrderCountType = IH264_POC_TYPE_DEFAULT; // IH264_POC_TYPE_0
756 h264enc_params->enableWatermark = 0;
757 h264enc_params->IDRFrameInterval = 1;
758 h264enc_params->pConstantMemory = NULL;
759 h264enc_params->maxIntraFrameInterval = 0x7FFFFFFF;
760 h264enc_params->debugTraceLevel = 0;
761 h264enc_params->lastNFramesToLog = 0;
762 h264enc_params->enableAnalyticinfo = 0;
763 h264enc_params->enableGMVSei = 0;
764 h264enc_params->constraintSetFlags = 20;
765 h264enc_params->enableRCDO = 0;
766 h264enc_params->enableLongTermRefFrame = IH264ENC_LTRP_NONE;
767 h264enc_params->LTRPPeriod = 0;
768
769 //H-P Coding Control Params
770 h264enc_params->numTemporalLayer = IH264_TEMPORAL_LAYERS_1;
771 h264enc_params->referencePicMarking = IH264_LONG_TERM_PICTURE;
772 h264enc_params->reservedParams[0] = 0;
773 h264enc_params->reservedParams[1] = 0;
774 h264enc_params->reservedParams[2] = 0;
775
776 //rate control params
777 h264enc_params->rateControlParams.rateControlParamsPreset = IH264_RATECONTROLPARAMS_USERDEFINED;
778 h264enc_params->rateControlParams.scalingMatrixPreset = IH264_SCALINGMATRIX_NONE;
779 h264enc_params->rateControlParams.rcAlgo = IH264_RATECONTROL_DEFAULT; // 0
780 h264enc_params->rateControlParams.qpI = 28;
781 h264enc_params->rateControlParams.qpMaxI = 36;
782 h264enc_params->rateControlParams.qpMinI = 10;
783 h264enc_params->rateControlParams.qpP = 28;
784 h264enc_params->rateControlParams.qpMaxP = 40;
785 h264enc_params->rateControlParams.qpMinP = 10;
786 h264enc_params->rateControlParams.qpOffsetB = 4;
787 h264enc_params->rateControlParams.qpMaxB = 44;
788 h264enc_params->rateControlParams.qpMinB = 10;
789 h264enc_params->rateControlParams.allowFrameSkip = 0;
790 h264enc_params->rateControlParams.removeExpensiveCoeff = 0;
791 h264enc_params->rateControlParams.chromaQPIndexOffset = 0;
792 h264enc_params->rateControlParams.IPQualityFactor = IH264_QUALITY_FACTOR_DEFAULT; // 0
793 h264enc_params->rateControlParams.initialBufferLevel = 64000;
794 h264enc_params->rateControlParams.HRDBufferSize = 64000;
795 h264enc_params->rateControlParams.minPicSizeRatioI = 0;
796 h264enc_params->rateControlParams.maxPicSizeRatioI = 20;
797 h264enc_params->rateControlParams.minPicSizeRatioP = 0;
798 h264enc_params->rateControlParams.maxPicSizeRatioP = 0;
799 h264enc_params->rateControlParams.minPicSizeRatioB = 0;
800 h264enc_params->rateControlParams.maxPicSizeRatioB = 0;
801 h264enc_params->rateControlParams.enablePRC = 1;
802 h264enc_params->rateControlParams.enablePartialFrameSkip = 0;
803 h264enc_params->rateControlParams.discardSavedBits = 0;
804 h264enc_params->rateControlParams.reserved = 0;
805 h264enc_params->rateControlParams.VBRDuration = 8;
806 h264enc_params->rateControlParams.VBRsensitivity = 0;
807 h264enc_params->rateControlParams.skipDistributionWindowLength = 5;
808 h264enc_params->rateControlParams.numSkipInDistributionWindow =1;
809 h264enc_params->rateControlParams.enableHRDComplianceMode = 1;
810 h264enc_params->rateControlParams.frameSkipThMulQ5 = 0;
811 h264enc_params->rateControlParams.vbvUseLevelThQ5 = 0;
812 h264enc_params->rateControlParams.reservedRC[0] = 0;
813 h264enc_params->rateControlParams.reservedRC[1] = 0;
814 h264enc_params->rateControlParams.reservedRC[2] = 0;
815
816 //intercoding coding params
817 h264enc_params->interCodingParams.interCodingPreset = IH264_INTERCODING_USERDEFINED;
818 h264enc_params->interCodingParams.searchRangeHorP = 144;
819 h264enc_params->interCodingParams.searchRangeVerP = 32;
820 h264enc_params->interCodingParams.searchRangeHorB = 144;
821 h264enc_params->interCodingParams.searchRangeVerB = 16;
822 h264enc_params->interCodingParams.interCodingBias = IH264_BIASFACTOR_DEFAULT;
823 h264enc_params->interCodingParams.skipMVCodingBias = IH264_BIASFACTOR_MILD;
824 h264enc_params->interCodingParams.minBlockSizeP = IH264_BLOCKSIZE_8x8;
825 h264enc_params->interCodingParams.minBlockSizeB = IH264_BLOCKSIZE_8x8;
826 h264enc_params->interCodingParams.meAlgoMode = IH264ENC_MOTIONESTMODE_DEFAULT;
827
828 //intra coding params.
829 h264enc_params->intraCodingParams.intraCodingPreset = IH264_INTRACODING_DEFAULT;
830 h264enc_params->intraCodingParams.lumaIntra4x4Enable = 0;
831 h264enc_params->intraCodingParams.lumaIntra8x8Enable = 0x0FF;
832 h264enc_params->intraCodingParams.lumaIntra16x16Enable = 0; // BASE PROFILE
833 h264enc_params->intraCodingParams.chromaIntra8x8Enable = 0; // BASE PROFILE
834 h264enc_params->intraCodingParams.chromaComponentEnable = IH264_CHROMA_COMPONENT_CB_CR_BOTH; // BASE PROFILE
835 h264enc_params->intraCodingParams.intraRefreshMethod = IH264_INTRAREFRESH_DEFAULT;
836 h264enc_params->intraCodingParams.intraRefreshRate = 0;
837 h264enc_params->intraCodingParams.gdrOverlapRowsBtwFrames = 0;
838 h264enc_params->intraCodingParams.constrainedIntraPredEnable = 0;
839 h264enc_params->intraCodingParams.intraCodingBias = IH264ENC_INTRACODINGBIAS_DEFAULT;
840
841 //NALU Control Params.
842 h264enc_params->nalUnitControlParams.naluControlPreset = IH264_NALU_CONTROL_USERDEFINED;
843 h264enc_params->nalUnitControlParams.naluPresentMaskStartOfSequence = 0x01A0; // 416
844 h264enc_params->nalUnitControlParams.naluPresentMaskIDRPicture = 0x0020; //32
845 h264enc_params->nalUnitControlParams.naluPresentMaskIntraPicture = 2;
846 h264enc_params->nalUnitControlParams.naluPresentMaskNonIntraPicture = 2;
847 h264enc_params->nalUnitControlParams.naluPresentMaskEndOfSequence = 0x0C00; // 3072
848
849 //Slice coding params
850 h264enc_params->sliceCodingParams.sliceCodingPreset = IH264_SLICECODING_DEFAULT;
851 h264enc_params->sliceCodingParams.sliceMode = IH264_SLICEMODE_DEFAULT;
852 h264enc_params->sliceCodingParams.sliceUnitSize = 0;
853 h264enc_params->sliceCodingParams.sliceStartOffset[0] = 0;
854 h264enc_params->sliceCodingParams.sliceStartOffset[1] = 0;
855 h264enc_params->sliceCodingParams.sliceStartOffset[2] = 0;
856 h264enc_params->sliceCodingParams.streamFormat = IH264_STREAM_FORMAT_DEFAULT;
857
858 //Loop Filter Params
859 h264enc_params->loopFilterParams.loopfilterPreset = IH264_LOOPFILTER_DEFAULT;
860 h264enc_params->loopFilterParams.loopfilterDisableIDC = IH264_DISABLE_FILTER_DEFAULT;
861 h264enc_params->loopFilterParams.filterOffsetA = 0;
862 h264enc_params->loopFilterParams.filterOffsetB = 0;
863
864 //fmo coding params
865 h264enc_params->fmoCodingParams.fmoCodingPreset = IH264_FMOCODING_DEFAULT;
866 h264enc_params->fmoCodingParams.numSliceGroups = 1;
867 h264enc_params->fmoCodingParams.sliceGroupMapType = IH264_SLICE_GRP_MAP_DEFAULT; // 4
868 h264enc_params->fmoCodingParams.sliceGroupChangeDirectionFlag = IH264ENC_SLICEGROUP_CHANGE_DIRECTION_DEFAULT;
869 h264enc_params->fmoCodingParams.sliceGroupChangeRate = 0;
870 h264enc_params->fmoCodingParams.sliceGroupChangeCycle = 0;
871 h264enc_params->fmoCodingParams.sliceGroupParams[0] = 0;
872 h264enc_params->fmoCodingParams.sliceGroupParams[1] = 0;
873
874 //VUI Control Params
875 h264enc_params->vuiCodingParams.vuiCodingPreset = IH264_VUICODING_DEFAULT;
876 h264enc_params->vuiCodingParams.aspectRatioInfoPresentFlag = 0;
877 h264enc_params->vuiCodingParams.aspectRatioIdc = 0;
878 h264enc_params->vuiCodingParams.videoSignalTypePresentFlag = 0;
879 h264enc_params->vuiCodingParams.videoFormat = IH264ENC_VIDEOFORMAT_NTSC;
880 h264enc_params->vuiCodingParams.videoFullRangeFlag = 0;
881 h264enc_params->vuiCodingParams.timingInfoPresentFlag = 0;
882 h264enc_params->vuiCodingParams.hrdParamsPresentFlag = 0;
883 h264enc_params->vuiCodingParams.numUnitsInTicks= 1000;
884
885 //Stereo Info Control Params
886 h264enc_params->stereoInfoParams.stereoInfoPreset = IH264_STEREOINFO_DISABLE;
887 h264enc_params->stereoInfoParams.topFieldIsLeftViewFlag = 1;
888 h264enc_params->stereoInfoParams.viewSelfContainedFlag = 0;
889
890 //Frame Packing SEI Params
891 h264enc_params->framePackingSEIParams.framePackingPreset = IH264_FRAMEPACK_SEI_DISABLE;
892 h264enc_params->framePackingSEIParams.framePackingType = IH264_FRAMEPACK_TYPE_DEFAULT;
893 h264enc_params->framePackingSEIParams.frame0PositionX = 0;
894 h264enc_params->framePackingSEIParams.frame0PositionY = 0;
895 h264enc_params->framePackingSEIParams.frame1PositionX = 0;
896 h264enc_params->framePackingSEIParams.frame1PositionY = 0;
897 h264enc_params->framePackingSEIParams.reservedByte = 0;
898
899 //SVC coding params
900 h264enc_params->svcCodingParams.svcExtensionFlag = IH264_SVC_EXTENSION_FLAG_DISABLE;
901 h264enc_params->svcCodingParams.dependencyID = 0;
902 h264enc_params->svcCodingParams.qualityID = 0;
903 h264enc_params->svcCodingParams.enhancementProfileID = 0;
904 h264enc_params->svcCodingParams.layerIndex = 0;
905 h264enc_params->svcCodingParams.refLayerDQId = 0;
906
907 DEBUG("dce_alloc VIDENC2_Params successful h264enc_params=%p", h264enc_params);
908
909 codec = VIDENC2_create(engine, "ivahd_h264enc", (VIDENC2_Params *)h264enc_params);
910 break;
911
912 case DCE_ENC_TEST_MPEG4 :
913 case DCE_ENC_TEST_H263 :
914 params->maxInterFrameInterval = 0;
915
916 mpeg4enc_params = (IMPEG4ENC_Params *) params;
917
918 mpeg4enc_params->useDataPartitioning = 0;
919 mpeg4enc_params->useRvlc = 0;
920 if( codec_switch == DCE_ENC_TEST_H263 ) {
921 mpeg4enc_params->useShortVideoHeader = 1;
922 } else {
923 mpeg4enc_params->useShortVideoHeader = 0;
924 }
925 mpeg4enc_params->vopTimeIncrementResolution = 30;
926 mpeg4enc_params->nonMultiple16RefPadMethod = IMPEG4_PAD_METHOD_MPEG4;
927 mpeg4enc_params->pixelRange = IMPEG4ENC_PR_0_255;
928 mpeg4enc_params->enableSceneChangeAlgo = IMPEG4ENC_SCDA_DISABLE;
929 mpeg4enc_params->useVOS = 0;
930 mpeg4enc_params->enableMONA = 0;
931 mpeg4enc_params->enableAnalyticinfo = 0;
932 mpeg4enc_params->debugTraceLevel = 0;
933 mpeg4enc_params->lastNFramesToLog = 0;
934
935 // IMPEG4ENC_RateControlParams
936 mpeg4enc_params->rateControlParams.rateControlParamsPreset = IMPEG4_RATECONTROLPARAMS_DEFAULT;
937 mpeg4enc_params->rateControlParams.rcAlgo = IMPEG4_RATECONTROLALGO_VBR;
938 mpeg4enc_params->rateControlParams.qpI = 5;
939 mpeg4enc_params->rateControlParams.qpP = 5;
940 mpeg4enc_params->rateControlParams.seIntialQP = 5;
941 mpeg4enc_params->rateControlParams.qpMax = 31;
942 mpeg4enc_params->rateControlParams.qpMin = 1;
943 mpeg4enc_params->rateControlParams.enablePerceptualQuantMode = 0;
944 mpeg4enc_params->rateControlParams.allowFrameSkip = 0;
945 mpeg4enc_params->rateControlParams.initialBufferLevel = 0;
946 mpeg4enc_params->rateControlParams.vbvBufferSize = 0;
947 mpeg4enc_params->rateControlParams.qpMinIntra = 0;
948
949 // IMPEG4ENC_InterCodingParams
950 mpeg4enc_params->interCodingParams.interCodingPreset = IMPEG4_INTERCODING_DEFAULT;
951 mpeg4enc_params->interCodingParams.searchRangeHorP = 144;
952 mpeg4enc_params->interCodingParams.searchRangeVerP = 32;
953 mpeg4enc_params->interCodingParams.globalOffsetME = 1;
954 mpeg4enc_params->interCodingParams.earlySkipThreshold = 200;
955 mpeg4enc_params->interCodingParams.enableThresholdingMethod = 1;
956 mpeg4enc_params->interCodingParams.minBlockSizeP = IMPEG4_BLOCKSIZE_8x8;
957 mpeg4enc_params->interCodingParams.enableRoundingControl = 1;
958
959 // IMPEG4ENC_IntraCodingParams
960 mpeg4enc_params->intraCodingParams.intraCodingPreset = IMPEG4_INTRACODING_DEFAULT;
961 mpeg4enc_params->intraCodingParams.intraRefreshMethod = 0;
962 mpeg4enc_params->intraCodingParams.intraRefreshRate = 0;
963 mpeg4enc_params->intraCodingParams.acpredEnable = 1;
964 mpeg4enc_params->intraCodingParams.insertGOVHdrBeforeIframe = 0;
965 mpeg4enc_params->intraCodingParams.enableDriftControl = 1;
966
967 // IMPEG4ENC_sliceCodingParams
968 mpeg4enc_params->sliceCodingParams.sliceCodingPreset = IMPEG4_SLICECODING_DEFAULT;
969 mpeg4enc_params->sliceCodingParams.sliceMode = IMPEG4_SLICEMODE_NONE;
970 mpeg4enc_params->sliceCodingParams.sliceUnitSize = 0;
971 mpeg4enc_params->sliceCodingParams.gobInterval = 0;
972 mpeg4enc_params->sliceCodingParams.useHec = 0;
973
974 DEBUG("dce_alloc VIDENC2_Params successful mpeg4enc_params=%p", mpeg4enc_params);
975
976 codec = VIDENC2_create(engine, "ivahd_mpeg4enc", (VIDENC2_Params *)mpeg4enc_params);
977 break;
978 default :
979 ERROR("Unrecognized codec to encode");
980 }
981
982 if( !codec ) {
983 ERROR("fail");
984 goto out;
985 }
986
987 DEBUG("VIDENC2_create successful codec=%p", codec);
988
989 switch( codec_switch ) {
990 case DCE_ENC_TEST_H264 :
991 dynParams = dce_alloc(sizeof(IH264ENC_DynamicParams));
992 dynParams->size = sizeof(IH264ENC_DynamicParams);
993 DEBUG("dce_alloc dynParams successful dynParams=%p size=%d", dynParams, dynParams->size);
994
995 break;
996 case DCE_ENC_TEST_MPEG4 :
997 case DCE_ENC_TEST_H263 :
998 dynParams = dce_alloc(sizeof(IMPEG4ENC_DynamicParams));
999 dynParams->size = sizeof(IMPEG4ENC_DynamicParams);
1000 break;
1001 default :
1002 ERROR("Unrecognized codec to encode");
1003 }
1004
1005 dynParams->inputHeight = height;
1006 dynParams->inputWidth = width;
1007 dynParams->refFrameRate = 15000; // refFrameRate in fps * 1000
1008 dynParams->targetFrameRate= 15000; // Target frame rate in fps * 1000
1009 dynParams->targetBitRate = 64000;
1010 dynParams->intraFrameInterval = 15; //Only 1st frame to be intra frame (I-frame)
1011 dynParams->generateHeader = XDM_ENCODE_AU;
1012 dynParams->captureWidth = width;
1013 dynParams->forceFrame = IVIDEO_NA_FRAME;
1014 dynParams->sampleAspectRatioHeight = 1;
1015 dynParams->sampleAspectRatioWidth = 1;
1016 dynParams->ignoreOutbufSizeFlag = XDAS_FALSE; // If this is XDAS_TRUE then getBufferFxn and getBufferHandle needs to be set.
1017 dynParams->putDataFxn = NULL;
1018 dynParams->putDataHandle = NULL;
1019 dynParams->getDataFxn = NULL;
1020 dynParams->getDataHandle = NULL;
1021 dynParams->getBufferFxn = NULL;
1022 dynParams->getBufferHandle = NULL;
1023 dynParams->lateAcquireArg = -1;
1024
1025 switch( codec_switch ) {
1026 case DCE_ENC_TEST_H264 :
1027 dynParams->interFrameInterval = 1; // 2 B frames
1028 dynParams->mvAccuracy = IVIDENC2_MOTIONVECTOR_QUARTERPEL; //IVIDENC2_MotionVectorAccuracy
1029
1030 DEBUG("dce_alloc IH264ENC_DynamicParams successful size %d dynParams=%p", dynParams->size, dynParams);
1031 h264enc_dynParams = (IH264ENC_DynamicParams *) dynParams;
1032
1033 h264enc_dynParams->sliceGroupChangeCycle = 0;
1034 h264enc_dynParams->searchCenter.x = 0x7FFF; // or 32767
1035 h264enc_dynParams->searchCenter.y = 0x7FFF; // or 32767
1036 h264enc_dynParams->enableStaticMBCount = 0;
1037 h264enc_dynParams->enableROI = 0;
1038 h264enc_dynParams->reservedDynParams[0] = 0;
1039 h264enc_dynParams->reservedDynParams[1] = 0;
1040 h264enc_dynParams->reservedDynParams[2] = 0;
1041
1042 //Rate Control Params
1043 h264enc_dynParams->rateControlParams.rateControlParamsPreset = IH264_RATECONTROLPARAMS_EXISTING;
1044 h264enc_dynParams->rateControlParams.scalingMatrixPreset = IH264_SCALINGMATRIX_NONE;
1045 h264enc_dynParams->rateControlParams.rcAlgo = IH264_RATECONTROL_DEFAULT;
1046 h264enc_dynParams->rateControlParams.qpI = 28;
1047 h264enc_dynParams->rateControlParams.qpMaxI = 36;
1048 h264enc_dynParams->rateControlParams.qpMinI = 10;
1049 h264enc_dynParams->rateControlParams.qpP = 28;
1050 h264enc_dynParams->rateControlParams.qpMaxP = 40;
1051 h264enc_dynParams->rateControlParams.qpMinP = 10;
1052 h264enc_dynParams->rateControlParams.qpOffsetB = 4;
1053 h264enc_dynParams->rateControlParams.qpMaxB = 44;
1054 h264enc_dynParams->rateControlParams.qpMinB = 10;
1055 h264enc_dynParams->rateControlParams.allowFrameSkip = 0;
1056 h264enc_dynParams->rateControlParams.removeExpensiveCoeff = 0;
1057 h264enc_dynParams->rateControlParams.IPQualityFactor = IH264_QUALITY_FACTOR_DEFAULT;
1058 h264enc_dynParams->rateControlParams.chromaQPIndexOffset = 0;
1059 h264enc_dynParams->rateControlParams.initialBufferLevel = 64000;
1060 h264enc_dynParams->rateControlParams.HRDBufferSize = 64000;
1061 h264enc_dynParams->rateControlParams.enablePartialFrameSkip = 0;
1062 h264enc_dynParams->rateControlParams.minPicSizeRatioI = 0;
1063 h264enc_dynParams->rateControlParams.maxPicSizeRatioI = 20;
1064 h264enc_dynParams->rateControlParams.minPicSizeRatioP = 0;
1065 h264enc_dynParams->rateControlParams.maxPicSizeRatioP = 0;
1066 h264enc_dynParams->rateControlParams.minPicSizeRatioB = 0;
1067 h264enc_dynParams->rateControlParams.maxPicSizeRatioB = 0;
1068 h264enc_dynParams->rateControlParams.enablePRC = 1;
1069 h264enc_dynParams->rateControlParams.enableHRDComplianceMode = 0;
1070 h264enc_dynParams->rateControlParams.reserved = 0;
1071 h264enc_dynParams->rateControlParams.VBRDuration = 8;
1072 h264enc_dynParams->rateControlParams.VBRsensitivity = 0;
1073 h264enc_dynParams->rateControlParams.skipDistributionWindowLength = 5;
1074 h264enc_dynParams->rateControlParams.numSkipInDistributionWindow = 1;
1075 h264enc_dynParams->rateControlParams.enableHRDComplianceMode = 1;
1076 h264enc_dynParams->rateControlParams.frameSkipThMulQ5 = 0;
1077 h264enc_dynParams->rateControlParams.vbvUseLevelThQ5 = 0;
1078 h264enc_dynParams->rateControlParams.reservedRC[0] = 0;
1079 h264enc_dynParams->rateControlParams.reservedRC[1] = 0;
1080 h264enc_dynParams->rateControlParams.reservedRC[2] = 0;
1081
1082 //Inter Coding Params
1083 h264enc_dynParams->interCodingParams.interCodingPreset = IH264_INTERCODING_EXISTING;
1084 h264enc_dynParams->interCodingParams.searchRangeHorP = 144;
1085 h264enc_dynParams->interCodingParams.searchRangeVerP = 32;
1086 h264enc_dynParams->interCodingParams.searchRangeHorB = 144;
1087 h264enc_dynParams->interCodingParams.searchRangeVerB = 16;
1088 h264enc_dynParams->interCodingParams.interCodingBias= IH264_BIASFACTOR_DEFAULT;
1089 h264enc_dynParams->interCodingParams.skipMVCodingBias = IH264_BIASFACTOR_MILD;
1090 h264enc_dynParams->interCodingParams.minBlockSizeP = IH264_BLOCKSIZE_8x8;
1091 h264enc_dynParams->interCodingParams.minBlockSizeB = IH264_BLOCKSIZE_8x8;
1092 h264enc_dynParams->interCodingParams.meAlgoMode = IH264ENC_MOTIONESTMODE_DEFAULT;
1093
1094 //Intra Coding Params
1095 h264enc_dynParams->intraCodingParams.intraCodingPreset = IH264_INTRACODING_EXISTING;
1096 h264enc_dynParams->intraCodingParams.lumaIntra4x4Enable = 0xFF; // or 255 BASE PROFILE
1097 h264enc_dynParams->intraCodingParams.lumaIntra8x8Enable = 0; // BASE PROFILE
1098 h264enc_dynParams->intraCodingParams.lumaIntra16x16Enable = 0;
1099 h264enc_dynParams->intraCodingParams.chromaIntra8x8Enable = 0;
1100 h264enc_dynParams->intraCodingParams.chromaComponentEnable = IH264_CHROMA_COMPONENT_CB_CR_BOTH;
1101 h264enc_dynParams->intraCodingParams.intraRefreshMethod = IH264_INTRAREFRESH_DEFAULT;
1102 h264enc_dynParams->intraCodingParams.intraRefreshRate = 0;
1103 h264enc_dynParams->intraCodingParams.gdrOverlapRowsBtwFrames = 0;
1104 h264enc_dynParams->intraCodingParams.constrainedIntraPredEnable = 0;
1105 h264enc_dynParams->intraCodingParams.intraCodingBias = IH264ENC_INTRACODINGBIAS_DEFAULT;
1106
1107 //Slice Coding Params
1108 h264enc_dynParams->sliceCodingParams.sliceCodingPreset = IH264_SLICECODING_EXISTING;
1109 h264enc_dynParams->sliceCodingParams.sliceMode = IH264_SLICEMODE_DEFAULT;
1110 h264enc_dynParams->sliceCodingParams.sliceUnitSize = 0;
1111 h264enc_dynParams->sliceCodingParams.sliceStartOffset[0] = 0;
1112 h264enc_dynParams->sliceCodingParams.sliceStartOffset[1] = 0;
1113 h264enc_dynParams->sliceCodingParams.sliceStartOffset[2] = 0;
1114 h264enc_dynParams->sliceCodingParams.streamFormat = IH264_STREAM_FORMAT_DEFAULT;
1115
1116 status = dce_alloc(sizeof(IH264ENC_Status));
1117 status->size = sizeof(IH264ENC_Status);
1118 DEBUG("dce_alloc IH264ENC_Status successful status=%p", status);
1119
1120 h264enc_status = (IH264ENC_Status *) status;
1121 err = VIDENC2_control(codec, XDM_SETPARAMS, (VIDENC2_DynamicParams *) h264enc_dynParams, (VIDENC2_Status *) h264enc_status);
1122 DEBUG("dce_alloc IH264ENC_Status successful h264enc_status=%p", h264enc_status);
1123 break;
1124
1125 case DCE_ENC_TEST_MPEG4 :
1126 case DCE_ENC_TEST_H263 :
1127 dynParams->interFrameInterval = 0;
1128 dynParams->mvAccuracy = IVIDENC2_MOTIONVECTOR_HALFPEL; //IVIDENC2_MotionVectorAccuracy
1129
1130 DEBUG("dce_alloc IMPEG4ENC_DynamicParams successful size %d dynParams=%p", dynParams->size, dynParams);
1131 mpeg4enc_dynParams = (IMPEG4ENC_DynamicParams *) dynParams;
1132
1133 mpeg4enc_dynParams->aspectRatioIdc = IMPEG4ENC_ASPECTRATIO_SQUARE;
1134
1135 // IMPEG4ENC_RateControlParams
1136 memcpy(&mpeg4enc_dynParams->rateControlParams, &mpeg4enc_params->rateControlParams, sizeof(IMPEG4ENC_RateControlParams));
1137 // IMPEG4ENC_InterCodingParams
1138 memcpy(&mpeg4enc_dynParams->interCodingParams, &mpeg4enc_params->interCodingParams, sizeof(IMPEG4ENC_InterCodingParams));
1139 // IMPEG4ENC_sliceCodingParams
1140 memcpy(&mpeg4enc_dynParams->sliceCodingParams, &mpeg4enc_params->sliceCodingParams, sizeof(IMPEG4ENC_sliceCodingParams));
1141
1142 status = dce_alloc(sizeof(IMPEG4ENC_Status));
1143 status->size = sizeof(IMPEG4ENC_Status);
1144 DEBUG("dce_alloc IMPEG4ENC_Status successful status=%p", status);
1145
1146 mpeg4enc_status = (IMPEG4ENC_Status *) status;
1147 DEBUG("dce_alloc IMPEG4ENC_Status successful mpeg4enc_status=%p", mpeg4enc_status);
1148 err = VIDENC2_control(codec, XDM_SETPARAMS, (VIDENC2_DynamicParams *) mpeg4enc_dynParams, (VIDENC2_Status *) mpeg4enc_status);
1149 ERROR("Codec_control returned err=%d, extendedError=%08x", err, mpeg4enc_status->videnc2Status.extendedError);
1150 break;
1151 default :
1152 ERROR("Unrecognized codec to encode");
1153 }
1154
1155 if( err ) {
1156 ERROR("fail: %d", err);
1157 goto shutdown;
1158 }
1159
1160 DEBUG("VIDENC2_control XDM_SETPARAMS successful");
1161
1162 // XDM_GETBUFINFO
1163 // Send Control cmd XDM_GETBUFINFO to get min output and output size
1164 err = VIDENC2_control(codec, XDM_GETBUFINFO, dynParams, status);
1165 DEBUG("VIDENC2_control - XDM_GETBUFINFO err %d status numOutBuf %d OutBufSize %d", err, status->bufInfo.minNumOutBufs, status->bufInfo.minOutBufSize[0].bytes);
1166
1167 outBufs = dce_alloc(sizeof(XDM2_BufDesc));
1168 output_size = status->bufInfo.minOutBufSize[0].bytes;
1169
1170 DEBUG("Output allocate through tiler 1D");
1171 if( codec_switch == DCE_ENC_TEST_H264 ) {
1172 outBufs->numBufs = status->bufInfo.minNumOutBufs; // this value is 1
1173 } else if( codec_switch == DCE_ENC_TEST_MPEG4 || codec_switch == DCE_ENC_TEST_H263 ) {
1174 outBufs->numBufs = 1;
1175 }
1176 output = tiler_alloc(output_size, 0);
1177#ifdef NON_TILER_OUTPUT
1178 output = output_allocate_nonTiler(output_size);
1179#endif
1180 //outBufs->descs[0].buf = (XDAS_Int8 *)TilerMem_VirtToPhys(output);
1181 outBufs->descs[0].buf = (XDAS_Int8 *)output;
1182
1183 outBufs->descs[0].memType = XDM_MEMTYPE_RAW;
1184 outBufs->descs[0].bufSize.bytes = output_size;
1185
1186 DEBUG("outBufs->descs[0].buf %p output %p", outBufs->descs[0].buf, output);
1187
1188#ifdef DUMPINPUTDATA
1189 char Buff1[100];
1190 int static GlobalCount1 = 0;
1191#endif
1192
1193#ifdef PROFILE_TIME
1194 total_init_time = (uint64_t)mark_microsecond(&init_start_time);
1195 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);
1196#endif
1197
1198 // Handling codec_config
1199 while( inBufs->numPlanes && outBufs->numBufs ) {
1200 int n;
1201 DEBUG("Looping on reading input inBufs->numPlanes %d outBufs->numBufs %d", inBufs->numPlanes, outBufs->numBufs);
1202
1203 //Read the NV12 frame to input buffer to be encoded.
1204 n = read_input(in_pattern, in_cnt, buf->buf);
1205
1206#ifdef DUMPINPUTDATA0
1207 DEBUG("input data buf->buf[%p]", buf->buf);
1208
1209 //Dump the file
1210 if( inputDump == NULL ) {
1211 inputDump = fopen("/sd/dce_enc_dump/inputdump.yuv", "ab");
1212 //DEBUG("input data dump file open %p errno %d", inputDump, errno);
1213 if( inputDump == NULL ) {
1214 DEBUG("Opening input Dump /sd/dce_enc_dump/inputdump.yuv file FAILED");
1215 }
1216 }
1217 //DEBUG("input data dump file open %p Successful", inputDump);
1218
1219 fwrite(buf->buf, sizeof(char), 4096 * height * 3 / 2, inputDump);
1220 DEBUG("Dumping input file of NV12 format with read data of %d inside buffersize = %d", n, 4096 * height * 3 / 2);
1221 fflush(inputDump);
1222 fclose(inputDump);
1223 inputDump = NULL;
1224#endif
1225
1226 if( n && (n != -1)) {
1227 eof = 0;
1228 inBufs->planeDesc[0].buf = (XDAS_Int8 *)buf->y;
1229 inBufs->planeDesc[1].buf = (XDAS_Int8 *)buf->uv;
1230 DEBUG("inBufs->planeDesc[0].buf %p inBufs->planeDesc[1].buf %p", inBufs->planeDesc[0].buf, inBufs->planeDesc[1].buf);
1231 DEBUG("push: %d (plane[0]= %d + plane[1]= %d = %d bytes) (%p)", in_cnt, inBufs->planeDesc[0].bufSize.bytes, inBufs->planeDesc[1].bufSize.bytes, n, buf);
1232 in_cnt++;
1233
1234 /*
1235 * Input buffer has data to be encoded.
1236 */
1237 inArgs->inputID = (XDAS_Int32)buf;
1238 if( codec_switch == DCE_ENC_TEST_H264 ) {
1239 h264enc_inArgs = (IH264ENC_InArgs *) inArgs;
1240 DEBUG("TEST inArgs->inputID %d h264enc_inArgs->videnc2InArgs.inputID %d", inArgs->inputID, h264enc_inArgs->videnc2InArgs.inputID);
1241 } else if( codec_switch == DCE_ENC_TEST_MPEG4 || codec_switch == DCE_ENC_TEST_H263 ) {
1242 mpeg4enc_inArgs = (IMPEG4ENC_InArgs *) inArgs;
1243 DEBUG("TEST inArgs->inputID %d mpeg4enc_inArgs->videnc2InArgs.inputID %d", inArgs->inputID, mpeg4enc_inArgs->videnc2InArgs.inputID);
1244 }
1245 } else if( n == -1 ) {
1246
1247 // Set EOF as 1 to ensure flush completes
1248 eof = 1;
1249 in_cnt++;
1250
1251 DEBUG("n == -1 - go to shutdown");
1252
1253 goto shutdown;
1254
1255 switch( codec_switch ) {
1256 case DCE_ENC_TEST_H264 :
1257 DEBUG("Calling VIDENC2_control XDM_FLUSH h264enc_dynParams %p h264enc_status %p", h264enc_dynParams, h264enc_status);
1258 err = VIDENC2_control(codec, XDM_FLUSH, (VIDENC2_DynamicParams *) h264enc_dynParams, (VIDENC2_Status *) h264enc_status);
1259 break;
1260 case DCE_ENC_TEST_MPEG4 :
1261 case DCE_ENC_TEST_H263 :
1262 DEBUG("Calling VIDENC2_control XDM_FLUSH mpeg4enc_dynParams %p mpeg4enc_status %p", mpeg4enc_dynParams, mpeg4enc_status);
1263 err = VIDENC2_control(codec, XDM_FLUSH, (VIDENC2_DynamicParams *) mpeg4enc_dynParams, (VIDENC2_Status *) mpeg4enc_status);
1264 break;
1265 default :
1266 ERROR("Unrecognized codec to encode");
1267 }
1268
1269 /* We have sent the XDM_FLUSH, call VIDENC2_process until we get
1270 * an error of XDM_EFAIL which tells us there are no more buffers
1271 * at codec level.
1272 */
1273
1274 inArgs->inputID = 0;
1275 if( codec_switch == DCE_ENC_TEST_H264 ) {
1276 h264enc_inArgs = (IH264ENC_InArgs *) inArgs;
1277 } else if( codec_switch == DCE_ENC_TEST_MPEG4 || codec_switch == DCE_ENC_TEST_H263 ) {
1278 mpeg4enc_inArgs = (IMPEG4ENC_InArgs *) inArgs;
1279 }
1280 inBufs->planeDesc[0].bufSize.bytes = 0;
1281 inBufs->planeDesc[1].bufSize.bytes = 0;
1282 outBufs->descs[0].buf = NULL;
1283 outBufs->descs[1].buf = NULL;
1284 } else {
1285 /* end of input.. (n == 0) */
1286 inBufs->numPlanes = 0;
1287 eof = 1;
1288 DEBUG("n == 0 - go to shutdown");
1289
1290 goto shutdown;
1291
1292 switch( codec_switch ) {
1293 case DCE_ENC_TEST_H264 :
1294 DEBUG("Calling VIDENC2_control XDM_FLUSH h264enc_dynParams %p h264enc_status %p", h264enc_dynParams, h264enc_status);
1295 err = VIDENC2_control(codec, XDM_FLUSH, (VIDENC2_DynamicParams *) h264enc_dynParams, (VIDENC2_Status *) h264enc_status);
1296 break;
1297 case DCE_ENC_TEST_MPEG4 :
1298 case DCE_ENC_TEST_H263 :
1299 DEBUG("Calling VIDENC2_control XDM_FLUSH mpeg4enc_dynParams %p mpeg4enc_status %p", mpeg4enc_dynParams, mpeg4enc_status);
1300 err = VIDENC2_control(codec, XDM_FLUSH, (VIDENC2_DynamicParams *) mpeg4enc_dynParams, (VIDENC2_Status *) mpeg4enc_status);
1301 break;
1302 default :
1303 ERROR("Unrecognized codec to encode");
1304 }
1305
1306 /* We have sent the XDM_FLUSH, call VIDENC2_process until we get
1307 * an error of XDM_EFAIL which tells us there are no more buffers
1308 * at codec level.
1309 */
1310
1311 inArgs->inputID = 0;
1312 if( codec_switch == DCE_ENC_TEST_H264 ) {
1313 h264enc_inArgs = (IH264ENC_InArgs *) inArgs;
1314 } else if( codec_switch == DCE_ENC_TEST_MPEG4 || codec_switch == DCE_ENC_TEST_H263 ) {
1315 mpeg4enc_inArgs = (IMPEG4ENC_InArgs *) inArgs;
1316 }
1317 inBufs->planeDesc[0].bufSize.bytes = 0;
1318 inBufs->planeDesc[1].bufSize.bytes = 0;
1319 outBufs->descs[0].buf = NULL;
1320 outBufs->descs[1].buf = NULL;
1321 }
1322
1323#ifdef DUMPINPUTDATA
1324 DEBUG("input data buf->buf[%p]", buf->buf);
1325
1326 //Dump the file
1327 if( inputDump == NULL ) {
1328
1329 if( GlobalCount1 <= 50 ) {
1330 DEBUG("[DCE_ENC_TEST] GlobalCount1 %d\n", GlobalCount1);
1331 sprintf(Buff1, "/sd/dce_enc_dump/dceinputdump%d.bin", GlobalCount1);
1332 inputDump = fopen(Buff1, "wb+");
1333 //DEBUG("input data dump file open %p errno %d", inputDump, errno);
1334 if( inputDump == NULL ) {
1335 DEBUG("Opening input Dump /sd/dce_enc_dump/dceinputdump.bin file FAILED");
1336 } else {
1337 GlobalCount1++;
1338 //DEBUG("Before Input [%p]\n", input);
1339 fwrite(buf->buf, 1, 4096 * height * 3 / 2, inputDump);
1340 DEBUG("Dumping input file of NV12 format with read data of %d inside buffersize = %d", n, 4096 * height * 3 / 2);
1341
1342 fflush(inputDump);
1343 fclose(inputDump);
1344 inputDump = NULL;
1345 }
1346 }
1347 //DEBUG("input data dump file open %p Successful", inputDump);
1348 }
1349#endif
1350
1351 int iters = 0;
1352
1353 do {
1354
1355#ifdef H264_DEBUG
1356
1357 DEBUG(">> Going to call VIDENC2_process codec=%p, inBufs=%p, outBufs=%p, h264enc_inArgs=%p, h264enc_outArgs=%p",
1358 codec, inBufs, outBufs, h264enc_inArgs, h264enc_outArgs);
1359
1360 DEBUG("Calling VIDENC2_process inArgs->inputID=%x inBufs->descs[0].buf %p inBufs->descs[0].bufSize %d",
1361 inArgs->inputID, inBufs->planeDesc[0].buf, (int) inBufs->planeDesc[0].bufSize.bytes);
1362
1363 DEBUG("Calling VIDENC2_process inArgs->inputID=%x inBufs->descs[1].buf %p inBufs->descs[1].bufSize %d",
1364 inArgs->inputID, inBufs->planeDesc[1].buf, (int) inBufs->planeDesc[1].bufSize.bytes);
1365
1366 DEBUG("h264enc_inArgs->videnc2InArgs.size %d inputID %d control %d ", h264enc_inArgs->videnc2InArgs.size,
1367 h264enc_inArgs->videnc2InArgs.inputID, h264enc_inArgs->videnc2InArgs.control);
1368#endif
1369
1370#ifdef PROFILE_TIME
1371 codec_process_time = mark_microsecond(NULL);
1372#endif
1373
1374#if 0
1375 err = VIDENC2_process(codec, inBufs, outBufs, inArgs, outArgs);
1376#endif
1377
1378 if( codec_switch == DCE_ENC_TEST_H264 ) {
1379 err = VIDENC2_process(codec, inBufs, outBufs, (VIDENC2_InArgs *) h264enc_inArgs, (VIDENC2_OutArgs *) h264enc_outArgs);
1380 DEBUG("[DCE_ENC_TEST] VIDENC2_process - err %d", err);
1381
1382 if( err < 0 ) {
1383 int i = 0;
1384
1385 for( i=0; i < IH264ENC_EXTERROR_NUM_MAXWORDS; i++ ) {
1386 DEBUG("DETAIL EXTENDED ERROR h264enc_outArgs->extErrorCode[%d]=%08x", i, (uint)h264enc_outArgs->extErrorCode[i]);
1387 }
1388
1389 err = VIDENC2_control(codec, XDM_GETSTATUS, (VIDENC2_DynamicParams *) h264enc_dynParams, (VIDENC2_Status *) h264enc_status);
1390 DEBUG("[DCE_ENC_TEST] VIDENC2_control - XDM_GETSTATUS err %d", err);
1391
1392 for( i=0; i < IH264ENC_EXTERROR_NUM_MAXWORDS; i++ ) {
1393 DEBUG("DETAIL EXTENDED ERROR h264enc_status->extErrorCode[%d]=%08x", i, (uint)h264enc_status->extErrorCode[i]);
1394 }
1395
1396 if( XDM_ISFATALERROR(h264enc_outArgs->videnc2OutArgs.extendedError)) {
1397 ERROR("process returned error: %d\n", err);
1398 //ERROR("extendedError: %08x", outArgs->extendedError);
1399 ERROR("extendedError: %08x", h264enc_outArgs->videnc2OutArgs.extendedError);
1400 goto shutdown;
1401 } else if( eof ) {
1402 //ERROR("Codec_process returned err=%d, extendedError=%08x", err, outArgs->extendedError);
1403 ERROR("Codec_process returned err=%d, extendedError=%08x", err, h264enc_outArgs->videnc2OutArgs.extendedError);
1404 err = XDM_EFAIL;
1405
1406 if( err == XDM_EFAIL ) {
1407 DEBUG("-------------------- Flush completed------------------------");
1408 }
1409 } else {
1410 //DEBUG("Non-fatal err=%d, extendedError=%08x", err, outArgs->extendedError);
1411 DEBUG("Non-fatal err=%d, h264enc_outArgs->videnc2OutArgs.extendedError=%08x ", err, h264enc_outArgs->videnc2OutArgs.extendedError);
1412 err = XDM_EOK;
1413 }
1414 }
1415
1416 DEBUG("bytesGenerated %d", h264enc_outArgs->videnc2OutArgs.bytesGenerated);
1417 bytesGenerated = h264enc_outArgs->videnc2OutArgs.bytesGenerated;
1418 } else if( codec_switch == DCE_ENC_TEST_MPEG4 || codec_switch == DCE_ENC_TEST_H263 ) {
1419 DEBUG("[DCE_ENC_TEST] codec %p inBufs %p outBufs %p mpeg4enc_inArgs %p mpeg4enc_outArgs %p", codec, inBufs, outBufs, mpeg4enc_inArgs, mpeg4enc_outArgs);
1420 err = VIDENC2_process(codec, inBufs, outBufs, (VIDENC2_InArgs *) mpeg4enc_inArgs, (VIDENC2_OutArgs *) mpeg4enc_outArgs);
1421 DEBUG("[DCE_ENC_TEST] VIDENC2_process - err %d", err);
1422 if( err < 0 ) {
1423 //TODO error handling on MPEG4/H.263
1424 ERROR("Codec_process returned err=%d, extendedError=%08x", err, mpeg4enc_outArgs->videnc2OutArgs.extendedError);
1425 goto shutdown;
1426 }
1427 DEBUG("\n bytesGenerated %d", mpeg4enc_outArgs->videnc2OutArgs.bytesGenerated);
1428 bytesGenerated = mpeg4enc_outArgs->videnc2OutArgs.bytesGenerated;
1429 }
1430
1431#ifdef PROFILE_TIME
1432 INFO("processed returned in: %llu us", (uint64_t) mark_microsecond(&codec_process_time));
1433#endif
1434
1435 /*
1436 * Handling of output data from codec
1437 */
1438
1439 /* get the output buffer and write it to file */
1440 DEBUG("pop: %d (%p)", out_cnt, output);
1441
1442 if( bytesGenerated ) {
1443 // write the frames to output file based on the value of frames_to_write on how many frames to write.
1444 if( out_cnt < frames_to_write ) {
1445
1446#ifdef DUMPOUTPUTDATA
1447 char Buff2[100];
1448 int static GlobalCount2 = 0;
1449#endif
1450
1451#ifdef DUMPOUTPUTDATA
1452 DEBUG("Dumping output data output[%p]", output);
1453
1454 //Dump individual output file
1455 if( outputDump == NULL ) {
1456 if( GlobalCount2 <= 50 ) {
1457 DEBUG("DCE_ENC_TEST GlobalCount2 %d\n", GlobalCount2);
1458 sprintf(Buff2, "/sd/dce_enc_dump/dceoutputdump%d.bin", GlobalCount2);
1459 outputDump = fopen(Buff2, "wb+");
1460 //DEBUG("output data dump file open %p errno %d", outputDump, errno);
1461 if( outputDump == NULL ) {
1462 DEBUG("Opening output Dump /sd/dce_enc_dump/dceoutputdump.bin file FAILED");
1463 } else {
1464 GlobalCount2++;
1465 fwrite(output, 1, bytesGenerated, outputDump);
1466 DEBUG("Dumping output file of H.264 format of generated buffersize = %d", bytesGenerated);
1467
1468 fflush(outputDump);
1469 fclose(outputDump);
1470 outputDump = NULL;
1471 }
1472 }
1473 //DEBUG("output data dump file open %p Successful", outputDump);
1474 }
1475#endif
1476
1477 write_output(out_pattern, out_cnt++, output, bytesGenerated);
1478 } else {
1479 out_cnt++;
1480 }
1481 }
1482
1483 ++iters; // Guard for infinite VIDENC2_PROCESS loop when codec never return XDM_EFAIL
1484 } while( eof && (err != XDM_EFAIL) && (iters < 100)); // Multiple VIDENC2_process when eof until err == XDM_EFAIL
1485
1486 }
1487
1488shutdown:
1489
1490 printf("\nDeleting encoder codec...\n");
1491 VIDENC2_delete(codec);
1492
1493out:
1494 if( engine ) {
1495 Engine_close(engine);
1496 }
1497 if( params ) {
1498 dce_free(params);
1499 }
1500 if( dynParams ) {
1501 dce_free(dynParams);
1502 }
1503 if( status ) {
1504 dce_free(status);
1505 }
1506 if( inBufs ) {
1507 dce_free(inBufs);
1508 }
1509 if( outBufs ) {
1510 dce_free(outBufs);
1511 }
1512 if( inArgs ) {
1513 dce_free(inArgs);
1514 }
1515 if( outArgs ) {
1516 dce_free(outArgs);
1517 }
1518
1519 printf("\nFreeing output %p...\n", output);
1520 if( output ) {
1521 MemMgr_Free(output);
1522 }
1523#ifdef NON_TILER_OUTPUT
1524 if( output ) {
1525 output_enc_free(output, output_size);
1526 }
1527#endif
1528
1529 printf("\nFreeing buf %p...\n", buf);
1530 if( buf ) {
1531 if( buf->buf ) {
1532 MemMgr_Free(buf->buf);
1533 }
1534 free(buf);
1535 }
1536 printf("DCE ENC test completed...\n");
1537
1538 return (0);
1539}
1540
diff --git a/test_qnx/dce_enc_test/dce_enc_test.use b/test_qnx/dce_enc_test/dce_enc_test.use
new file mode 100644
index 0000000..aadf40a
--- /dev/null
+++ b/test_qnx/dce_enc_test/dce_enc_test.use
@@ -0,0 +1,98 @@
1/*
2 * Copyright (c) 2013, Texas Instruments Incorporated
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
12 * * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33%C dce encoder test application to test libdce for encoding functionality
34
35Syntax:
36%C [options]
37Options:
38 -h Print out the help information
39
40Examples:
411. Encoding h.264
42 dce_enc_test width height inpattern outpattern codec profile level
43 example to encode H.264 QCIF with Profile baseline and Level 1.0
44 dce_enc_test 176 144 inputfile.yuv outputfile.h264 h264 baseline 10
45
46 Acceptable input value for profile:
47 baseline
48 hight
49
50 Acceptable input value for level:
51 10 - Level 1.0
52 9 - Level 1.b
53 11 - Level 1.1
54 12 - Level 1.2
55 13 - Level 1.3
56 20 - Level 2.0
57 21 - Level 2.1
58 22 - Level 2.2
59 30 - Level 3.0
60 31 - Level 3.1
61 32 - Level 3.2
62 40 - Level 4.0
63 41 - Level 4.1
64 42 - Level 4.2
65 50 - Level 5.0
66 51 - Level 5.1
67
682. encoding Mpeg4
69 dce_enc_test width height inpattern outpattern codec profile 0
70 example to encode MPEG4 QCIF with profile simple level 0
71 dce_enc_test 176 144 inputfile.yuv outputfile.mpeg4 mpeg4 0 0
72
73 Acceptable input value for profile:
74 0 - MPEG4 SIMPLE PROFILE LEVEL 0
75 9 - MPEG4 SIMPLE PROFILE LEVEL 0B
76 1 - MPEG4 SIMPLE PROFILE LEVEL 1
77 2 - MPEG4 SIMPLE PROFILE LEVEL 2
78 3 - MPEG4 SIMPLE PROFILE LEVEL 3
79 4 - MPEG4 SIMPLE PROFILE LEVEL 4A
80 5 - MPEG4 SIMPLE PROFILE LEVEL 5
81 6 - MPEG4 SIMPLE PROFILE LEVEL 6
82
833. Encoding H.263
84 dce_enc_test width height inpattern outpattern codec profile 0
85 example to encode H.263 QCIF with profile simple level 0
86 dce_enc_test 176 144 inputfile.yuv outputfile.h263 h263 0 0
87
88 Acceptable input value for profile:
89 10 - H.263 BASELINE PROFILE LEVEL 10
90 20 - H.263 BASELINE PROFILE LEVEL 20
91 30 - H.263 BASELINE PROFILE LEVEL 30
92 40 - H.263 BASELINE PROFILE LEVEL 40
93 45 - H.263 BASELINE PROFILE LEVEL 45
94 50 - H.263 BASELINE PROFILE LEVEL 50
95 60 - H.263 BASELINE PROFILE LEVEL 60
96 70 - H.263 BASELINE PROFILE LEVEL 70
97
98Currently supported codecs: h264 and mpeg4
diff --git a/test_qnx/dce_test/Makefile b/test_qnx/dce_test/Makefile
new file mode 100644
index 0000000..a3bf89b
--- /dev/null
+++ b/test_qnx/dce_test/Makefile
@@ -0,0 +1,2 @@
1LIST=dce_test
2include recurse.mk
diff --git a/test_qnx/dce_test/arm/Makefile b/test_qnx/dce_test/arm/Makefile
new file mode 100644
index 0000000..0e22650
--- /dev/null
+++ b/test_qnx/dce_test/arm/Makefile
@@ -0,0 +1,8 @@
1LIST=VARIANT
2ifndef QRECURSE
3QRECURSE=recurse.mk
4ifdef QCONFIG
5QRDIR=$(dir $(QCONFIG))
6endif
7endif
8include $(QRDIR)$(QRECURSE)
diff --git a/test_qnx/dce_test/arm/le.v7/Makefile b/test_qnx/dce_test/arm/le.v7/Makefile
new file mode 100644
index 0000000..2c76089
--- /dev/null
+++ b/test_qnx/dce_test/arm/le.v7/Makefile
@@ -0,0 +1 @@
include ../../common.mk
diff --git a/test_qnx/common.mk b/test_qnx/dce_test/common.mk
index e51efd2..954df4f 100644
--- a/test_qnx/common.mk
+++ b/test_qnx/dce_test/common.mk
@@ -1,50 +1,50 @@
1###################### QNX DCE Test App Build Config ####################### 1###################### QNX DCE Test App Build Config #######################
2 2
3#### Include qconfig.mk 3#### Include qconfig.mk
4ifndef QCONFIG 4ifndef QCONFIG
5QCONFIG=qconfig.mk 5QCONFIG=qconfig.mk
6endif 6endif
7include $(QCONFIG) 7include $(QCONFIG)
8 8
9define PINFO 9define PINFO
10PINFO DESCRIPTION=DCE Test 10PINFO DESCRIPTION=DCE Test
11endef 11endef
12 12
13NAME = dce_test 13NAME = dce_test
14INSTALLDIR = bin 14INSTALLDIR = bin
15 15
16# Different tool versions can easily be programmed by defining below variables 16# Different tool versions can easily be programmed by defining below variables
17# in your environment. 17# in your environment.
18CEVERSION ?= codec_engine_3_23_00_07 18CEVERSION ?= codec_engine_3_23_00_07
19FCVERSION ?= framework_components_3_23_03_17 19FCVERSION ?= framework_components_3_23_03_17
20XDAISVERSION ?= xdais_7_23_00_06 20XDAISVERSION ?= xdais_7_23_00_06
21XDCVERSION ?= xdctools_3_25_00_48 21XDCVERSION ?= xdctools_3_25_00_48
22IPCHEADERS ?= $(INSTALL_ROOT_nto) 22IPCHEADERS ?= $(INSTALL_ROOT_nto)
23IVAHDCODECS ?= ipumm/extrel/ti/ivahd_codecs 23IVAHDCODECS ?= ipumm/extrel/ti/ivahd_codecs
24 24
25# Generate the full package paths for tools 25# Generate the full package paths for tools
26CEPROD = $(TIVIDEOTOOLSROOT)/$(CEVERSION) 26CEPROD = $(TIVIDEOTOOLSROOT)/$(CEVERSION)
27FCPROD = $(TIVIDEOTOOLSROOT)/$(FCVERSION) 27FCPROD = $(TIVIDEOTOOLSROOT)/$(FCVERSION)
28XDAISPROD = $(TITOOLSROOT)/$(XDAISVERSION) 28XDAISPROD = $(TITOOLSROOT)/$(XDAISVERSION)
29XDCPROD = $(TITOOLSROOT)/$(XDCVERSION) 29XDCPROD = $(TITOOLSROOT)/$(XDCVERSION)
30 30
31#Add extra include path 31#Add extra include path
32EXTRA_INCVPATH += $(CEPROD)/packages 32EXTRA_INCVPATH += $(CEPROD)/packages
33EXTRA_INCVPATH += $(FCPROD)/packages 33EXTRA_INCVPATH += $(FCPROD)/packages
34EXTRA_INCVPATH += $(XDAISPROD)/packages 34EXTRA_INCVPATH += $(XDAISPROD)/packages
35EXTRA_INCVPATH += $(XDCPROD)/packages 35EXTRA_INCVPATH += $(XDCPROD)/packages
36EXTRA_INCVPATH += $(IVAHDCODECS)/packages 36EXTRA_INCVPATH += $(IVAHDCODECS)/packages
37EXTRA_INCVPATH += $(PROJECT_ROOT)/../ 37EXTRA_INCVPATH += $(PROJECT_ROOT)/../../
38EXTRA_INCVPATH += $(IPCHEADERS)/usr/include/memmgr 38EXTRA_INCVPATH += $(IPCHEADERS)/usr/include/memmgr
39EXTRA_INCVPATH += $(IPCHEADERS)/usr/include/ti/syslink 39EXTRA_INCVPATH += $(IPCHEADERS)/usr/include/ti/syslink
40EXTRA_INCVPATH += $(IPCHEADERS)/usr/include 40EXTRA_INCVPATH += $(IPCHEADERS)/usr/include
41 41
42CCOPTS+=-g -O0 -Dxdc_target_types__=qnx/targets/arm/std.h 42CCOPTS+=-g -O0 -Dxdc_target_types__=qnx/targets/arm/std.h
43 43
44EXTRA_LIBVPATH += $(PROJECT_ROOT)/../nto/arm/so.le.v7 \ 44EXTRA_LIBVPATH += $(PROJECT_ROOT)/../nto/arm/so.le.v7 \
45 $(INSTALL_ROOT_nto)/armle-v7/usr/lib 45 $(INSTALL_ROOT_nto)/armle-v7/usr/lib
46 46
47LDOPTS+= -ldce -lmemmgr -ltilerusr -lipc_client -lsharedmemallocator 47LDOPTS+= -ldce -lmemmgr -ltilerusr -lipc_client -lsharedmemallocator
48 48
49include $(MKFILES_ROOT)/qtargets.mk 49include $(MKFILES_ROOT)/qtargets.mk
50 50
diff --git a/test_qnx/dce_test.c b/test_qnx/dce_test/dce_test.c
index 9de8562..f1de064 100644
--- a/test_qnx/dce_test.c
+++ b/test_qnx/dce_test/dce_test.c
@@ -531,7 +531,7 @@ int write_output(const char *pattern, int cnt, char *y, char *uv, int stride)
531/* for timing in microsecond */ 531/* for timing in microsecond */
532uint64_t mark_microsecond(uint64_t *last) 532uint64_t mark_microsecond(uint64_t *last)
533{ 533{
534#if 0 534#if 1
535 struct timespec time; 535 struct timespec time;
536 uint64_t t1 = 0; 536 uint64_t t1 = 0;
537 537
@@ -1115,6 +1115,7 @@ int main(int argc, char * *argv)
1115 } else { 1115 } else {
1116 DEBUG("Output allocate through non-tiler"); 1116 DEBUG("Output allocate through non-tiler");
1117 tiler = 0; 1117 tiler = 0;
1118
1118 err = output_allocate_nonTiler(outBufs, num_buffers, 1119 err = output_allocate_nonTiler(outBufs, num_buffers,
1119 padded_width, padded_height, stride); 1120 padded_width, padded_height, stride);
1120 } 1121 }
diff --git a/test_qnx/dce_test.use b/test_qnx/dce_test/dce_test.use
index 9e511a1..45165a0 100644
--- a/test_qnx/dce_test.use
+++ b/test_qnx/dce_test/dce_test.use
@@ -1,38 +1,38 @@
1/* 1/*
2 * $QNXLicenseC: 2 * $QNXLicenseC:
3 */ 3 */
4 4
5 5
6%C dce test application to test libdce 6%C dce test application to test libdce
7 7
8Syntax: 8Syntax:
9%C [options] 9%C [options]
10Options: 10Options:
11 -h Print out the help information 11 -h Print out the help information
12 12
13Examples: 13Examples:
141. decoding h.264 141. decoding h.264
15 dce_test width height frames_to_write framesize inpattern outpattern codec tiler/nontiler 15 dce_test width height frames_to_write framesize inpattern outpattern codec tiler/nontiler
16 dce_test 320 240 30 framesize.txt inputfile.h264 outputfile.yuv h264 tiler 16 dce_test 320 240 30 framesize.txt inputfile.h264 outputfile.yuv h264 tiler
17 17
182. decoding mpeg4 182. decoding mpeg4
19 dce_test width height frames_to_write framesize inpattern outpattern codec tiler/nontiler 19 dce_test width height frames_to_write framesize inpattern outpattern codec tiler/nontiler
20 dce_test 640 480 30 framesize.txt inputfile.m4v outputfile.yuv mpeg4 nontiler 20 dce_test 640 480 30 framesize.txt inputfile.m4v outputfile.yuv mpeg4 nontiler
21 21
223. decoding vc1ap 223. decoding vc1ap
23 dce_test width height frames_to_write framesize inpattern outpattern codec tiler/nontiler 23 dce_test width height frames_to_write framesize inpattern outpattern codec tiler/nontiler
24 dce_test 720 480 30 framesize.txt inputfile.vc1 outputfile.yuv vc1ap tiler 24 dce_test 720 480 30 framesize.txt inputfile.vc1 outputfile.yuv vc1ap tiler
25 25
264. decoding vc1smp 264. decoding vc1smp
27 dce_test width height frames_to_write framesize inpattern outpattern codec tiler/nontiler 27 dce_test width height frames_to_write framesize inpattern outpattern codec tiler/nontiler
28 dce_test 320 240 30 framesize.txt inputfile.vc1 outputfile.yuv vc1smp nontiler 28 dce_test 320 240 30 framesize.txt inputfile.vc1 outputfile.yuv vc1smp nontiler
29 29
305. decoding mjpeg 305. decoding mjpeg
31 dce_test width height frames_to_write framesize inpattern outpattern codec tiler/nontiler 31 dce_test width height frames_to_write framesize inpattern outpattern codec tiler/nontiler
32 dce_test 1280 720 30 framesize.txt inputfile.bin outputfile.yuv mjpeg tiler 32 dce_test 1280 720 30 framesize.txt inputfile.bin outputfile.yuv mjpeg tiler
33 33
346. decoding mpeg2 346. decoding mpeg2
35 dce_test width height frames_to_write framesize inpattern outpattern codec tiler/nontiler 35 dce_test width height frames_to_write framesize inpattern outpattern codec tiler/nontiler
36 dce_test 1920 1088 30 framesize.txt inputfile.bin outputfile.yuv mpeg2 nontiler 36 dce_test 1920 1088 30 framesize.txt inputfile.bin outputfile.yuv mpeg2 nontiler
37 37
38Currently supported codecs: h264, mpeg4, vc1ap, vc1smp, mjpeg, mpeg2 38Currently supported codecs: h264, mpeg4, vc1ap, vc1smp, mjpeg, mpeg2