示例#1
0
static uint16_t sbr_extension(bitfile *ld, sbr_info *sbr,
                              uint8_t bs_extension_id, uint16_t num_bits_left)
{
    switch (bs_extension_id)
    {
#ifdef PS_DEC
    case EXTENSION_ID_PS:
        sbr->ps_used = 1;
        if (!sbr->ps)
        {
            sbr->ps = ps_init(get_sr_index(sbr->sample_rate));
        }
        return ps_data(sbr->ps, ld);
#endif
#ifdef DRM_PS
    case DRM_PARAMETRIC_STEREO:
        sbr->ps_used = 1;
        if (!sbr->drm_ps)
        {
            sbr->drm_ps = drm_ps_init();
        }
        return drm_ps_data(sbr->drm_ps, ld);
#endif
    default:
        sbr->bs_extension_data = (uint8_t)faad_getbits(ld, 6
                                 DEBUGVAR(1,279,"sbr_single_channel_element(): bs_extension_data"));
        return 6;
    }
}
示例#2
0
static uint16_t sbr_extension(bitfile *ld, sbr_info *sbr,
                              uint8_t bs_extension_id, uint16_t num_bits_left)
{
#ifdef PS_DEC
    uint8_t header;
    uint16_t ret;
#endif

    switch (bs_extension_id)
    {
#ifdef PS_DEC
    case EXTENSION_ID_PS:
        if (!sbr->ps)
        {
            sbr->ps = ps_init(get_sr_index(sbr->sample_rate));
        }
        if (sbr->psResetFlag)
        {
            sbr->ps->header_read = 0;
        }
        ret = ps_data(sbr->ps, ld, &header);

        /* enable PS if and only if: a header has been decoded */
        if (sbr->ps_used == 0 && header == 1)
        {
            sbr->ps_used = 1;
        }

        if (header == 1)
        {
            sbr->psResetFlag = 0;
        }

        return ret;
#endif
#ifdef DRM_PS
    case DRM_PARAMETRIC_STEREO:
        sbr->ps_used = 1;
        if (!sbr->drm_ps)
        {
            sbr->drm_ps = drm_ps_init();
        }
        return drm_ps_data(sbr->drm_ps, ld);
#endif
    default:
        sbr->bs_extension_data = (uint8_t)faad_getbits(ld, 6
            DEBUGVAR(1,279,"sbr_single_channel_element(): bs_extension_data"));
        return 6;
    }
}