Mercurial > mplayer.hg
changeset 7157:48b3a6f15540
libavcodec sync
author | rik |
---|---|
date | Fri, 30 Aug 2002 09:55:34 +0000 |
parents | 3e5e0e7c6e5e |
children | 90ff4ef3ca9e |
files | libvo/jpeg_enc.c |
diffstat | 1 files changed, 22 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/libvo/jpeg_enc.c Fri Aug 30 08:16:52 2002 +0000 +++ b/libvo/jpeg_enc.c Fri Aug 30 09:55:34 2002 +0000 @@ -58,11 +58,6 @@ } MJpegContext; -/* A very important function pointer */ -extern int (*dct_quantize)(MpegEncContext *s, - DCTELEM *block, int n, int qscale, int *overflow); - - /* Begin excessive code duplication ************************************/ /* Code coming from mpegvideo.c and mjpeg.c in ../libavcodec ***********/ @@ -78,14 +73,28 @@ 4520, 6270, 5906, 5315, 4520, 3552, 2446, 1247 }; -static void convert_matrix(int (*qmat)[64], uint16_t (*qmat16)[64], uint16_t (*qmat16_bias)[64], - const UINT16 *quant_matrix, int bias) +static void convert_matrix(MpegEncContext *s, int (*qmat)[64], + uint16_t (*qmat16)[64], uint16_t (*qmat16_bias)[64], + const UINT16 *quant_matrix, int bias) { int qscale; for(qscale=1; qscale<32; qscale++){ int i; - if (av_fdct == fdct_ifast) { + if (s->fdct == ff_jpeg_fdct_islow) { + for (i = 0; i < 64; i++) { + const int j = block_permute_op(i); + /* 16 <= qscale * quant_matrix[i] <= 7905 + * 19952 <= aanscales[i] * \ + * qscale * quant_matrix[i] <= 205026 + * (1<<36)/19952 >= (1<<36)/(aanscales[i] * \ + * qscale * quant_matrix[i]) >= (1<<36)/249205025 + * 3444240 >= (1<<36)/(aanscales[i] * + * qscale * quant_matrix[i]) >= 275 */ + qmat[qscale][j] = (int)((UINT64_C(1) << (QMAT_SHIFT-3))/ + (qscale * quant_matrix[j])); + } + } else if (s->fdct == fdct_ifast) { for(i=0;i<64;i++) { const int j= block_permute_op(i); /* 16 <= qscale * quant_matrix[i] <= 7905 */ @@ -355,7 +364,7 @@ for (i = 1; i < 64; i++) j->s->intra_matrix[i] = (ff_mpeg1_default_intra_matrix[i]*j->s->qscale) >> 3; - convert_matrix(j->s->q_intra_matrix, j->s->q_intra_matrix16, + convert_matrix(j->s, j->s->q_intra_matrix, j->s->q_intra_matrix16, j->s->q_intra_matrix16_bias, j->s->intra_matrix, j->s->intra_quant_bias); return j; @@ -447,24 +456,24 @@ emms_c(); /* is this really needed? */ j->s->block_last_index[0] = - dct_quantize(j->s, j->s->block[0], + j->s->dct_quantize(j->s, j->s->block[0], 0, 8, &overflow); if (overflow) clip_coeffs(j->s, j->s->block[0], j->s->block_last_index[0]); j->s->block_last_index[1] = - dct_quantize(j->s, j->s->block[1], + j->s->dct_quantize(j->s, j->s->block[1], 1, 8, &overflow); if (overflow) clip_coeffs(j->s, j->s->block[1], j->s->block_last_index[1]); if (!j->bw) { j->s->block_last_index[4] = - dct_quantize(j->s, j->s->block[2], + j->s->dct_quantize(j->s, j->s->block[2], 4, 8, &overflow); if (overflow) clip_coeffs(j->s, j->s->block[2], j->s->block_last_index[2]); j->s->block_last_index[5] = - dct_quantize(j->s, j->s->block[3], + j->s->dct_quantize(j->s, j->s->block[3], 5, 8, &overflow); if (overflow) clip_coeffs(j->s, j->s->block[3], j->s->block_last_index[3]);