Revision d268bed2 libavcodec/h264.c

View differences:

libavcodec/h264.c
45 45
//#undef NDEBUG
46 46
#include <assert.h>
47 47

  
48
static const uint8_t rem6[52]={
49
0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3,
48
static const uint8_t rem6[QP_MAX_MAX+1]={
49
0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3,
50 50
};
51 51

  
52
static const uint8_t div6[52]={
53
0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8,
52
static const uint8_t div6[QP_MAX_MAX+1]={
53
0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9,10,10,10,10,
54 54
};
55 55

  
56 56
static const enum PixelFormat hwaccel_pixfmt_list_h264_jpeg_420[] = {
......
769 769

  
770 770
static void init_dequant8_coeff_table(H264Context *h){
771 771
    int i,q,x;
772
    const int max_qp = 51 + 6*(h->sps.bit_depth_luma-8);
772 773
    h->dequant8_coeff[0] = h->dequant8_buffer[0];
773 774
    h->dequant8_coeff[1] = h->dequant8_buffer[1];
774 775

  
......
778 779
            break;
779 780
        }
780 781

  
781
        for(q=0; q<52; q++){
782
        for(q=0; q<max_qp+1; q++){
782 783
            int shift = div6[q];
783 784
            int idx = rem6[q];
784 785
            for(x=0; x<64; x++)
......
791 792

  
792 793
static void init_dequant4_coeff_table(H264Context *h){
793 794
    int i,j,q,x;
795
    const int max_qp = 51 + 6*(h->sps.bit_depth_luma-8);
794 796
    for(i=0; i<6; i++ ){
795 797
        h->dequant4_coeff[i] = h->dequant4_buffer[i];
796 798
        for(j=0; j<i; j++){
......
802 804
        if(j<i)
803 805
            continue;
804 806

  
805
        for(q=0; q<52; q++){
807
        for(q=0; q<max_qp+1; q++){
806 808
            int shift = div6[q] + 2;
807 809
            int idx = rem6[q];
808 810
            for(x=0; x<16; x++)
......
1003 1005

  
1004 1006
    ff_h264_decode_init_vlc();
1005 1007

  
1008
    h->sps.bit_depth_luma = 8;
1006 1009
    h->pixel_size = 1;
1007 1010

  
1008 1011
    h->thread_context[0] = h;
......
1771 1774
                    for(i=16; i<16+8; i++){
1772 1775
                        if(h->non_zero_count_cache[ scan8[i] ] || h->mb[i*16]){
1773 1776
                            uint8_t * const ptr= dest[(i&4)>>2] + block_offset[i];
1774
                            ff_svq3_add_idct_c(ptr, h->mb + i*16, uvlinesize, ff_h264_chroma_qp[s->qscale + 12] - 12, 2);
1777
                            ff_svq3_add_idct_c(ptr, h->mb + i*16, uvlinesize, ff_h264_chroma_qp[0][s->qscale + 12] - 12, 2);
1775 1778
                        }
1776 1779
                    }
1777 1780
                }
......
2589 2592

  
2590 2593
    h->last_qscale_diff = 0;
2591 2594
    tmp = h->pps.init_qp + get_se_golomb(&s->gb);
2592
    if(tmp>51){
2595
    if(tmp>51+6*(h->sps.bit_depth_luma-8)){
2593 2596
        av_log(s->avctx, AV_LOG_ERROR, "QP %u out of range\n", tmp);
2594 2597
        return -1;
2595 2598
    }

Also available in: Unified diff