Ejemplo n.º 1
0
/*----------------------------------------------------------------------------
; FUNCTION CODE
----------------------------------------------------------------------------*/
Int set_mc_info(
    MC_Info     *pMC_Info,
    const tMP4AudioObjectType audioObjectType, /* used to be profile */
    const Int    sampling_rate_idx,
    const Int    tag,   /* always pass-in last element's value */
    const Int    is_cpe,
    FrameInfo   *pWinSeqInfo[],
    Int          sfbwidth128[]
)
{
    Ch_Info *pCh_Info; /*optional task: eliminate this structure */

    /*
     *   audioObjectType and sampling rate
     *   re-configure if new sampling rate
     *
     */
    pMC_Info->audioObjectType = audioObjectType;

    if (pMC_Info->sampling_rate_idx != sampling_rate_idx)
    {
        pMC_Info->sampling_rate_idx = sampling_rate_idx;

        Int status;
        status = infoinit(sampling_rate_idx,
                          pWinSeqInfo,
                          sfbwidth128);
        if (SUCCESS != status)
        {
            return 1;
        }
    }

    /*
     * first setup values for mono config, Single Channel Element (SCE)
     * then if stereo, go inside if(is_cpe != FALSE) branch to setup
     * values for stereo.
     * set the channel counts
     * save tag for left channel
     */
    pMC_Info->nch   = 1 + is_cpe;

    pCh_Info = &pMC_Info->ch_info[0];
    pCh_Info->tag = tag;
    pCh_Info->cpe = is_cpe;

    /* This if branch maybe deleted in the future */
    if (is_cpe != FALSE)
    {
        /* Channel Pair Element (CPE) */
        /* right channel*/
        pCh_Info = &pMC_Info->ch_info[1];
        pCh_Info->cpe = TRUE;

    }

    return(SUCCESS); /* possible future error checkings */
}
Ejemplo n.º 2
0
 /* freeNodes:
  * Free node resources.
  */
static void freeNodes(void)
{
    int i;
    Info_t *ip = nodeInfo;

    for (i = 0; i < nsites; i++) {
	breakPoly(&ip->poly);
	ip++;
    }
    polyFree();
    infoinit();			/* Free vertices */
    free(nodeInfo);
}
/*----------------------------------------------------------------------------
; FUNCTION CODE
----------------------------------------------------------------------------*/
OSCL_EXPORT_REF Int PVMP4AudioDecoderInitLibrary(
    tPVMP4AudioDecoderExternal  *pExt,
    void                        *pMem)
{
    tDec_Int_File *pVars;

    pVars = (tDec_Int_File *)pMem;

    /*
     * Initialize all memory. The pointers to channel memory will be
     * set to zero also.
     */
    pv_memset(
        pVars,
        0,
        sizeof(tDec_Int_File));

    /*
     * Pick default values for the library.
     */
    pVars->perChan[0].fxpCoef = pVars->fxpCoef[0];
    pVars->perChan[1].fxpCoef = pVars->fxpCoef[1];

    /* Here, the "shared memory" pointer is set to point
     * at the 1024th element of fxpCoef, because those spaces
     * in memory are not used until the filterbank is called.
     *
     * Therefore, any variables that are only used before
     * the filterbank can occupy this same space in memory.
     */

    pVars->perChan[0].pShareWfxpCoef = (per_chan_share_w_fxpCoef *)
                                       & (pVars->perChan[0].fxpCoef[1024]);

    pVars->perChan[1].pShareWfxpCoef = (per_chan_share_w_fxpCoef *)
                                       & (pVars->perChan[1].fxpCoef[1024]);

    /*
     * This next line informs the function get_prog_config that no
     * configuration has been found thus far, so it is a default
     * configuration.
     */

    pVars->current_program = -1;
    pVars->mc_info.sampling_rate_idx = Fs_44; /* Fs_44 = 4, 44.1kHz */

    /*
     * In the future, the frame length will change with MP4 file format.
     * Presently this variable is used to simply the unit test for
     * the function PVMP4AudioDecodeFrame() .. otherwise the test would
     * have to pass around 1024 length arrays.
     */
    pVars->frameLength = LONG_WINDOW; /* 1024*/

    /*
     * The window types ONLY_LONG_SEQUENCE, LONG_START_SEQUENCE, and
     * LONG_STOP_SEQUENCE share the same information. The only difference
     * between the windows is accounted for in the "filterbank", in
     * the function trans4m_freq_2_time_fxp()
     */

    pVars->winmap[ONLY_LONG_SEQUENCE]   /* 0 */ = &pVars->longFrameInfo;
    pVars->winmap[LONG_START_SEQUENCE]  /* 1 */ = &pVars->longFrameInfo;
    pVars->winmap[EIGHT_SHORT_SEQUENCE] /* 2 */ = &pVars->shortFrameInfo;
    pVars->winmap[LONG_STOP_SEQUENCE]   /* 3 */ = &pVars->longFrameInfo;

    infoinit(
        pVars->mc_info.sampling_rate_idx,
        (FrameInfo   **)pVars->winmap,
        pVars->SFBWidth128);


    /*
     * Clear out external output values. These values are set later at the end
     * of PVMP4AudioDecodeFrames()
     */
    pExt->bitRate = 0;
    pExt->encodedChannels = 0;
    pExt->samplingRate = 0;
    pExt->aacPlusUpsamplingFactor = 1;  /*  Default for regular AAC */
    pVars->aacPlusEnabled = pExt->aacPlusEnabled;


#if defined(AAC_PLUS)
    pVars->sbrDecoderData.setStreamType = 1;        /* Enable Lock for AAC stream type setting  */
#endif

    /*
     * Initialize input buffer variable.
     */

    pExt->inputBufferUsedLength = 0;

    return (MP4AUDEC_SUCCESS);

}  /* PVMP4AudioDecoderInitLibrary */
Ejemplo n.º 4
0
/* enter program configuration into MC_Info structure
 *  only configures for channels specified in all.h
 */
int enter_mc_info(faacDecHandle hDecoder, MC_Info *mip, ProgConfig *pcp)
{
    int i, j, cpe, tag, cw;
    EleList *elp;
    MIXdown *mxp;
    int channels = 0;

    /* reset channel counts */
    mip->nch = 0;
    mip->nfch = 0;
    mip->nfsce = 0;
    mip->nsch = 0;
    mip->nbch = 0;
    mip->nlch = 0;
    mip->ncch = 0;

    /*  object type and sampling rate
     *  re-configure if new sampling rate
     */
    mip->object_type = pcp->object_type;
    if (mip->sampling_rate_idx != pcp->sampling_rate_idx) {
        mip->sampling_rate_idx = pcp->sampling_rate_idx;
        infoinit(hDecoder, &samp_rate_info[mip->sampling_rate_idx]);
    }

    cw = 0;             /* changed later */

    /* front elements, center out */
    elp = &pcp->front;
    /* count number of leading SCE's */
    for (i=0, j=elp->num_ele; i<j; i++) {
        if (elp->ele_is_cpe[i])
            break;
        mip->nfsce++;
    }
    for (i=0, j=elp->num_ele; i<j; i++) {
        cpe = elp->ele_is_cpe[i];
        tag = elp->ele_tag[i];
        if (enter_chn(cpe, tag, 'f', cw, mip) < 0)
            return(-1);
        if (cpe) channels+=2;
        else channels++;
    }

    /* side elements, left to right then front to back */
    elp = &pcp->side;
    for (i=0, j=elp->num_ele; i<j; i++) {
        cpe = elp->ele_is_cpe[i];
        tag = elp->ele_tag[i];
        if (enter_chn(cpe, tag, 's', cw, mip) < 0)
            return(-1);
        if (cpe) channels+=2;
        else channels++;
    }

    /* back elements, outside to center */
    elp = &pcp->back;
    for (i=0, j=elp->num_ele; i<j; i++) {
        cpe = elp->ele_is_cpe[i];
        tag = elp->ele_tag[i];
        if (enter_chn(cpe, tag, 'b', cw, mip) < 0)
            return(-1);
        if (cpe) channels+=2;
        else channels++;
    }

    /* lfe elements */
    elp = &pcp->lfe;
    for (i=0, j=elp->num_ele; i<j; i++) {
        cpe = elp->ele_is_cpe[i];
        tag = elp->ele_tag[i];
        if (enter_chn(cpe, tag, 'l', cw, mip) < 0)
            return(-1);
        if (cpe) channels+=2;
        else channels++;
    }

    /* coupling channel elements */
    elp = &pcp->coupling;
    for (i=0, j=elp->num_ele; i<j; i++)
        mip->cch_tag[i] = elp->ele_tag[i];
    mip->ncch = j;
    channels += j;

    /* mono mixdown elements */
    mxp = &pcp->mono_mix;
    if (mxp->present) {
/*      CommonWarning("Unanticipated mono mixdown channel"); */
        return(-1);
    }

    /* stereo mixdown elements */
    mxp = &pcp->stereo_mix;
    if (mxp->present) {
/*      CommonWarning("Unanticipated stereo mixdown channel"); */
        return(-1);
    }

    /* matrix mixdown elements */
    mxp = &pcp->matrix_mix;
    if (mxp->present) {
/*      CommonWarning("Unanticipated matrix mixdown channel"); */
        return(-1);
    }

    /* save to check future consistency */
    if (!check_mc_info(hDecoder, mip, 1))
        return -1;

    return channels;
}