Revision cb62510c libavcodec/bink.c

View differences:

libavcodec/bink.c
571 571
    return ret;
572 572
}
573 573

  
574
typedef const uint32_t quant_matrices[16][64];
575
static const quant_matrices * bink_quant_matrices[2][2] = {
576
    { &bink_inter_quant,  &bink_intra_quant  },
577
    { &binkb_inter_quant, &binkb_intra_quant },
578
};
579

  
580 574
/**
581 575
 * Read 8x8 block of DCT coefficients.
582 576
 *
583 577
 * @param gb       context for reading bits
584 578
 * @param block    place for storing coefficients
585 579
 * @param scan     scan order table
586
 * @param is_binkb use version 'b' quantizer matrices
587
 * @param is_intra tells what set of quantizer matrices to use
580
 * @param quant_matrices quantization matrices
588 581
 * @return 0 for success, negative value in other cases
589 582
 */
590 583
static int read_dct_coeffs(GetBitContext *gb, DCTELEM block[64], const uint8_t *scan,
591
                           int is_binkb, int is_intra, int q)
584
                           const uint32_t quant_matrices[16][64], int q)
592 585
{
593 586
    int coef_list[128];
594 587
    int mode_list[128];
......
674 667
        quant_idx = q;
675 668
    }
676 669

  
677
    quant = (*bink_quant_matrices[is_binkb][is_intra])[quant_idx];
670
    quant = quant_matrices[quant_idx];
678 671

  
679 672
    block[0] = (block[0] * quant[0]) >> 11;
680 673
    for (i = 0; i < coef_count; i++) {
......
855 848
                c->dsp.clear_block(block);
856 849
                block[0] = binkb_get_value(c, BINKB_SRC_INTRA_DC);
857 850
                qp = binkb_get_value(c, BINKB_SRC_INTRA_Q);
858
                read_dct_coeffs(gb, block, c->scantable.permutated, 1, 1, qp);
851
                read_dct_coeffs(gb, block, c->scantable.permutated, binkb_intra_quant, qp);
859 852
                c->dsp.idct_put(dst, stride, block);
860 853
                break;
861 854
            case 3:
......
888 881
                c->dsp.clear_block(block);
889 882
                block[0] = binkb_get_value(c, BINKB_SRC_INTER_DC);
890 883
                qp = binkb_get_value(c, BINKB_SRC_INTER_Q);
891
                read_dct_coeffs(gb, block, c->scantable.permutated, 1, 0, qp);
884
                read_dct_coeffs(gb, block, c->scantable.permutated, binkb_inter_quant, qp);
892 885
                c->dsp.idct_add(dst, stride, block);
893 886
                break;
894 887
            case 5:
......
1028 1021
                case INTRA_BLOCK:
1029 1022
                    c->dsp.clear_block(block);
1030 1023
                    block[0] = get_value(c, BINK_SRC_INTRA_DC);
1031
                    read_dct_coeffs(gb, block, c->scantable.permutated, 0, 1, -1);
1024
                    read_dct_coeffs(gb, block, c->scantable.permutated, bink_intra_quant, -1);
1032 1025
                    c->dsp.idct(block);
1033 1026
                    c->dsp.put_pixels_nonclamped(block, ublock, 8);
1034 1027
                    break;
......
1112 1105
            case INTRA_BLOCK:
1113 1106
                c->dsp.clear_block(block);
1114 1107
                block[0] = get_value(c, BINK_SRC_INTRA_DC);
1115
                read_dct_coeffs(gb, block, c->scantable.permutated, 0, 1, -1);
1108
                read_dct_coeffs(gb, block, c->scantable.permutated, bink_intra_quant, -1);
1116 1109
                c->dsp.idct_put(dst, stride, block);
1117 1110
                break;
1118 1111
            case FILL_BLOCK:
......
1126 1119
                c->dsp.put_pixels_tab[1][0](dst, ref, stride, 8);
1127 1120
                c->dsp.clear_block(block);
1128 1121
                block[0] = get_value(c, BINK_SRC_INTER_DC);
1129
                read_dct_coeffs(gb, block, c->scantable.permutated, 0, 0, -1);
1122
                read_dct_coeffs(gb, block, c->scantable.permutated, bink_inter_quant, -1);
1130 1123
                c->dsp.idct_add(dst, stride, block);
1131 1124
                break;
1132 1125
            case PATTERN_BLOCK:

Also available in: Unified diff