www.pudn.com > JPEGMotion.rar > celljpegdec_ti.c


/* 
 *  Copyright 2002 by Texas Instruments Incorporated. 
 *  All rights reserved. Property of Texas Instruments Incorporated. 
 *  Restricted rights to use, duplicate or disclose this code are 
 *  granted through contract. 
 * 
 */ 
/* "@(#) RF5_IEK 1.20.07 09-26-02 (swat-c12)" */ 
/* 
 *  ======== celljpegdec.c ======== 
 */ 
 
#include  
#include  
 
 
#include  
 
#include  
#include  
 
#include  
#include  
#include  
 
#include "celljpegdec_ti.h" 
#include "ijpegdec.h" 
 
#include  
 
#include "appThreads.h" 
#include "appResources.h" 
 
extern far IDMA2_Fxns JPEGDEC_IDMA2;        /* the algorithm's IDMA2 v-table */ 
 
// v-table for this cell 
ICELL_Fxns JPEGDEC_CELLFXNS = 
{ 
    JPEGDEC_cellClose,      // cellClose 
    NULL,                  // cellControl 
    JPEGDEC_cellExecute,    // cellExecute 
    JPEGDEC_cellOpen        // cellOpen 
}; 
 
/* 
 *  ======== JPEGDEC_cellClose ======== 
 * 
 */ 
Bool JPEGDEC_cellClose( ICELL_Handle handle ) 
{ 
    // Withdraw DMA resources from algorithm 
    return (DMAN_removeAlg((IALG_Handle)handle->algHandle, &JPEGDEC_IDMA2)); 
} 
 
 
 
/* 
 *  ======== JPEGDEC_cellExecute ======== 
 * 
 */ 
Bool JPEGDEC_cellExecute( ICELL_Handle handle, Arg arg ) 
{ 
    int ret_val; 
    unsigned int **Input = handle->inputIcc[0]->buffer; 
 
    UTL_stsStart( stsExeTimeChJpegDec ); 
 
    // activate instance object 
    ALGRF_activate( handle->algHandle ); 
 
    // call JPEG decode through IALG layer 
 
    ret_val = ((IJPEGDEC_Fxns *)(handle->algFxns))->decode 
                        ( 
                           (IJPEGDEC_Handle)handle->algHandle, 
                           (XDAS_Int8 *)(Input[1]), 
                           (XDAS_Int8 **)handle->outputIcc[0]->buffer 
                        ); 
 
    // negative value here, implies incorrect decode. 
    UTL_assert(ret_val >= 0); 
 
    // deactivate instance object 
    ALGRF_deactivate( handle->algHandle ); 
 
    UTL_stsStop( stsExeTimeChJpegDec ); 
 
    return(1); 
} 
 
/* 
 *  ======== JPEGDEC_cellOpen ======== 
 * 
 */ 
Bool JPEGDEC_cellOpen( ICELL_Handle handle ) 
{ 
    // Grant DMA resources 
    return (DMAN_addAlg((IALG_Handle)handle->algHandle, &JPEGDEC_IDMA2)); 
} 
 
/*------------------------------------------------------------------*/ 
/* Texas Instruments Incorporated 1997-2003.                        */ 
/*==================================================================*/ 
/*                                                                  */ 
/*------------------------------------------------------------------*/