Revision 6b56c616 libavcodec/mpegvideo.c
libavcodec/mpegvideo.c  

94  94  
95  95 
enum PixelFormat ff_yuv420p_list[2]= {PIX_FMT_YUV420P, 1}; 
96  96  
97 
static void convert_matrix(MpegEncContext *s, int (*qmat)[64], uint16_t (*qmat16)[2][64],


97 
static void convert_matrix(DSPContext *dsp, int (*qmat)[64], uint16_t (*qmat16)[2][64],


98  98 
const uint16_t *quant_matrix, int bias, int qmin, int qmax) 
99  99 
{ 
100  100 
int qscale; 
101  101  
102  102 
for(qscale=qmin; qscale<=qmax; qscale++){ 
103  103 
int i; 
104 
if (s>dsp.fdct == ff_jpeg_fdct_islow


104 
if (dsp>fdct == ff_jpeg_fdct_islow


105  105 
#ifdef FAAN_POSTSCALE 
106 
 s>dsp.fdct == ff_faandct


106 
 dsp>fdct == ff_faandct


107  107 
#endif 
108  108 
) { 
109  109 
for(i=0;i<64;i++) { 
110 
const int j= s>dsp.idct_permutation[i];


110 
const int j= dsp>idct_permutation[i];


111  111 
/* 16 <= qscale * quant_matrix[i] <= 7905 */ 
112  112 
/* 19952 <= aanscales[i] * qscale * quant_matrix[i] <= 249205026 */ 
113  113 
/* (1<<36)/19952 >= (1<<36)/(aanscales[i] * qscale * quant_matrix[i]) >= (1<<36)/249205026 */ 
...  ...  
116  116 
qmat[qscale][i] = (int)((uint64_t_C(1) << QMAT_SHIFT) / 
117  117 
(qscale * quant_matrix[j])); 
118  118 
} 
119 
} else if (s>dsp.fdct == fdct_ifast


119 
} else if (dsp>fdct == fdct_ifast


120  120 
#ifndef FAAN_POSTSCALE 
121 
 s>dsp.fdct == ff_faandct


121 
 dsp>fdct == ff_faandct


122  122 
#endif 
123  123 
) { 
124  124 
for(i=0;i<64;i++) { 
125 
const int j= s>dsp.idct_permutation[i];


125 
const int j= dsp>idct_permutation[i];


126  126 
/* 16 <= qscale * quant_matrix[i] <= 7905 */ 
127  127 
/* 19952 <= aanscales[i] * qscale * quant_matrix[i] <= 249205026 */ 
128  128 
/* (1<<36)/19952 >= (1<<36)/(aanscales[i] * qscale * quant_matrix[i]) >= (1<<36)/249205026 */ 
...  ...  
133  133 
} 
134  134 
} else { 
135  135 
for(i=0;i<64;i++) { 
136 
const int j= s>dsp.idct_permutation[i];


136 
const int j= dsp>idct_permutation[i];


137  137 
/* We can safely suppose that 16 <= quant_matrix[i] <= 255 
138  138 
So 16 <= qscale * quant_matrix[i] <= 7905 
139  139 
so (1<<19) / 16 >= (1<<19) / (qscale * quant_matrix[i]) >= (1<<19) / 7905 
...  ...  
903  903 
/* precompute matrix */ 
904  904 
/* for mjpeg, we do include qscale in the matrix */ 
905  905 
if (s>out_format != FMT_MJPEG) { 
906 
convert_matrix(s, s>q_intra_matrix, s>q_intra_matrix16,


906 
convert_matrix(&s>dsp, s>q_intra_matrix, s>q_intra_matrix16,


907  907 
s>intra_matrix, s>intra_quant_bias, 1, 31); 
908 
convert_matrix(s, s>q_inter_matrix, s>q_inter_matrix16,


908 
convert_matrix(&s>dsp, s>q_inter_matrix, s>q_inter_matrix16,


909  909 
s>inter_matrix, s>inter_quant_bias, 1, 31); 
910  910 
} 
911  911  
...  ...  
3522  3522  
3523  3523 
s>intra_matrix[j] = CLAMP_TO_8BIT((ff_mpeg1_default_intra_matrix[i] * s>qscale) >> 3); 
3524  3524 
} 
3525 
convert_matrix(s, s>q_intra_matrix, s>q_intra_matrix16,


3525 
convert_matrix(&s>dsp, s>q_intra_matrix, s>q_intra_matrix16,


3526  3526 
s>intra_matrix, s>intra_quant_bias, 8, 8); 
3527  3527 
} 
3528  3528 

Also available in: Unified diff