Exemplo n.º 1
0
/*
 *  ======== AUDENC1COPY_TI_process ========
 */
XDAS_Int32 AUDENC1COPY_TI_process(IAUDENC1_Handle handle, XDM1_BufDesc *inBufs,
    XDM1_BufDesc *outBufs, IAUDENC1_InArgs *inArgs, IAUDENC1_OutArgs *outArgs)
{
    XDAS_Int32 numInBytes;
    AUDENC1COPY_TI_Obj *obj = (AUDENC1COPY_TI_Obj *)handle;

    /* validate arguments - this codec only supports "base" xDM. */
    if ((inArgs->size != sizeof(*inArgs)) ||
            (outArgs->size != sizeof(*outArgs))) {
        XDM_SETUNSUPPORTEDPARAM(outArgs->extendedError);

        return (IAUDENC1_EUNSUPPORTED);
    }

    /* validate that there's at least a single inBuf and outBuf */
    if ((inBufs->numBufs < 1) || (outBufs->numBufs < 1)) {
        XDM_SETUNSUPPORTEDPARAM(outArgs->extendedError);

        return (IAUDENC1_EFAIL);
    }

    /* convert samples to bytes */
    numInBytes = inArgs->numInSamples * (obj->inputBitsPerSample / BITSPERBYTE);

    /*
     * Sanity check that inBufs->descs[0].bufSize is really capable of holding
     * numInBytes bytes of data, and that outBufs->descs[0].bufSize
     * can hold the 'encoded' data.
     */
    if ((numInBytes > inBufs->descs[0].bufSize) ||
        (numInBytes > outBufs->descs[0].bufSize)) {

        /* inBuf is smaller than provided data(!) or "too small" outBuf */
        XDM_SETUNSUPPORTEDPARAM(outArgs->extendedError);

        return (IAUDENC1_EFAIL);
    }

    /* everything looks good, do the 'encode', set outArgs and return */
    memcpy(outBufs->descs[0].buf, inBufs->descs[0].buf, numInBytes);

    /* report _how_ we accessed the 2 data buffers */
    XDM_CLEARACCESSMODE_WRITE(inBufs->descs[0].accessMask);
    XDM_SETACCESSMODE_READ(inBufs->descs[0].accessMask);

    XDM_CLEARACCESSMODE_READ(outBufs->descs[0].accessMask);
    XDM_SETACCESSMODE_WRITE(outBufs->descs[0].accessMask);

    /* outArgs->bytesGenerated reports the total number of bytes encoded */
    outArgs->bytesGenerated = numInBytes;

    /* Fill out the rest of the outArgs struct */
    outArgs->extendedError = 0;
    outArgs->numInSamples = inArgs->numInSamples;
    outArgs->numZeroesPadded = 0;      /* TODO */

    return (IAUDENC1_EOK);
}
/*
 *  ======== VIDANALYTICSCOPY_TI_process ========
 */
XDAS_Int32 VIDANALYTICSCOPY_TI_process(IVIDANALYTICS_Handle handle,
    XDM1_BufDesc *inBufs, XDM1_BufDesc *outBufs, IVIDANALYTICS_InArgs *inArgs,
    IVIDANALYTICS_OutArgs *outArgs)
{
    VIDANALYTICSCOPY_TI_Obj *obj = (VIDANALYTICSCOPY_TI_Obj *)handle;

    /* begin this process call with 'good' view */
    obj->viewState = IVIDANALYTICS_VIEWSTATE_GOOD;

    /* validate arguments - this codec only supports "base" XDM. */
    if ((inArgs->size != sizeof(*inArgs)) ||
            (outArgs->size != sizeof(*outArgs))) {
        outArgs->extendedError = obj->extendedError = XDM_UNSUPPORTEDPARAM;

        return (IVIDANALYTICS_EUNSUPPORTED);
    }

    /* validate that there's at least a single inBuf and outBuf */
    if ((inBufs->numBufs < 1) || (outBufs->numBufs < 1)) {
        outArgs->extendedError = obj->extendedError = XDM_UNSUPPORTEDPARAM;

        return (IVIDANALYTICS_EFAIL);
    }

    /*
     * Sanity check that outBufs->descs[0].bufSize can hold the
     * 'analyzed' data.
     */
    if (outBufs->descs[0].bufSize < inBufs->descs[0].bufSize){

        /* "too small" outBuf */
        outArgs->extendedError = obj->extendedError = XDM_UNSUPPORTEDPARAM;

        return (IVIDANALYTICS_EFAIL);
    }

    /* everything looks good, do the 'analysis', set outArgs and return */
    memcpy(outBufs->descs[0].buf, inBufs->descs[0].buf,
        inBufs->descs[0].bufSize);

    /* report _how_ we accessed the input buffer */
    XDM_CLEARACCESSMODE_WRITE(inBufs->descs[0].accessMask);
    XDM_SETACCESSMODE_READ(inBufs->descs[0].accessMask);

    /* indicate how we accessed outBufs it */
    XDM_CLEARACCESSMODE_READ(outBufs->descs[0].accessMask);
    XDM_SETACCESSMODE_WRITE(outBufs->descs[0].accessMask);

    /* didn't detect anything. */
    outArgs->numTargets = 0;
    outArgs->numEvents = 0;

    /* note that this example doesn't set outArgs->date. */

    outArgs->extendedError = 0;

    return (IVIDANALYTICS_EOK);
}
Exemplo n.º 3
0
/* ARGSUSED - this line tells the TI compiler not to warn about unused args. */
XDAS_Int32 IMGDEC1COPY_TI_process(IIMGDEC1_Handle h, XDM1_BufDesc *inBufs,
    XDM1_BufDesc *outBufs, IIMGDEC1_InArgs *inArgs, IIMGDEC1_OutArgs *outArgs)
{
    XDAS_Int32 numInBytes;

    /* validate arguments - this codec only supports "base" XDM. */
    if ((inArgs->size != sizeof(*inArgs)) ||
            (outArgs->size != sizeof(*outArgs))) {
        XDM_SETUNSUPPORTEDPARAM(outArgs->extendedError);

        return (IIMGDEC1_EUNSUPPORTED);
    }

    /* validate that there's at least a single inBuf and outBuf */
    if ((inBufs->numBufs < 1) || (outBufs->numBufs < 1)) {
        XDM_SETUNSUPPORTEDPARAM(outArgs->extendedError);

        return (IIMGDEC1_EFAIL);
    }

    numInBytes = inArgs->numBytes;

    /*
     * Sanity check that inBufs->descs[0].bufSize is really capable of holding
     * numInBytes bytes of data, and that outBufs->descs[0].bufSize
     * can hold the 'encoded' data.
     */
    if ((numInBytes > inBufs->descs[0].bufSize) ||
            (numInBytes > outBufs->descs[0].bufSize)) {

        /* inBuf is smaller than provided data(!) or "too small" outBuf */
        XDM_SETUNSUPPORTEDPARAM(outArgs->extendedError);

        return (IIMGDEC1_EFAIL);
    }

    /* everything looks good, do the decode, set outArgs and return */
    memcpy(outBufs->descs[0].buf, inBufs->descs[0].buf, numInBytes);

    /* report how we accessed the data buffers */
    XDM_CLEARACCESSMODE_WRITE(inBufs->descs[0].accessMask);
    XDM_SETACCESSMODE_READ(inBufs->descs[0].accessMask);

    XDM_CLEARACCESSMODE_READ(outBufs->descs[0].accessMask);
    XDM_SETACCESSMODE_WRITE(outBufs->descs[0].accessMask);

    /* outArgs->bytesConsumed reports the total number of bytes decoded */
    outArgs->bytesConsumed = numInBytes;

    /* Fill out the rest of the outArgs struct */
    outArgs->extendedError = 0;
    outArgs->currentAU = 0;  /* TODO */
    outArgs->currentScan = 0;  /* TODO */

    return (IIMGDEC1_EOK);
}
Exemplo n.º 4
0
/* ARGSUSED - this line tells the TI compiler not to warn about unused args. */
XDAS_Int32 IMGENC1COPY_TI_process(IIMGENC1_Handle h, XDM1_BufDesc *inBufs,
    XDM1_BufDesc *outBufs, IIMGENC1_InArgs *inArgs, IIMGENC1_OutArgs *outArgs)
{
    XDAS_Int32 numInBytes;

    /* validate arguments - this codec only supports "base" XDM. */
    if ((inArgs->size != sizeof(*inArgs)) ||
            (outArgs->size != sizeof(*outArgs))) {
        XDM_SETUNSUPPORTEDPARAM(outArgs->extendedError);

        return (IIMGENC1_EUNSUPPORTED);
    }

    /* validate that there's at least a single inBuf and outBuf */
    if ((inBufs->numBufs < 1) || (outBufs->numBufs < 1)) {
        XDM_SETUNSUPPORTEDPARAM(outArgs->extendedError);

        return (IIMGENC1_EFAIL);
    }

    numInBytes = inBufs->descs[0].bufSize < outBufs->descs[0].bufSize ?
        inBufs->descs[0].bufSize : outBufs->descs[0].bufSize;

    /* everything looks good, do the 'encode', set outArgs and return */
    memcpy(outBufs->descs[0].buf, inBufs->descs[0].buf, numInBytes);

    /* report _how_ we accessed the 2 data buffers */
    XDM_CLEARACCESSMODE_WRITE(inBufs->descs[0].accessMask);
    XDM_SETACCESSMODE_READ(inBufs->descs[0].accessMask);

    XDM_CLEARACCESSMODE_READ(outBufs->descs[0].accessMask);
    XDM_SETACCESSMODE_WRITE(outBufs->descs[0].accessMask);

    /* outArgs->bytesGenerated reports the total number of bytes encoded */
    outArgs->bytesGenerated = numInBytes;

    /* Fill out the rest of the outArgs struct */
    outArgs->extendedError = 0;
    outArgs->currentAU = 0;  /* TODO */

    return (IIMGENC1_EOK);
}
Exemplo n.º 5
0
/*
 *  ======== SPHDEC1COPY_TI_process ========
 */
XDAS_Int32 SPHDEC1COPY_TI_process(ISPHDEC1_Handle h,
    XDM1_SingleBufDesc *inBuf, XDM1_SingleBufDesc *outBuf,
    ISPHDEC1_InArgs *inArgs, ISPHDEC1_OutArgs *outArgs)
{
    XDAS_Int32 numInBytes;

    /* validate arguments - this codec only supports "base" xDM. */
    if ((inArgs->size != sizeof(*inArgs)) ||
        (outArgs->size != sizeof(*outArgs))) {

        outArgs->extendedError = XDM_UNSUPPORTEDPARAM;

        return (ISPHDEC1_EUNSUPPORTED);
    }

    /*
     * The number of bytes we can consume is the lesser of the specified
     * number of bytes to decode (inBuf->bufSize) and the size of the
     * buffer that will contain the output (outBuf->bufSize).
     */
    numInBytes = (inBuf->bufSize <= outBuf->bufSize) ?
        inBuf->bufSize : outBuf->bufSize;

    /* process the data: read input, produce output */
    memcpy(outBuf->buf, inBuf->buf, numInBytes);

    /* report _how_ we accessed the 2 data buffers */
    XDM_CLEARACCESSMODE_WRITE(inBuf->accessMask);
    XDM_SETACCESSMODE_READ(inBuf->accessMask);

    XDM_CLEARACCESSMODE_READ(outBuf->accessMask);
    XDM_SETACCESSMODE_WRITE(outBuf->accessMask);

    /* Fill out the rest of the outArgs struct */
    outArgs->dataSize = 0;  /* TBD */
    outArgs->extendedError = 0;

    return (ISPHDEC1_EOK);
}
Exemplo n.º 6
0
/*
 *  ======== AUDENC1COPY_TI_control ========
 */
XDAS_Int32 AUDENC1COPY_TI_control(IAUDENC1_Handle handle, IAUDENC1_Cmd id,
    IAUDENC1_DynamicParams *dynParams, IAUDENC1_Status *status)
{
    XDAS_Int32 retVal;
    AUDENC1COPY_TI_Obj *obj = (AUDENC1COPY_TI_Obj *)handle;

    /* validate arguments - this codec only supports "base" XDM. */
    if ((dynParams->size != sizeof(*dynParams)) ||
            (status->size != sizeof(*status))) {
        return (IAUDENC1_EUNSUPPORTED);
    }

    /* initialize for the general case where we don't access the data buffer */
    XDM_CLEARACCESSMODE_READ(status->data.accessMask);
    XDM_CLEARACCESSMODE_WRITE(status->data.accessMask);

    switch (id) {
        case XDM_GETSTATUS:
        case XDM_GETBUFINFO:
            status->extendedError = 0;
            status->validFlag = XDAS_TRUE;
            status->lfeFlag = obj->lfeFlag;
            status->bitRate = obj->bitRate;
            status->sampleRate = obj->sampleRate;
            status->channelMode = obj->channelMode;
            status->encMode = obj->encMode;

            status->bufInfo.minNumInBufs = MININBUFS;
            status->bufInfo.minNumOutBufs = MINOUTBUFS;
            status->bufInfo.minInBufSize[0] = MININBUFSIZE;
            status->bufInfo.minOutBufSize[0] = MINOUTBUFSIZE;

            retVal = IAUDENC1_EOK;
            break;

        case XDM_SETPARAMS:
            obj->lfeFlag = dynParams->lfeFlag;
            obj->bitRate = dynParams->bitRate;
            obj->sampleRate = dynParams->sampleRate;
            obj->channelMode = dynParams->channelMode;
            obj->dualMonoMode = dynParams->dualMonoMode;

            retVal = IAUDENC1_EOK;
            break;

        case XDM_SETDEFAULT:
            obj->bitRate = AUDENC1COPY_TI_PARAMS.bitRate;
            obj->lfeFlag = AUDENC1COPY_TI_PARAMS.lfeFlag;
            obj->sampleRate = AUDENC1COPY_TI_PARAMS.sampleRate;
            obj->channelMode = AUDENC1COPY_TI_PARAMS.channelMode;
            obj->dualMonoMode = AUDENC1COPY_TI_PARAMS.dualMonoMode;
            obj->encMode = AUDENC1COPY_TI_PARAMS.encMode;
            obj->inputBitsPerSample = AUDENC1COPY_TI_PARAMS.inputBitsPerSample;

            retVal = IAUDENC1_EOK;
            break;

        case XDM_RESET:
        case XDM_FLUSH:
            retVal = IAUDENC1_EOK;
            break;

        case XDM_GETVERSION:
            if ((status->data.buf != NULL) &&
                (status->data.bufSize >= strlen(VERSIONSTRING))) {
                strncpy((char *)status->data.buf, VERSIONSTRING,
                    strlen(VERSIONSTRING));

                /* null terminate the string */
                status->data.buf[strlen(VERSIONSTRING)] = '\0';

                /* strncpy wrote to the data buffer */
                XDM_SETACCESSMODE_WRITE(status->data.accessMask);

                retVal = IAUDENC1_EOK;
            }
            else {
                retVal = IAUDENC1_EFAIL;
            }

            break;

        default:
            /* unsupported cmd */
            retVal = IAUDENC1_EUNSUPPORTED;

            break;
    }

    return (retVal);
}
/*
 *  ======== TRIK_VIDTRANSCODE_RESAMPLE_control ========
 */
XDAS_Int32 TRIK_VIDTRANSCODE_RESAMPLE_control(
    IVIDTRANSCODE_Handle		algHandle,
    IVIDTRANSCODE_Cmd			vidCmd,
    IVIDTRANSCODE_DynamicParams*	vidDynParams,
    IVIDTRANSCODE_Status*		vidStatus)
{
    TrikVideoResampleHandle* handle = (TrikVideoResampleHandle*)algHandle;
    XDAS_Int32 retVal = IVIDTRANSCODE_EFAIL;

    /* initialize for the general case where we don't access the data buffer */
    XDM_CLEARACCESSMODE_READ(vidStatus->data.accessMask);
    XDM_CLEARACCESSMODE_WRITE(vidStatus->data.accessMask);

    switch (vidCmd)
    {
        case XDM_GETSTATUS:
        case XDM_GETBUFINFO:
            vidStatus->extendedError = 0;

            vidStatus->bufInfo.minNumInBufs = 1;
            vidStatus->bufInfo.minNumOutBufs = 1;
            vidStatus->bufInfo.minInBufSize[0] = 0;
            vidStatus->bufInfo.minOutBufSize[0] = 0;

            XDM_SETACCESSMODE_WRITE(vidStatus->data.accessMask);
            retVal = IVIDTRANSCODE_EOK;
            break;

        case XDM_SETPARAMS:
            if (vidDynParams->size == sizeof(IVIDTRANSCODE_DynamicParams))
            {
                handle->m_dynamicParams.base = *((IVIDTRANSCODE_DynamicParams*)vidDynParams);
                handleBuildDynamicParams(handle);
                retVal = handleVerifyParams(handle) ? IVIDTRANSCODE_EOK : IVIDTRANSCODE_EFAIL;
            }
            else if (vidDynParams->size == sizeof(TRIK_VIDTRANSCODE_RESAMPLE_DynamicParams))
            {
                handle->m_dynamicParams = *((TRIK_VIDTRANSCODE_RESAMPLE_DynamicParams*)vidDynParams);
                retVal = handleVerifyParams(handle) ? IVIDTRANSCODE_EOK : IVIDTRANSCODE_EFAIL;
            }
            else
                retVal = IVIDTRANSCODE_EUNSUPPORTED;
            break;

        case XDM_RESET:
        case XDM_SETDEFAULT:
            handle->m_params = *getDefaultParams();
            handle->m_dynamicParams = *getDefaultDynamicParams();
            handleBuildDynamicParams(handle);
            retVal = handleVerifyParams(handle) ? IVIDTRANSCODE_EOK : IVIDTRANSCODE_EFAIL;
            break;

        case XDM_FLUSH:
            retVal = IVIDTRANSCODE_EOK;
            break;

        case XDM_GETVERSION:
            if (reportVersion(vidStatus->data.buf, vidStatus->data.bufSize))
            {
                XDM_SETACCESSMODE_WRITE(vidStatus->data.accessMask);
                retVal = IVIDTRANSCODE_EOK;
            }
            else
                retVal = IVIDTRANSCODE_EFAIL;
            break;

        default:
            /* unsupported cmd */
            retVal = IVIDTRANSCODE_EFAIL;
            break;
    }

    return retVal;
}
Exemplo n.º 8
0
/*
 *  ======== VIDDEC1COPY_TI_control ========
 */
XDAS_Int32 VIDDEC1COPY_TI_control(IVIDDEC1_Handle handle, IVIDDEC1_Cmd id,
    IVIDDEC1_DynamicParams *dynParams, IVIDDEC1_Status *status)
{
    XDAS_Int32 retVal;
    VIDDEC1COPY_TI_Obj *obj = (VIDDEC1COPY_TI_Obj *)handle;

    /* validate arguments - this codec only supports "base" XDM. */
    if ((dynParams->size != sizeof(*dynParams)) ||
            (status->size != sizeof(*status))) {
        return (IVIDDEC1_EUNSUPPORTED);
    }

    /* initialize for the general case where we don't access the data buffer */
    XDM_CLEARACCESSMODE_READ(status->data.accessMask);
    XDM_CLEARACCESSMODE_WRITE(status->data.accessMask);

    switch (id) {
        case XDM_GETSTATUS:
        case XDM_GETBUFINFO:
            status->extendedError = 0;
            status->outputHeight = 0;  /* TODO */
            status->outputWidth = 0;  /* TODO */
            status->frameRate = 0;  /* TODO */
            status->bitRate = 0;  /* TODO */
            status->contentType = 0;  /* TODO */
            status->outputChromaFormat = obj->outputChromaFormat;

            status->bufInfo.minNumInBufs = MININBUFS;
            status->bufInfo.minNumOutBufs = MINOUTBUFS;
            status->bufInfo.minInBufSize[0] = MININBUFSIZE;
            status->bufInfo.minOutBufSize[0] = MINOUTBUFSIZE;

            retVal = IVIDDEC1_EOK;
            break;

        case XDM_SETPARAMS:
            retVal = IVIDDEC1_EOK;
            break;

        case XDM_SETDEFAULT:
            obj->outputChromaFormat = VIDDEC1COPY_TI_PARAMS.forceChromaFormat;

            retVal = IVIDDEC1_EOK;
            break;

        case XDM_RESET:
        case XDM_FLUSH:
            retVal = IVIDDEC1_EOK;
            break;

        case XDM_GETVERSION:
            if ((status->data.buf != NULL) &&
                (status->data.bufSize >= strlen(VERSIONSTRING))) {
                strncpy((char *)status->data.buf, VERSIONSTRING,
                    strlen(VERSIONSTRING));

                /* null terminate the string */
                status->data.buf[strlen(VERSIONSTRING)] = '\0';

                /* strncpy wrote to the data buffer */
                XDM_SETACCESSMODE_WRITE(status->data.accessMask);

                retVal = IVIDDEC1_EOK;
            }
            else {
                retVal = IVIDDEC1_EFAIL;
            }

            break;

        default:
            /* unsupported cmd */
            retVal = IVIDDEC1_EFAIL;
            break;
    }

    return (retVal);
}
Exemplo n.º 9
0
/* ARGSUSED - this line tells the TI compiler not to warn about unused args. */
XDAS_Int32 UNIVERSALCOPY_TI_control(IUNIVERSAL_Handle h,
    IUNIVERSAL_Cmd id, IUNIVERSAL_DynamicParams *dynParams,
    IUNIVERSAL_Status *status)
{
    XDAS_Int32 retVal;

#if (XDAIS_TRACE_OUT == 1)  /* 'handle' only used in TRACE_ statements */
    IALG_Handle handle = (IALG_Handle)h;
#endif

    TRACE_4print(handle, TRACE_ENTER,
            "UNIVERSALCOPY_TI_control> Enter (handle=0x%x, id=0x%x, "
            "dynParams=0x%x, status=0x%x)\n", handle, id, dynParams, status);

    /* validate arguments - this codec only supports "base" XDM. */
    if ((dynParams->size != sizeof(*dynParams)) ||
            (status->size != sizeof(*status))) {

        TRACE_0print(handle, TRACE_ENTER,
                "UNIVERSALCOPY_TI_control> Exit "
                "(status=IUNIVERSAL_EUNSUPPORTED)\n");

        return (IUNIVERSAL_EUNSUPPORTED);
    }

    /* initialize for the general case where we don't access the data buffer */
    XDM_CLEARACCESSMODE_READ(status->data.descs[0].accessMask);
    XDM_CLEARACCESSMODE_WRITE(status->data.descs[0].accessMask);

    switch (id) {
        case XDM_GETVERSION:
            if ((status->data.descs[0].buf != NULL) &&
                (status->data.descs[0].bufSize >=
                    strlen(VERSIONSTRING))) {

                strncpy((char *)status->data.descs[0].buf, VERSIONSTRING,
                        strlen(VERSIONSTRING));

                /* null terminate the string */
                status->data.descs[0].buf[strlen(VERSIONSTRING)] = '\0';

                /* strncpy wrote to the data buffer */
                TRACE_0print(handle, TRACE_4CLASS,
                        "UNIVERSALCOPY_TI_control> Fix the accessMask as we "
                        "wrote to the data buffer\n");
                XDM_SETACCESSMODE_WRITE(status->data.descs[0].accessMask);

                retVal = IUNIVERSAL_EOK;
            }
            else {
                retVal = IUNIVERSAL_EFAIL;
            }

            break;

        default:
            /* unsupported cmd */
            retVal = IUNIVERSAL_EFAIL;
            break;
    }

    TRACE_1print(handle, TRACE_ENTER, "UNIVERSALCOPY_TI_control> Exit"
                " (status=%d)\n", retVal);

    return (retVal);
}
Exemplo n.º 10
0
/* ARGSUSED - this line tells the TI compiler not to warn about unused args. */
XDAS_Int32 VIDENC1COPY_TI_process(IVIDENC1_Handle h, IVIDEO1_BufDescIn *inBufs,
    XDM_BufDesc *outBufs, IVIDENC1_InArgs *inArgs, IVIDENC1_OutArgs *outArgs)
{
    XDAS_Int32 numInBytes;

#ifdef USE_ACPY3
    const Uint32 maxTransferChunkSize       = 0xffff;
    Uint32       thisTransferChunkSize      = 0x0;
    Uint32       remainingTransferChunkSize;
    Uint32       thisTransferSrcAddr, thisTransferDstAddr;

    ACPY3_Params params;
    VIDENC1COPY_TI_Obj *videncObj = (VIDENC1COPY_TI_Obj *)h;
#endif
    /*
     * Validate arguments - this codec supports "base" XDM and an extended
     * inArgs.
     */
    if (((inArgs->size != sizeof(*inArgs)) &&
            (inArgs->size != sizeof(IVIDENC1CPY_InArgs))) ||
        (outArgs->size != sizeof(*outArgs))) {

        XDM_SETUNSUPPORTEDPARAM(outArgs->extendedError);

        return (IVIDENC1_EUNSUPPORTED);
    }

    /* validate that there's at least a single inBuf and outBuf */
    if ((inBufs->numBufs < 1) || (outBufs->numBufs < 1)) {
        XDM_SETUNSUPPORTEDPARAM(outArgs->extendedError);

        return (IVIDENC1_EFAIL);
    }

    /* validate inputID */
    if (inArgs->inputID == 0) {
        XDM_SETUNSUPPORTEDPARAM(outArgs->extendedError);

        return (IVIDENC1_EFAIL);
    }

    /* there's an available in and out buffer, how many samples? */
    numInBytes = inBufs->bufDesc[0].bufSize < outBufs->bufSizes[0] ?
        inBufs->bufDesc[0].bufSize : outBufs->bufSizes[0];

    /* and honor the extended maxBytes if it was provided */
    if (inArgs->size == sizeof(IVIDENC1CPY_InArgs)) {
        if (numInBytes > ((IVIDENC1CPY_InArgs *)inArgs)->maxBytes) {
            numInBytes = ((IVIDENC1CPY_InArgs *)inArgs)->maxBytes;
        }
    }
#ifdef USE_ACPY3
    /*
     * Activate Channel scratch DMA channels.
     */
    ACPY3_activate(videncObj->dmaHandle1D1D8B);

    thisTransferSrcAddr        = (Uint32)inBufs->bufDesc[0].buf;
    thisTransferDstAddr        = (Uint32)outBufs->bufs[0];
    remainingTransferChunkSize = numInBytes;

    while (remainingTransferChunkSize > 0) {

        if (remainingTransferChunkSize > maxTransferChunkSize) {
           thisTransferChunkSize = maxTransferChunkSize;
        }
        else {
           thisTransferChunkSize = remainingTransferChunkSize;
        }

        /* Configure the logical channel */
        params.transferType = ACPY3_1D1D;
        params.srcAddr      = (void *)thisTransferSrcAddr;
        params.dstAddr      = (void *)thisTransferDstAddr;
        params.elementSize  = thisTransferChunkSize;
        params.numElements  = 1;
        params.waitId       = 0;
        params.numFrames    = 1;

        remainingTransferChunkSize -= thisTransferChunkSize;
        thisTransferSrcAddr += thisTransferChunkSize;
        thisTransferDstAddr += thisTransferChunkSize;

        /* Configure logical dma channel */
        ACPY3_configure(videncObj->dmaHandle1D1D8B, &params, 0);

        /* Use DMA to copy data */
        ACPY3_start(videncObj->dmaHandle1D1D8B);

        /* wait for transfer to finish  */
        ACPY3_wait(videncObj->dmaHandle1D1D8B);
    }

    /*
     * Deactivate Channel scratch DMA channels.
     */
    ACPY3_deactivate(videncObj->dmaHandle1D1D8B);

    /*
     * Because we used DMA, the algo processor didn't accessed either of the
     * 2 data buffers.
     */
    XDM_CLEARACCESSMODE_READ(inBufs->bufDesc[0].accessMask);
    XDM_CLEARACCESSMODE_WRITE(inBufs->bufDesc[0].accessMask);

    XDM_CLEARACCESSMODE_READ(outArgs->encodedBuf.accessMask);
    XDM_CLEARACCESSMODE_WRITE(outArgs->encodedBuf.accessMask);

#else
    /* everything looks good, do the 'encode', set outArgs and return */
    memcpy(outBufs->bufs[0], inBufs->bufDesc[0].buf, numInBytes);

    /* memcpy read from inBuf and wrote to encodedBuf (in our case, outBuf) */
    XDM_CLEARACCESSMODE_WRITE(inBufs->bufDesc[0].accessMask);
    XDM_SETACCESSMODE_READ(inBufs->bufDesc[0].accessMask);

    XDM_CLEARACCESSMODE_READ(outArgs->encodedBuf.accessMask);
    XDM_SETACCESSMODE_WRITE(outArgs->encodedBuf.accessMask);
#endif

    /* outArgs->bytesGenerated reports the total number of bytes encoded */
    outArgs->bytesGenerated = numInBytes;

    /* report that the encoded data is in outArgs->encodedBuf */
    outArgs->encodedBuf.buf = outBufs->bufs[0];
    outArgs->encodedBuf.bufSize = outBufs->bufSizes[0];

    /* Fill out the rest of the outArgs struct */
    outArgs->extendedError = 0;
    outArgs->encodedFrameType = 0;     /* TODO */
    outArgs->inputFrameSkip = IVIDEO_FRAME_ENCODED;
    outArgs->outputID = inArgs->inputID;

    /* TODO - add support for reconBufs */
    outArgs->reconBufs.numBufs = 0;

    return (IVIDENC1_EOK);
}
Exemplo n.º 11
0
/* ARGSUSED - this line tells the TI compiler not to warn about unused args. */
XDAS_Int32 AUDDEC1_TI_process(IAUDDEC1_Handle handle, XDM1_BufDesc *inBufs,
    XDM1_BufDesc *outBufs, IAUDDEC1_InArgs *inArgs, IAUDDEC1_OutArgs *outArgs)
{
    AUDDEC1_TI_Obj *obj = (AUDDEC1_TI_Obj *)handle;
    BUFRES_Handle    bufres = obj->bufres;
    Int              i;
    XDAS_Int32       numInBytes;

    /* validate arguments - this codec only supports "base" xDM. */
    if ((inArgs->size != sizeof(*inArgs)) ||
            (outArgs->size != sizeof(*outArgs))) {
        outArgs->extendedError = XDM_UNSUPPORTEDPARAM;

        return (IAUDDEC1_EUNSUPPORTED);
    }

    /* validate that there's at least a single inBuf and outBuf */
    if ((inBufs->numBufs < 1) || (outBufs->numBufs < 1)) {
        outArgs->extendedError = XDM_UNSUPPORTEDPARAM;

        return (IAUDDEC1_EFAIL);
    }

    numInBytes = inArgs->numBytes;

    /*
     * Sanity check that inBufs->bufSizes[0] is really capable of holding
     * numInBytes bytes of data, and that outBufs->bufSizes[0]
     * can hold the 'encoded' data.
     */
    if ((numInBytes > inBufs->descs[0].bufSize) ||
        (numInBytes > outBufs->descs[0].bufSize)) {

        outArgs->extendedError = XDM_UNSUPPORTEDPARAM;

        return (IAUDDEC1_EFAIL);
    }

    /* Do something 'interesting' with the buffer resource */
    for (i = 0; i < bufres->length / sizeof(Int); i++) {
        ((Int *)(bufres->base))[i] = i;
    }

    /* everything looks good, do the 'encode', set outArgs and return */
    memcpy(outBufs->descs[0].buf, inBufs->descs[0].buf, numInBytes);

    /* report _how_ we accessed the 2 data buffers */
    XDM_CLEARACCESSMODE_WRITE(inBufs->descs[0].accessMask);
    XDM_SETACCESSMODE_READ(inBufs->descs[0].accessMask);

    XDM_CLEARACCESSMODE_READ(outBufs->descs[0].accessMask);
    XDM_SETACCESSMODE_WRITE(outBufs->descs[0].accessMask);

    /* outArgs->bytesGenerated reports the total number of bytes encoded */
    outArgs->bytesConsumed = numInBytes;

    /* Fill out the rest of the outArgs struct */
    outArgs->extendedError = 0;
    outArgs->numSamples = outArgs->bytesConsumed;  /* a sample == a byte */
    outArgs->channelMode = IAUDIO_2_0;  /* TODO */
    outArgs->lfeFlag = XDAS_FALSE;  /* TODO */
    outArgs->dualMonoMode = 0;  /* TODO */
    outArgs->sampleRate = 0;  /* TODO */

    return (IAUDDEC1_EOK);
}
Exemplo n.º 12
0
/*
 *  ======== VIDANALYTICSCOPY_TI_control ========
 */
XDAS_Int32 VIDANALYTICSCOPY_TI_control(IVIDANALYTICS_Handle handle,
    IVIDANALYTICS_Cmd id, IVIDANALYTICS_DynamicParams *dynParams,
    IVIDANALYTICS_Status *status)
{
    VIDANALYTICSCOPY_TI_Obj *obj = (VIDANALYTICSCOPY_TI_Obj *)handle;
    XDAS_Int32 retVal;
    Int i;

    /* validate arguments - this codec only supports "base" XDM. */
    if ((dynParams->size != sizeof(*dynParams)) ||
            (status->size != sizeof(*status))) {
        return (IVIDANALYTICS_EUNSUPPORTED);
    }

    /* validate data field. */
    if (status->data.numBufs > XDM_MAX_IO_BUFFERS) {
        /* too many buffers.  App forgot to initialize the data field? */
        return (IVIDANALYTICS_EUNSUPPORTED);
    }

    /*
     * Initialize for the general case where we don't access any data buffers.
     * Note, this is not a sparse array.
     */
    for (i = 0; i < status->data.numBufs; i++) {
        XDM_CLEARACCESSMODE_READ(status->data.descs[i].accessMask);
        XDM_CLEARACCESSMODE_WRITE(status->data.descs[i].accessMask);
    }

    switch (id) {
        case XDM_GETSTATUS:
            status->extendedError = obj->extendedError;
            status->viewState = obj->viewState;

            retVal = IVIDANALYTICS_EOK;
            break;

        case XDM_GETBUFINFO:
            status->bufInfo.minNumInBufs = MININBUFS;
            status->bufInfo.minNumOutBufs = MINOUTBUFS;
            status->bufInfo.minInBufSize[0] = MININBUFSIZE;
            status->bufInfo.minOutBufSize[0] = MINOUTBUFSIZE;

            retVal = IVIDANALYTICS_EOK;
            break;

        case XDM_SETPARAMS:
            retVal = IVIDANALYTICS_EOK;
            break;

        case XDM_SETDEFAULT:
            retVal = IVIDANALYTICS_EOK;
            break;

        case XDM_RESET:
        case XDM_FLUSH:
            obj->viewState = IVIDANALYTICS_VIEWSTATE_GOOD;
            obj->extendedError = 0;

            retVal = IVIDANALYTICS_EOK;
            break;

        case XDM_GETVERSION:
            if ((status->data.descs[0].buf != NULL) &&
                (status->data.descs[0].bufSize >=
                    strlen(VERSIONSTRING))) {

                strncpy((char *)status->data.descs[0].buf, VERSIONSTRING,
                        strlen(VERSIONSTRING));

                /* null terminate the string */
                status->data.descs[0].buf[strlen(VERSIONSTRING)] = '\0';

                /* strncpy wrote to the data buffer */
                XDM_SETACCESSMODE_WRITE(status->data.descs[0].accessMask);

                retVal = IVIDANALYTICS_EOK;
            }
            else {
                retVal = IVIDANALYTICS_EFAIL;
            }

            break;

        default:
            /* unsupported cmd */
            retVal = IVIDANALYTICS_EFAIL;
            break;
    }

    return (retVal);
}
Exemplo n.º 13
0
/*
 *  ======== SPHDEC1COPY_TI_control ========
 */
XDAS_Int32 SPHDEC1COPY_TI_control(ISPHDEC1_Handle handle, ISPHDEC1_Cmd id,
    ISPHDEC1_DynamicParams *dynParams, ISPHDEC1_Status *status)
{
    XDAS_Int32 retVal;
    SPHDEC1COPY_TI_Obj *obj = (SPHDEC1COPY_TI_Obj *)handle;

    /* validate arguments - this codec only supports "base" xDM. */
    if ((dynParams->size != sizeof(*dynParams)) ||
        (status->size != sizeof(*status))) {

        return (ISPHDEC1_EUNSUPPORTED);
    }

    /* initialize for the general case where we don't access the data buffer */
    XDM_CLEARACCESSMODE_READ(status->data.accessMask);
    XDM_CLEARACCESSMODE_WRITE(status->data.accessMask);

    switch (id) {
        case XDM_GETSTATUS:
        case XDM_GETBUFINFO:
            status->postFilter = obj->postFilter;
            status->extendedError = 0;
            status->compandingLaw = obj->compandingLaw;
            status->packingType = obj->packingType;
            status->codecSelection = obj->codecSelection;
            status->bitRate = obj->bitRate;

            status->bufInfo.minNumInBufs = MININBUFS;
            status->bufInfo.minNumOutBufs = MINOUTBUFS;
            status->bufInfo.minInBufSize[0] = MININBUFSIZE;
            status->bufInfo.minOutBufSize[0] = MINOUTBUFSIZE;

            retVal = ISPHDEC1_EOK;
            break;

        case XDM_SETPARAMS:
            obj->postFilter = dynParams->postFilter;
            retVal = ISPHDEC1_EOK;
            break;

        case XDM_SETDEFAULT:
            obj->compandingLaw = SPHDEC1COPY_TI_PARAMS.compandingLaw;
            obj->packingType = SPHDEC1COPY_TI_PARAMS.packingType;
            obj->codecSelection = SPHDEC1COPY_TI_PARAMS.codecSelection;
            obj->postFilter = ISPEECH1_POSTFILTER_DEFAULT;

            retVal = ISPHDEC1_EOK;
            break;

        case XDM_RESET:
        case XDM_FLUSH:
            retVal = ISPHDEC1_EOK;
            break;

        case XDM_GETVERSION:
            if ((status->data.buf != NULL) &&
                (status->data.bufSize >= strlen(SPHDEC1_COPY_VERSIONSTRING))) {
                strncpy((char *)status->data.buf, SPHDEC1_COPY_VERSIONSTRING,
                    strlen(SPHDEC1_COPY_VERSIONSTRING));

                /* null terminate the string */
                status->data.buf[strlen(SPHDEC1_COPY_VERSIONSTRING)] = '\0';

                /* strncpy wrote to the data buffer */
                XDM_SETACCESSMODE_WRITE(status->data.accessMask);

                retVal = ISPHDEC1_EOK;
            }
            else {
                retVal = ISPHDEC1_EFAIL;
            }

            break;

        default:
            /* unsupported cmd */
            retVal = ISPHDEC1_EFAIL;
            break;
    }

    return (retVal);
}