⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 imgdec1_copy.c

📁 TI Algorithm Soft Kit 5.10 仅包括实例及其原代码
💻 C
字号:
/*  *  Copyright 2006 *  Texas Instruments Incorporated * *  All rights reserved.  Property of Texas Instruments Incorporated *  Restricted rights to use, duplicate or disclose this code are *  granted through contract. *  *//* *  ======== imgdec1_copy.c ======== *  Image decoder "copy" algorithm. * *  This file contains an implementation of the IALG interface *  required by xDAIS. */#include <xdc/std.h>#include <string.h>#include <ti/xdais/dm/iimgdec1.h>#include "imgdec1_copy_ti.h"#include "imgdec1_copy_ti_priv.h"/* buffer definitions */#define MININBUFS       1#define MINOUTBUFS      1#define MININBUFSIZE    1#define MINOUTBUFSIZE   1extern IALG_Fxns IMGDEC1COPY_TI_IALG;#define IALGFXNS  \    &IMGDEC1COPY_TI_IALG,/* module ID */                         \    NULL,               /* activate */                          \    IMGDEC1COPY_TI_alloc,/* alloc */                             \    NULL,               /* control (NULL => no control ops) */  \    NULL,               /* deactivate */                        \    IMGDEC1COPY_TI_free, /* free */                              \    IMGDEC1COPY_TI_initObj, /* init */                              \    NULL,               /* moved */                             \    NULL                /* numAlloc (NULL => IALG_MAXMEMRECS) *//* *  ======== IMGDEC1COPY_TI_IIMGDEC ======== *  This structure defines TI's implementation of the IIMGDEC1 interface *  for the IMGDEC1COPY_TI module. */IIMGDEC1_Fxns IMGDEC1COPY_TI_IMGDECCOPY = {    /* module_vendor_interface */    {IALGFXNS},    IMGDEC1COPY_TI_process,    IMGDEC1COPY_TI_control,};/* *  ======== IMGDEC1COPY_TI_IALG ======== *  This structure defines TI's implementation of the IALG interface *  for the IMGDEC1COPY_TI module. */#ifdef _TI_asm("_IMGDEC1COPY_TI_IALG .set _IMGDEC1COPY_TI_IMGDECCOPY");#else/* *  We duplicate the structure here to allow this code to be compiled and *  run non-DSP platforms at the expense of unnecessary data space *  consumed by the definition below. */IALG_Fxns IMGDEC1COPY_TI_IALG = {      /* module_vendor_interface */    IALGFXNS};#endif/* *  ======== IMGDEC1COPY_TI_alloc ======== */Int IMGDEC1COPY_TI_alloc(const IALG_Params *algParams,    IALG_Fxns **pf, IALG_MemRec memTab[]){    /* Request memory for my object */    memTab[0].size = sizeof(IMGDEC1COPY_TI_Obj);    memTab[0].alignment = 0;    memTab[0].space = IALG_EXTERNAL;    memTab[0].attrs = IALG_PERSIST;    return (1);}/* *  ======== IMGDEC1COPY_TI_free ======== */Int IMGDEC1COPY_TI_free(IALG_Handle handle, IALG_MemRec memTab[]){    IMGDEC1COPY_TI_alloc(NULL, NULL, memTab);    return (1);}/* *  ======== IMGDEC1COPY_TI_initObj ======== */Int IMGDEC1COPY_TI_initObj(IALG_Handle handle,    const IALG_MemRec memTab[], IALG_Handle p,    const IALG_Params *algParams){    return (IALG_EOK);}/* *  ======== IMGDEC1COPY_TI_process ======== */XDAS_Int32 IMGDEC1COPY_TI_process(IIMGDEC1_Handle h, XDM_BufDesc *inBufs,    XDM_BufDesc *outBufs, IIMGDEC1_InArgs *inArgs, IIMGDEC1_OutArgs *outArgs){    /* validate arguments - this codec only supports "base" xDM. */    if ((inArgs->size != sizeof(*inArgs)) ||        (outArgs->size != sizeof(*outArgs))) {        return (IIMGDEC1_EUNSUPPORTED);    }    /*     * A couple constraints for this simple "copy" codec:     *    - Image decoding presumes a single input buffer, so only one input     *      buffer will be decoded, regardless of inBufs->numBufs.     *    - Given a different size of an input and output buffers, only     *      decode (i.e., copy) the lesser of the sizes.     */    memcpy(outBufs->bufs[0], inBufs->bufs[0], inArgs->numBytes);    /* outArgs->bytesConsumed reports the total number of bytes consumed */    outArgs->bytesConsumed = inArgs->numBytes;    /* Fill out the rest of the outArgs struct */    outArgs->extendedError = 0;    outArgs->currentAU = 0;  /* TODO */    outArgs->currentScan = 0;  /* TODO */    return (IIMGDEC1_EOK);}/* *  ======== IMGDEC1COPY_TI_control ======== */XDAS_Int32 IMGDEC1COPY_TI_control(IIMGDEC1_Handle handle, IIMGDEC1_Cmd id,    IIMGDEC1_DynamicParams *params, IIMGDEC1_Status *status){    XDAS_Int32 retVal;    /* validate arguments - this codec only supports "base" xDM. */    if ((params->size != sizeof(*params)) ||        (status->size != sizeof(*status))) {        return (IIMGDEC1_EUNSUPPORTED);    }    switch (id) {        case XDM_GETSTATUS:        case XDM_GETBUFINFO:            status->extendedError = 0;            status->outputHeight = 0;  /* TODO */            status->outputWidth = 0;  /* TODO */            status->imageWidth = 0;  /* TODO */            status->outputChromaFormat = 0;  /* TODO */            status->totalAU = 0;  /* TODO */            status->totalScan = 0;  /* TODO */            status->bufInfo.minNumInBufs = MININBUFS;            status->bufInfo.minNumOutBufs = MINOUTBUFS;            status->bufInfo.minInBufSize[0] = MININBUFSIZE;            status->bufInfo.minOutBufSize[0] = MINOUTBUFSIZE;            retVal = IIMGDEC1_EOK;            break;        case XDM_RESET:        case XDM_FLUSH:            retVal = IIMGDEC1_EOK;            break;        default:            /* unsupported cmd */            retVal = IIMGDEC1_EFAIL;            break;    }    return (retVal);}/* *  @(#) ti.xdais.dm.examples.imgdec1_copy; 1,0,0,7; 10-18-2006 19:12:03; /db/wtree/library/trees/dais-g07x/src/ */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -