Revision 1790a5e9 libavcodec/h264.c

View differences:

libavcodec/h264.c
1359 1359
    }
1360 1360
}
1361 1361

  
1362
/**
1363
 * Decodes a network abstraction layer unit.
1364
 * @param consumed is the number of bytes used as input
1365
 * @param length is the length of the array
1366
 * @param dst_length is the number of decoded bytes FIXME here or a decode rbsp tailing?
1367
 * @returns decoded bytes, might be src+1 if no escapes
1368
 */
1369
static const uint8_t *decode_nal(H264Context *h, const uint8_t *src, int *dst_length, int *consumed, int length){
1362
const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src, int *dst_length, int *consumed, int length){
1370 1363
    int i, si, di;
1371 1364
    uint8_t *dst;
1372 1365
    int bufidx;
......
1456 1449
    return dst;
1457 1450
}
1458 1451

  
1459
/**
1460
 * identifies the exact end of the bitstream
1461
 * @return the length of the trailing, or 0 if damaged
1462
 */
1463
static int decode_rbsp_trailing(H264Context *h, const uint8_t *src){
1452
int ff_h264_decode_rbsp_trailing(H264Context *h, const uint8_t *src){
1464 1453
    int v= *src;
1465 1454
    int r;
1466 1455

  
......
6897 6886
    return 0;
6898 6887
}
6899 6888

  
6900
static int decode_sei(H264Context *h){
6889
int ff_h264_decode_sei(H264Context *h){
6901 6890
    MpegEncContext * const s = &h->s;
6902 6891

  
6903 6892
    while(get_bits_count(&s->gb) + 16 < s->gb.size_in_bits){
......
7091 7080
    }
7092 7081
}
7093 7082

  
7094
static inline int decode_seq_parameter_set(H264Context *h){
7083
int ff_h264_decode_seq_parameter_set(H264Context *h){
7095 7084
    MpegEncContext * const s = &h->s;
7096 7085
    int profile_idc, level_idc;
7097 7086
    unsigned int sps_id;
......
7238 7227
        pps->chroma_qp_table[t][i] = chroma_qp[av_clip(i + index, 0, 51)];
7239 7228
}
7240 7229

  
7241
static inline int decode_picture_parameter_set(H264Context *h, int bit_length){
7230
int ff_h264_decode_picture_parameter_set(H264Context *h, int bit_length){
7242 7231
    MpegEncContext * const s = &h->s;
7243 7232
    unsigned int pps_id= get_ue_golomb(&s->gb);
7244 7233
    PPS *pps;
......
7449 7438

  
7450 7439
        hx = h->thread_context[context_count];
7451 7440

  
7452
        ptr= decode_nal(hx, buf + buf_index, &dst_length, &consumed, h->is_avc ? nalsize : buf_size - buf_index);
7441
        ptr= ff_h264_decode_nal(hx, buf + buf_index, &dst_length, &consumed, h->is_avc ? nalsize : buf_size - buf_index);
7453 7442
        if (ptr==NULL || dst_length < 0){
7454 7443
            return -1;
7455 7444
        }
7456 7445
        while(ptr[dst_length - 1] == 0 && dst_length > 0)
7457 7446
            dst_length--;
7458
        bit_length= !dst_length ? 0 : (8*dst_length - decode_rbsp_trailing(h, ptr + dst_length - 1));
7447
        bit_length= !dst_length ? 0 : (8*dst_length - ff_h264_decode_rbsp_trailing(h, ptr + dst_length - 1));
7459 7448

  
7460 7449
        if(s->avctx->debug&FF_DEBUG_STARTCODE){
7461 7450
            av_log(h->s.avctx, AV_LOG_DEBUG, "NAL %d at %d/%d length %d\n", hx->nal_unit_type, buf_index, buf_size, dst_length);
......
7537 7526
            break;
7538 7527
        case NAL_SEI:
7539 7528
            init_get_bits(&s->gb, ptr, bit_length);
7540
            decode_sei(h);
7529
            ff_h264_decode_sei(h);
7541 7530
            break;
7542 7531
        case NAL_SPS:
7543 7532
            init_get_bits(&s->gb, ptr, bit_length);
7544
            decode_seq_parameter_set(h);
7533
            ff_h264_decode_seq_parameter_set(h);
7545 7534

  
7546 7535
            if(s->flags& CODEC_FLAG_LOW_DELAY)
7547 7536
                s->low_delay=1;
......
7552 7541
        case NAL_PPS:
7553 7542
            init_get_bits(&s->gb, ptr, bit_length);
7554 7543

  
7555
            decode_picture_parameter_set(h, bit_length);
7544
            ff_h264_decode_picture_parameter_set(h, bit_length);
7556 7545

  
7557 7546
            break;
7558 7547
        case NAL_AUD:
......
8039 8028
            return -1;
8040 8029
        }
8041 8030

  
8042
        out= decode_nal(&h, nal, &out_length, &consumed, nal_length);
8031
        out= ff_h264_decode_nal(&h, nal, &out_length, &consumed, nal_length);
8043 8032

  
8044 8033
        STOP_TIMER("NAL")
8045 8034

  

Also available in: Unified diff