static int aac_decode_frame(AVCodecContext * avccontext, void * data, int * data_size, const uint8_t * buf, int buf_size) {
    AACContext * ac = avccontext->priv_data;
    GetBitContext gb;
    enum RawDataBlockType elem_type;
    int err, elem_id, data_size_tmp;
    init_get_bits(&gb, buf, buf_size*8);
    while ((elem_type = get_bits(&gb, 3)) != TYPE_END) {
        elem_id = get_bits(&gb, 4);
        err = -1;
        if(elem_type == TYPE_SCE && elem_id == 1 &&
                !ac->che[TYPE_SCE][elem_id] && ac->che[TYPE_LFE][0]) {
            ac->che[TYPE_SCE][elem_id] = ac->che[TYPE_LFE][0];
            ac->che[TYPE_LFE][0] = NULL;
        }
        if(elem_type < TYPE_DSE) {
            if(!ac->che[elem_type][elem_id])
                return -1;
            if(elem_type != TYPE_CCE)
                ac->che[elem_type][elem_id]->coup.coupling_point = 4;
        }
        switch (elem_type) {
        case TYPE_SCE:
            err = decode_ics(ac, &ac->che[TYPE_SCE][elem_id]->ch[0], &gb, 0, 0);
            break;
        case TYPE_CPE:
            err = decode_cpe(ac, &gb, elem_id);
            break;
        case TYPE_CCE:
            err = decode_cce(ac, &gb, ac->che[TYPE_CCE][elem_id]);
            break;
        case TYPE_LFE:
            err = decode_ics(ac, &ac->che[TYPE_LFE][elem_id]->ch[0], &gb, 0, 0);
            break;
        case TYPE_DSE:
            skip_data_stream_element(&gb);
            err = 0;
            break;
        case TYPE_PCE:
        {
            enum ChannelPosition new_che_pos[4][MAX_ELEM_ID];
            memset(new_che_pos, 0, 4 * MAX_ELEM_ID * sizeof(new_che_pos[0][0]));
            if((err = decode_pce(ac, new_che_pos, &gb)))
                break;
            err = output_configure(ac, ac->che_pos, new_che_pos);
            break;
        }
        case TYPE_FIL:
            if (elem_id == 15)
                elem_id += get_bits(&gb, 8) - 1;
            while (elem_id > 0)
                elem_id -= decode_extension_payload(ac, &gb, elem_id);
            err = 0;
            break;
        default:
            err = -1;
            break;
        }
        if(err)
            return err;
    }
    spectral_to_sample(ac);
    if (!ac->is_saved) {
        ac->is_saved = 1;
        *data_size = 0;
        return buf_size;
    }
    data_size_tmp = 1024 * avccontext->channels * sizeof(int16_t);
    if(*data_size < data_size_tmp) {
        av_log(avccontext, AV_LOG_ERROR,
               "Output buffer too small (%d) or trying to output too many samples (%d) for this frame.\n",
               *data_size, data_size_tmp);
        return -1;
    }
    *data_size = data_size_tmp;
    ac->dsp.float_to_int16_interleave(data, (const float **)ac->output_data, 1024, avccontext->channels);
    return buf_size;
}
['static int aac_decode_frame(AVCodecContext * avccontext, void * data, int * data_size, const uint8_t * buf, int buf_size) {\n    AACContext * ac = avccontext->priv_data;\n    GetBitContext gb;\n    enum RawDataBlockType elem_type;\n    int err, elem_id, data_size_tmp;\n    init_get_bits(&gb, buf, buf_size*8);\n    while ((elem_type = get_bits(&gb, 3)) != TYPE_END) {\n        elem_id = get_bits(&gb, 4);\n        err = -1;\n        if(elem_type == TYPE_SCE && elem_id == 1 &&\n                !ac->che[TYPE_SCE][elem_id] && ac->che[TYPE_LFE][0]) {\n            ac->che[TYPE_SCE][elem_id] = ac->che[TYPE_LFE][0];\n            ac->che[TYPE_LFE][0] = NULL;\n        }\n        if(elem_type < TYPE_DSE) {\n            if(!ac->che[elem_type][elem_id])\n                return -1;\n            if(elem_type != TYPE_CCE)\n                ac->che[elem_type][elem_id]->coup.coupling_point = 4;\n        }\n        switch (elem_type) {\n        case TYPE_SCE:\n            err = decode_ics(ac, &ac->che[TYPE_SCE][elem_id]->ch[0], &gb, 0, 0);\n            break;\n        case TYPE_CPE:\n            err = decode_cpe(ac, &gb, elem_id);\n            break;\n        case TYPE_CCE:\n            err = decode_cce(ac, &gb, ac->che[TYPE_CCE][elem_id]);\n            break;\n        case TYPE_LFE:\n            err = decode_ics(ac, &ac->che[TYPE_LFE][elem_id]->ch[0], &gb, 0, 0);\n            break;\n        case TYPE_DSE:\n            skip_data_stream_element(&gb);\n            err = 0;\n            break;\n        case TYPE_PCE:\n        {\n            enum ChannelPosition new_che_pos[4][MAX_ELEM_ID];\n            memset(new_che_pos, 0, 4 * MAX_ELEM_ID * sizeof(new_che_pos[0][0]));\n            if((err = decode_pce(ac, new_che_pos, &gb)))\n                break;\n            err = output_configure(ac, ac->che_pos, new_che_pos);\n            break;\n        }\n        case TYPE_FIL:\n            if (elem_id == 15)\n                elem_id += get_bits(&gb, 8) - 1;\n            while (elem_id > 0)\n                elem_id -= decode_extension_payload(ac, &gb, elem_id);\n            err = 0;\n            break;\n        default:\n            err = -1;\n            break;\n        }\n        if(err)\n            return err;\n    }\n    spectral_to_sample(ac);\n    if (!ac->is_saved) {\n        ac->is_saved = 1;\n        *data_size = 0;\n        return buf_size;\n    }\n    data_size_tmp = 1024 * avccontext->channels * sizeof(int16_t);\n    if(*data_size < data_size_tmp) {\n        av_log(avccontext, AV_LOG_ERROR,\n               "Output buffer too small (%d) or trying to output too many samples (%d) for this frame.\\n",\n               *data_size, data_size_tmp);\n        return -1;\n    }\n    *data_size = data_size_tmp;\n    ac->dsp.float_to_int16_interleave(data, (const float **)ac->output_data, 1024, avccontext->channels);\n    return buf_size;\n}', 'static inline void init_get_bits(GetBitContext *s,\n                   const uint8_t *buffer, int bit_size)\n{\n    int buffer_size= (bit_size+7)>>3;\n    if(buffer_size < 0 || bit_size < 0) {\n        buffer_size = bit_size = 0;\n        buffer = NULL;\n    }\n    s->buffer= buffer;\n    s->size_in_bits= bit_size;\n    s->buffer_end= buffer + buffer_size;\n#ifdef ALT_BITSTREAM_READER\n    s->index=0;\n#elif defined LIBMPEG2_BITSTREAM_READER\n    s->buffer_ptr = (uint8_t*)((intptr_t)buffer&(~1));\n    s->bit_count = 16 + 8*((intptr_t)buffer&1);\n    skip_bits_long(s, 0);\n#elif defined A32_BITSTREAM_READER\n    s->buffer_ptr = (uint32_t*)((intptr_t)buffer&(~3));\n    s->bit_count = 32 + 8*((intptr_t)buffer&3);\n    skip_bits_long(s, 0);\n#endif\n}', 'static inline unsigned int get_bits(GetBitContext *s, int n){\n    register int tmp;\n    OPEN_READER(re, s)\n    UPDATE_CACHE(re, s)\n    tmp= SHOW_UBITS(re, s, n);\n    LAST_SKIP_BITS(re, s, n)\n    CLOSE_READER(re, s)\n    return tmp;\n}']