This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

how to use the jpeg decoder to decode a few jpegs files

I am new to dsp and  trying to use the jpeg decoder downloaded from here:

software-dl.ti.com/.../index.html

Look at the TestAppDecoder.c.

To decoder one jpeg file, the code is activate/deactivate twice. Is this necessary?

I plan to create/activate the decoder once, decoder around 100 jpeg files then deactivate it. is this feasible? what is the proper procedure?

  • Hi Wade,
    I'm going to ask one of our image processing experts to have a look at this.
    Thank you.
  • Hi, Rajasekaran

    Did you get an experts to help? Many Thanks.

    Wade

  • Hi Wade,

    Yes, it is feasible to activate decoder once and decode around 100 jpeg files and then deactivate it.

    In activate, decoder state buffers are copied from external memory to internal memory and in the decoder process call, these internal memory buffers were used to decode the images and then in the deactivate, these internal memory buffers are copied back to the external memory.

    Please let me know for any questions


    Thanks,
    Praveen

  • Hi, Praveen,


    Thank you.


    I was able to decode the "REMI0003.jpeg" file using the decoder (version C66x_jpegdec_03_01_02_02_ELF).


    However, I got extendedError=0x2001 when decoding the jpeg file saved from windows paint program, the file is uploaded here

    https://drive.google.com/file/d/0B6cOLC-VuhcibDBOUlhDcDRyV3M/view?usp=sharing


    What could be the reason? and how can I adjust the parameters to decode this file

    Thanks

  • Hi Wade,

    For some reason I could not able to see your post here, but I received the notification through e-mail.

    I tried decoding the jpeg image attached and I could able to decode it successfully. Note that I have changed the ImageWidth/ImageHeight values in Testparams.cfg file to 1280/720.

    I am attaching the Testparams.cfg file, Testvecs.cfg file and the decoded output YUV file for your reference.

    jpeg_dec_testvecs.zip

    Thanks,

    Praveen

  • Hi, Praveen,

    Thank you. I was able to figure out the issue. It was due to the memory overlap as I merged this decoder to visionSDK.

    Now my decoding time can match what is stated in the datasheet (JPEG_PS_Decoder_C6678_Datasheet.pdf).

    In the datasheet, for none sub-region decoding, it takes around 10 cycle/pixel. so for the above sample jpeg file, I am expecting the time needed is around

    10*1270*720/(600*1024*1024) = 14.6ms

    as I am running on internal DSP of Jacinto6 (http://www.ti.com/product/DRA746 with clock of 600MHz.

    However, in my setup it takes around 50ms to decode one image.

    The following is checked in my setup:

    1. enable the code/data memory cache in the TestApp_EnableCache().
    2. the .intDataMemin of alg_malloc.c is located to L2SRAM
    3. the .extDataMem of alg_malloc.c is located to DSP1_DATA_MEM

    what else I could check to get the fast decoding?

    Here I attached my TestAppDecoder.c

    /******************************************************************************/
    /*            Copyright (c) 2011 Texas Instruments, Incorporated.             */
    /*                           All Rights Reserved.                             */
    /******************************************************************************/
    
    /*!
    ********************************************************************************
    @file     TestAppDecoder.c
    @brief    This is the top level client file that drives the JPEG
              (Progressive Support) Image Decoder Call using XDM Interface
    @author   Multimedia Codecs TI India
    @version  0.1 - July 23,2011    initial version
    ********************************************************************************
    */
    
    /* Standard C header files */
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    
    /* JPEG Interface header files */
    #include "jpegdec_ti.h"
    #include "jpegdec.h"
    
    
    /* CSL and DMAN3 header files                                                 */
    #include <ti/sysbios/family/c66/Cache.h>
    #include <ti/sysbios/BIOS.h>
    #include <ti/ipc/Ipc.h>
    #include <ti/sysbios/knl/Task.h>
    #include <include/link_api/system.h>
    
    #define PROFILING
    
    /* Client header file */
    #include "inc/TestAppDecoder.h"
    XDAS_Int8 *inputData;
    /* Output buffer allocation */
    #pragma    DATA_SECTION(outputData, ".display_buffer")
    XDAS_Int8  outputData[OUTPUT_BUFFER_SIZE];
    
    //JPEGDEC_Handle    handle;
    JPEGDEC_Params    jpegdecParams;
    JPEGDEC_DynamicParams    jpegdecDynamicParams;
    JPEGDEC_Status    jpegdecStatus;
    JPEGDEC_InArgs	  jpegdecInArgs;
    JPEGDEC_OutArgs   jpegdecOutArgs;
    
    XDAS_UInt32 resizeOption,progressiveDecFlag,alpha_rgb;
    XDAS_UInt32 numMCU_row,x_org,y_org,x_length,y_length;
    
    XDAS_Int8  *store_outptr1,*store_outptr2,*store_outptr3;
    
    XDAS_Void  TestApp_SetSizes();
    XDAS_Int32 DecodeTask (void);
    int g_jpeg_index = 0;
    int g_jpeg_len[] = {
    	515103,
    	80317,
    	79223,
    	80696,
    	75944,
    	71621,
    	161426,
    	619957,
    	85727,
    	52365,
    	70110
    };
    
    /* Main Function acting as a client for Image Decode Call */
    XDAS_Int32 DecodeTask ()
    {
    	/* the contents of Testvecs.cfg are */
    #if 0
    	0 /* X: Value "1" does Test Compliance and Value "0" dumps the Output */
    	..\..\..\Test\TestVecs\Config\Testparams.cfg /* Test Parameters File */
    	..\..\..\Test\TestVecs\Input\REMI0003.JPG /* Input File */
    	..\..\..\Test\TestVecs\Output\REMI0003_planar.yuv /* Output File */
    #endif
    	/* Input/Output  buffers  and their sizes                                   */
    //	XDAS_UInt8*  pInputBuf  [XDM_MAX_IO_BUFFERS];
    	//XDAS_UInt8*  pOutputBuf [XDM_MAX_IO_BUFFERS];
    	XDAS_UInt8   inBufSize  [XDM_MAX_IO_BUFFERS];
    	XDAS_UInt8   outBufSize [XDM_MAX_IO_BUFFERS];
    	XDAS_UInt32  ii;
    	IIMGDEC1_Fxns *IIMGDEC1Fxns;
    	JPEGDEC_Params *params = (JPEGDEC_Params*)&jpegdecParams;
    	JPEGDEC_DynamicParams *dynamicParams = (JPEGDEC_DynamicParams*)&jpegdecDynamicParams;
    	JPEGDEC_Status *status = (JPEGDEC_Status*)&jpegdecStatus;
    	JPEGDEC_InArgs *inArgs = (JPEGDEC_InArgs*)&jpegdecInArgs;
    	JPEGDEC_OutArgs *outArgs = (JPEGDEC_OutArgs*)&jpegdecOutArgs;
    	/* Algorithm specific handle                                                */
    	static IALG_Handle handle = NULL;
    	/* Input/Output Buffer Descriptors                                          */
    	XDM1_BufDesc inputBufDesc, outputBufDesc;
    	/* Input Buffer Management specific variables                               */
    	XDAS_Int32 validBytes;
    	XDAS_UInt32 bytesConsumed;
    	XDAS_Int32 ScanCount, retVal;
    	XDAS_Int32 byteremain=0,inputsize = 0;
    	//#ifdef JPEG_ALG_ONLY_CREATE_ONCE
    	XDAS_Int32 alg_create = 0;
    	//#endif
    
    	if (handle == NULL) {
    		alg_create = 1;
    	    TestApp_EnableCache();
    	}
        
    	dynamicParams->resizeOption = 0;
    	dynamicParams->imgdecDynamicParams.displayWidth = 0;
    	dynamicParams->imgdecDynamicParams.numAU = 0;
    	dynamicParams->numMCU_row = 0;
    	dynamicParams->x_org = 0;
    	dynamicParams->y_org = 0;
    	dynamicParams->x_length = 0;
    	dynamicParams->y_length = 0;
    	dynamicParams->alpha_rgb = 0;
    
    	/* Initialization of parameters needed for Algorithm Instance create      */
    	TestApp_SetInitParams((IIMGDEC1_Params *)params);
    
    	/* Number of Algorithms: System Parameter                                 */
    	TestApp_SetSizes();
    
    	/* Initializing Variables                                                */
    	ScanCount                   = 1;
    
    	{
    		UInt8 *pu8 = (UInt8 *)(0xa4000000+g_jpeg_index*0x100000);
    		validBytes = g_jpeg_len[g_jpeg_index];
    
    		Vps_printf("%s:%d: start of decodging jpeg %d, input data@0x%p, jpegSize=%d\n",
    				__FILE__, __LINE__, g_jpeg_index, pu8, validBytes);
    
    		g_jpeg_index++;
    
    		if (g_jpeg_index > 0xa)
    			g_jpeg_index = 0;
    
    		inputData = (XDAS_Int8 *)pu8;
    	}
    
    	Cache_wbInvAll();
    
    	/* Return if there is an error in reading the file */
    	if (validBytes < 0) { /* Error condition */
    		printf("Valid Bytes incorrect... Exiting for this configuration...\n");
    		return XDM_EFAIL;
    	}
    
    	if ( alg_create == 1){
    //    if (1){
    		/* Create the Algorithm object (instance)                                */
    		Vps_printf("Creating Algorithm Instance. ..");
    		handle =  (IALG_Handle)ALG_create (
    					( IALG_Fxns *) &JPEGDEC_TI_IJPEGDEC,
    					(IALG_Handle) NULL, (IALG_Params *) params);
    		if (handle == NULL) {
    			Vps_printf( "\n!!! Failed to Create Instance... Exiting for this configuration..");
    			return XDM_EFAIL;
    		}
    		Vps_printf("Algorithm Instance Creation Done...\n");
    	} else {
    		alg_create = 0;
    		Vps_printf("use old alg\n");
    	}
    
    	TestApp_SetDynamicParams((IIMGDEC1_DynamicParams *)dynamicParams);
    
    	/* set space for buffer descriptors                                      */
    	inputBufDesc.descs[0].bufSize = (XDAS_Int32 )inBufSize ;
    	outputBufDesc.descs[0].bufSize = (XDAS_Int32)outBufSize ;
    
    	inputBufDesc.descs[0].buf     = inputData;
    	outputBufDesc.descs[0].buf     = outputData;
    
    	/* Assigning Algorithm handle fxns field to IIMGDEC1fxns                  */
    	IIMGDEC1Fxns = (IIMGDEC1_Fxns *)handle->fxns;
    
    	/* Resetting bytesGenerated variable                                     */
    	bytesConsumed = 0;
    
    	dynamicParams->imgdecDynamicParams.decodeHeader = XDM_PARSE_HEADER;
    
    //	if (alg_create == 1) {
        if (alg_create < 3){
    		/* Activate the Algorithm                                              */
    		handle->fxns->algActivate(handle);
    	} else {
    		Vps_printf("reset decoder\n");
    	}
    
    	/* Assign the number of bytes available                                */
    	inArgs->imgdecInArgs.numBytes = validBytes;
    	dynamicParams->frame_numbytes = validBytes;
    	inputBufDesc.descs[0].buf   = (XDAS_Int8 *)((XDAS_Int32) inputData +
    					bytesConsumed);
    
    	/* Get Buffer information                                              */
    	IIMGDEC1Fxns->control((IIMGDEC1_Handle)handle, XDM_GETBUFINFO,
    				(IIMGDEC1_DynamicParams *)dynamicParams,
    				(IIMGDEC1_Status *)	status);
    
    	/* Fill up the buffers as required by algorithm                        */
    	inputBufDesc.numBufs     = status->imgdecStatus.bufInfo.minNumInBufs ;
    	inputBufDesc.descs[0].bufSize = status->imgdecStatus.bufInfo.minInBufSize[0];
    
    	for (ii=0; ii<(status->imgdecStatus.bufInfo.minNumInBufs-1); ii++ ) {
    		inputBufDesc.descs[ii+1].buf = inputBufDesc.descs[ii].buf +
    						status->imgdecStatus.bufInfo.minInBufSize[ii];
    		inputBufDesc.descs[ii+1].bufSize=
    			status->imgdecStatus.bufInfo.minInBufSize[ii +1];
    	}
    
    	outputBufDesc.numBufs     = status->imgdecStatus.bufInfo.minNumOutBufs ;
    	outputBufDesc.descs[0].bufSize = status->imgdecStatus.bufInfo.minOutBufSize[0];
    	for (ii=0; ii<(status->imgdecStatus.bufInfo.minNumOutBufs-1); ii++ ) {
    		outputBufDesc.descs[ii+1].buf = outputBufDesc.descs[ii].buf +
    						status->imgdecStatus.bufInfo.minOutBufSize[ii];
    		outputBufDesc.descs[ii+1].bufSize =
    			status->imgdecStatus.bufInfo.minOutBufSize[ii+1];
    	}
    #if 0
    	/* Cache Invalidate for Input Buffer                                   */
    	for (ii=0 ; ii < inputBufDesc.numBufs ; ii++ ) {
    		/* Cache Invalidate for Input Buffer                                 */
    		Cache_inv(inputBufDesc.descs[ii].buf, validBytes,Cache_Type_ALL, TRUE);
    	}
    #endif
    	IIMGDEC1Fxns->control((IIMGDEC1_Handle)handle, XDM_SETPARAMS,
    				(IIMGDEC1_DynamicParams *)dynamicParams,
    				(IIMGDEC1_Status *)status);
    
    	/* Basic Algorithm process() call                                      */
    	retVal = IIMGDEC1Fxns->process((IIMGDEC1_Handle)handle,
    					(XDM1_BufDesc *)&inputBufDesc,
    					(XDM1_BufDesc *)&outputBufDesc,
    					(IIMGDEC1_InArgs *)inArgs,
    					(IIMGDEC1_OutArgs *)outArgs);
    
    	IIMGDEC1Fxns->control((IIMGDEC1_Handle)handle, XDM_GETSTATUS,
    				(IIMGDEC1_DynamicParams *)dynamicParams,
    				(IIMGDEC1_Status *)status);
    	Vps_printf("%s:%d image %dx%d, output %dx%d\n", __FILE__, __LINE__,
    			status->imgdecStatus.imageWidth,  status->imageHeight,
    			status->imgdecStatus.outputWidth, status->imgdecStatus.outputHeight);
    
    	dynamicParams->imgdecDynamicParams.decodeHeader = XDM_DECODE_AU;
    	IIMGDEC1Fxns->control((IIMGDEC1_Handle)handle, XDM_RESET,
    				(IIMGDEC1_DynamicParams *)dynamicParams,
    				(IIMGDEC1_Status *)status);
    
    	bytesConsumed = 0;
    
    	Vps_printf("%s:%d image %dx%d, output %dx%d\n", __FILE__, __LINE__,
    			status->imgdecStatus.imageWidth,  status->imageHeight,
    			status->imgdecStatus.outputWidth, status->imgdecStatus.outputHeight);
    
    
    	/* Optional: Set Run time parameters in the Algorithm via control()    */
    	IIMGDEC1Fxns->control((IIMGDEC1_Handle)handle, XDM_SETPARAMS,
    				(IIMGDEC1_DynamicParams *)dynamicParams,
    				(IIMGDEC1_Status *)status);
    	Vps_printf("%s:%d image %dx%d, output %dx%d\n", __FILE__, __LINE__,
    			status->imgdecStatus.imageWidth,  status->imageHeight,
    			status->imgdecStatus.outputWidth, status->imgdecStatus.outputHeight);
    
    
    	/* Do-While Loop for Decode Call                                         */
    	do {
    		byteremain = inArgs->imgdecInArgs.numBytes; // newly added
    		inputsize = byteremain;
    
    		if ( dynamicParams->numMCU_row !=0) { // newly added for sliced
    			if (byteremain <=(inputsize* dynamicParams->numMCU_row ))
    				inArgs->imgdecInArgs.numBytes = byteremain;
    			else
    				inArgs->imgdecInArgs.numBytes  = inputsize* dynamicParams->numMCU_row ;
    			if (inArgs->imgdecInArgs.numBytes > dynamicParams->frame_numbytes)
    				inArgs->imgdecInArgs.numBytes = dynamicParams->frame_numbytes;
    		}
    
    		/* Basic Algorithm process() call                                      */
    		retVal = IIMGDEC1Fxns->process((IIMGDEC1_Handle)handle,
    						(XDM1_BufDesc *)&inputBufDesc,
    						(XDM1_BufDesc *)&outputBufDesc,
    						(IIMGDEC1_InArgs *)inArgs,
    						(IIMGDEC1_OutArgs *)outArgs);
    
    		Vps_printf("%s:%d image %dx%d, output %dx%d\n", __FILE__, __LINE__,
    				status->imgdecStatus.imageWidth,  status->imageHeight,
    				status->imgdecStatus.outputWidth, status->imgdecStatus.outputHeight);
    		/* Cache Writeback Invalidate for Output Buffers                       */
    		if (outputBufDesc.descs[0].buf != NULL) {
    			for (ii=0 ; ii < outputBufDesc.numBufs ; ii++ ) {
    				Cache_wbInv(outputBufDesc.descs[ii].buf,
    						outputBufDesc.descs[ii].bufSize, Cache_Type_ALL, TRUE);
    			}
    		}
    
    		byteremain -= outArgs->imgdecOutArgs.bytesConsumed;
    
    		if (dynamicParams->numMCU_row ) {
    			inputBufDesc.descs[0].buf += outArgs->imgdecOutArgs.bytesConsumed;
    			inArgs->imgdecInArgs.numBytes -= outArgs->imgdecOutArgs.bytesConsumed;
    		}
    
    		bytesConsumed          += outArgs->imgdecOutArgs.bytesConsumed;
    
    		if (retVal == XDM_EFAIL) {
    			Vps_printf("!!!Process function returned an Error...  ");
    			break; /* Error Condition: Application may want to break off         */
    		}
    
    		/* Optional: Read status via control()                                 */
    		IIMGDEC1Fxns->control((IIMGDEC1_Handle)handle,
    					XDM_GETSTATUS,
    					(IIMGDEC1_DynamicParams *)dynamicParams,
    					(IIMGDEC1_Status *)status);
    
    		if (status->mode == 0) { // sequential baseline
    			outputBufDesc.descs[0].buf += status->bytesgenerated[0];
    			outputBufDesc.descs[1].buf += status->bytesgenerated[1];
    			outputBufDesc.descs[2].buf += status->bytesgenerated[2];
    		} else if ((status->mode == 1)) { // Non interlaeved sequential
    			if (params->imgdecParams.forceChromaFormat!=8) {
    				outputBufDesc.descs[0].buf += status->bytesgenerated[0];
    				outputBufDesc.descs[1].buf += status->bytesgenerated[1];
    				outputBufDesc.descs[2].buf += status->bytesgenerated[2];
    			}
    		} else if (status->mode != 2) {
    			outputBufDesc.descs[0].buf += status->bytesgenerated[0];
    			outputBufDesc.descs[1].buf += status->bytesgenerated[1];
    			outputBufDesc.descs[2].buf += status->bytesgenerated[2];
    		}
    
    		if (( outArgs->imgdecOutArgs.extendedError != JPEGDEC_SUCCESS)) {
    			Vps_printf("Decoder ERROR %0x \n ",outArgs->imgdecOutArgs.extendedError);
    			break;
    		}
    
    		/* Check for frame ready via display buffer pointers                   */
    		if (outputBufDesc.descs[0].buf != NULL) {
    			Vps_printf("Decoded Frame # %d  ",ScanCount);
    
    			ScanCount++;
    		}
    
    		if (status->end_of_seq  == 1) {
    			break;
    		}
    
    	}  while (1); /* end of Do-While loop                                    */
    
    	/* DeActivate the Algorithm                                            */
    	handle->fxns->algDeactivate(handle);
    
    	IIMGDEC1Fxns->control((IIMGDEC1_Handle)handle,
    				XDM_GETSTATUS,
    				(IIMGDEC1_DynamicParams *)dynamicParams,
    				(IIMGDEC1_Status *)status);
    
    	for (ii=0; ii<(status->imgdecStatus.bufInfo.minNumOutBufs); ii++ ) {
    		outputBufDesc.descs[ii].bufSize = status->imgdecStatus.bufInfo.minOutBufSize[ii];
    	}
    
    #ifdef JPEG_ALG_ONLY_CREATE_ONCE
    	/* Delete the Algorithm instance object specified by handle */
    	ALG_delete (handle);
    #endif
    	if (ScanCount == 0) {
    		ScanCount = 1; /* To avoid division with zero */
    	}
    
    	Vps_printf(" --------------  SUMMARY --------------------\n");
    	Vps_printf("\t retVal=%d, extendedError           = 0x%x\n", retVal, (XDAS_UInt32)status->imgdecStatus.extendedError);
    	Vps_printf("\t Total number of Scans              = %d\n", (XDAS_UInt32)ScanCount);
    	Vps_printf("\t Output Width and Height            = %d, %d \n",
    			(XDAS_UInt32)status->imgdecStatus.outputWidth, (XDAS_UInt32)status->imgdecStatus.outputHeight);
    	Vps_printf (" --------------    END   --------------------\n");
    
    	return XDM_EOK;
    }
    
    XDAS_Void TestApp_SetInitParams(IIMGDEC1_Params *params1)
    {
    	IJPEGDEC_Params *params = (IJPEGDEC_Params*) params1;
    
    	params->imgdecParams.maxHeight = 2048;
    	params->imgdecParams.maxWidth = 1536;
    	params->imgdecParams.maxScans = 15;
    	params->imgdecParams.forceChromaFormat = 0;
    	params->progressiveDecFlag = 0;
    
    	params->imgdecParams.dataEndianness      = XDM_BYTE;
    	params->outImgRes = 1;
    	return;
    }
    
    XDAS_Void TestApp_SetDynamicParams(IIMGDEC1_DynamicParams *dynamicParams1)
    {
    	/* Set IIMGDEC Run time parameters */
    	IJPEGDEC_DynamicParams *dynamicParams = (IJPEGDEC_DynamicParams*)dynamicParams1;
    
    	/*Do header analysis first to get the decoded image size*/
    	dynamicParams->imgdecDynamicParams.decodeHeader = XDM_DECODE_AU;
    	dynamicParams->progDisplay = 0;
    	dynamicParams->RGB_Format = 0;
    	return;
    }
    
    XDAS_Void TestApp_SetSizes()
    {
    	jpegdecParams.imgdecParams.size     = sizeof(JPEGDEC_Params);
    	jpegdecStatus.imgdecStatus.size     = sizeof(JPEGDEC_Status);
    	jpegdecDynamicParams.imgdecDynamicParams.size = sizeof(JPEGDEC_DynamicParams);
    	jpegdecInArgs.imgdecInArgs.size     = sizeof(JPEGDEC_InArgs);
    	jpegdecOutArgs.imgdecOutArgs.size   = sizeof(JPEGDEC_OutArgs);
    }
    
    #define EXT_MEM_BASE (0x80000000)
    #define EXT_MEM_SIZE (0x20000000)
    #define EXT_MEM_NON_CACHE_BASE (0xa0000000)
    #define EXT_MEM_NON_CACHE_SIZE (0x20000000)
    
    /* Cache Settings */
    XDAS_Void TestApp_EnableCache(void)
    {
    	Cache_Size size;
    	UInt32 mar, disablePrefetch, disableCache;
    
    	size.l1pSize  = Cache_L1Size_32K; /* L1P cache size */
    	size.l1dSize  = Cache_L1Size_32K; /* L1D cache size */
    	size.l2Size   = Cache_L2Size_64K; /* L2 cache size */
    
    	/* Set L1P, L1D and L2 cache sizes */
    	Cache_setSize(&size);
    
    	/* Cache Enable External Memory Space */
    	/* BaseAddr, length, MAR enable/disable */
    	/* Cache 0x80000000 --- 0x8FFFFFFF   */
    	mar = Cache_getMar((Ptr *)EXT_MEM_BASE) | ti_sysbios_family_c66_Cache_PC | ti_sysbios_family_c66_Cache_PFX;
    	Cache_setMar((Ptr *)EXT_MEM_BASE, EXT_MEM_SIZE, Cache_Mar_ENABLE | mar);
    
    	disablePrefetch = (~ti_sysbios_family_c66_Cache_PFX) & (0xFFFFFFFF);
    	disableCache = (~ti_sysbios_family_c66_Cache_PC) & (0xFFFFFFFF);
    	mar = Cache_getMar((Ptr *)EXT_MEM_NON_CACHE_BASE) & disableCache & disablePrefetch;
    	Cache_setMar((Ptr *)EXT_MEM_NON_CACHE_BASE, EXT_MEM_NON_CACHE_SIZE, Cache_Mar_DISABLE | mar);
    	Cache_wbInvAll();
    } /* TestApp_EnableCache */
    
    

  • Hi Wade,

    Also, place the inputData and outputData buffers in the cache and check the performance.

    The datasheet numbers 10 cycles/pixel reported are on C6678 device with a clock of 1250MHz and 32KB L1p & L1D and with 64KB L2 Cache sizes.

    Thanks,
    Praveen
  • Hi, Praveen,

    Can you please attache your map file on C6678 device for me to check?

    Yes. the input/output Data is already in cached memory.

    How can I check the  "32KB L1p & L1D and with 64KB L2 Cache" is turnned on in my setup?

    Regards,

    Wade,

  • Hi Wade,

    I am attaching the map file your reference.JPEG_D_mapfile.zip

    In the TestAppDecoder.c file, you can see in TestApp_EnableCache() function Setting Cache sizes for C6678.

    I am not familiar with the platform your are working in, so post this in the corresponding forum to know more details.

    Thanks,

    Praveen

  • Hi, Praveen,


    Referring your map file and moved my code area to internal memory, it does NOT help.

    In the "JPEG_PS_Decoder_C6678_Datasheet.pdf", it stated 10.12 cycle/pixel for REMI0003.jpg, 2048 x 1536 , Baseline Sequential Interleave

    What function are included in the 10.12 cycle? is it from the activate till the deactivate in the TestAppDecoder.c?

    In my setup from it tooks 310ms in 600MHz single DSP core, it translate to 59.12 cycle/pixel. what could be wrong?

    BTW. in this TestAppDecoder.c, even if I set the resizeOption=0 (no resize). the output image is 1024*768.

     

  • Hi Wade,

    This 10.12 cycles reported is across the decode process call only, it doesn't included the activate and deactivate functions.

    Is it possible for you to share your setup to replicate the issue at our end?

    Thanks,

    Praveen

  • vision_sdk_c66xdsp_1_debug.xe66.rar

    Hi, Praveen,

    I am using the attached TestAppDecoder.c. Since I linked the decoder lib to a large project so it's not possible to give out the whole source tree.

    The exe file are attached as well, but I don't think it's able to run. it startup and wait for IPC from other cores.

    Basically what I did is copying a few jpg file to memory, where the REMI0003.JPG is at address 0xa4000000. then repeatly call the decodeTask(...) to do the decoder job.

    at the first time, decoder instance is created. then decoder the REMI0003.JPG.

    The 2nd IIMGDEC1Fxns->process(...) call is most time consumed. it tooks around 300ms in my 600MHz C66x DSP.

    I've checked the L1D, L1P is ON, L2 cache is 128KB.

  • Hi Wade,

    The input is at address 0xa4000000, Is this memory cached? Looks like its not because I see in TestAppDecoder.c file, Cache is enabled from (0x80000000) to (0xa0000000).

    Can you please move this input data also to Cache region and profile ?

    Thanks,

    Praveen

     

  • Hi, Praveen,


    Thank you. once the input move to cache memory sapce, the decoding time is aligned with what stated in the datasheet.


    Do you have any ideal on why I can't set the

    ChromaFormat=2, XDM_YUV_422P.

    All other parameter is same as "Testparams.cfg", Once I set this, the create decoder instance failed.

  • Hi Wade,

    Thanks for the update.

    >> Regarding setting ChromaFormat=2, XDM_YUV_422P,

    TI jpeg decoder supports ChromaFormat as 0, 4 and 8 only.

    Please refer to section 2.5.2 in the JPEG_PS_Decoder_C6678_UserGuide.pdf in the Docs folder of the package.

    Regards,

    Praveen