mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-08 13:22:53 +02:00
optionally merge postscale into quantization table for the float aan dct
Originally committed as revision 2420 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
10becaaf12
commit
b4c3816cfa
@ -161,7 +161,11 @@ void dct_error(const char *name, int is_idct,
|
|||||||
fdct_func(block);
|
fdct_func(block);
|
||||||
emms(); /* for ff_mmx_idct */
|
emms(); /* for ff_mmx_idct */
|
||||||
|
|
||||||
if (fdct_func == fdct_ifast) {
|
if (fdct_func == fdct_ifast
|
||||||
|
#ifndef FAAN_POSTSCALE
|
||||||
|
|| fdct_func == ff_faandct
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
for(i=0; i<64; i++) {
|
for(i=0; i<64; i++) {
|
||||||
scale = 8*(1 << (AANSCALE_BITS + 11)) / aanscales[i];
|
scale = 8*(1 << (AANSCALE_BITS + 11)) / aanscales[i];
|
||||||
block[i] = (block[i] * scale /*+ (1<<(AANSCALE_BITS-1))*/) >> AANSCALE_BITS;
|
block[i] = (block[i] * scale /*+ (1<<(AANSCALE_BITS-1))*/) >> AANSCALE_BITS;
|
||||||
|
@ -32,6 +32,11 @@
|
|||||||
#include "faandct.h"
|
#include "faandct.h"
|
||||||
|
|
||||||
#define FLOAT float
|
#define FLOAT float
|
||||||
|
#ifdef FAAN_POSTSCALE
|
||||||
|
# define SCALE(x) postscale[x]
|
||||||
|
#else
|
||||||
|
# define SCALE(x) 1
|
||||||
|
#endif
|
||||||
|
|
||||||
//numbers generated by simple c code (not as accurate as they could be)
|
//numbers generated by simple c code (not as accurate as they could be)
|
||||||
/*
|
/*
|
||||||
@ -130,12 +135,12 @@ void ff_faandct(DCTELEM * data)
|
|||||||
tmp11= tmp1 + tmp2;
|
tmp11= tmp1 + tmp2;
|
||||||
tmp12= tmp1 - tmp2;
|
tmp12= tmp1 - tmp2;
|
||||||
|
|
||||||
data[8*0 + i]= lrint(postscale[8*0 + i] * (tmp10 + tmp11));
|
data[8*0 + i]= lrint(SCALE(8*0 + i) * (tmp10 + tmp11));
|
||||||
data[8*4 + i]= lrint(postscale[8*4 + i] * (tmp10 - tmp11));
|
data[8*4 + i]= lrint(SCALE(8*4 + i) * (tmp10 - tmp11));
|
||||||
|
|
||||||
z1= (tmp12 + tmp13)* A1;
|
z1= (tmp12 + tmp13)* A1;
|
||||||
data[8*2 + i]= lrint(postscale[8*2 + i] * (tmp13 + z1));
|
data[8*2 + i]= lrint(SCALE(8*2 + i) * (tmp13 + z1));
|
||||||
data[8*6 + i]= lrint(postscale[8*6 + i] * (tmp13 - z1));
|
data[8*6 + i]= lrint(SCALE(8*6 + i) * (tmp13 - z1));
|
||||||
|
|
||||||
tmp10= tmp4 + tmp5;
|
tmp10= tmp4 + tmp5;
|
||||||
tmp11= tmp5 + tmp6;
|
tmp11= tmp5 + tmp6;
|
||||||
@ -149,9 +154,9 @@ void ff_faandct(DCTELEM * data)
|
|||||||
z11= tmp7 + z3;
|
z11= tmp7 + z3;
|
||||||
z13= tmp7 - z3;
|
z13= tmp7 - z3;
|
||||||
|
|
||||||
data[8*5 + i]= lrint(postscale[8*5 + i] * (z13 + z2));
|
data[8*5 + i]= lrint(SCALE(8*5 + i) * (z13 + z2));
|
||||||
data[8*3 + i]= lrint(postscale[8*3 + i] * (z13 - z2));
|
data[8*3 + i]= lrint(SCALE(8*3 + i) * (z13 - z2));
|
||||||
data[8*1 + i]= lrint(postscale[8*1 + i] * (z11 + z4));
|
data[8*1 + i]= lrint(SCALE(8*1 + i) * (z11 + z4));
|
||||||
data[8*7 + i]= lrint(postscale[8*7 + i] * (z11 - z4));
|
data[8*7 + i]= lrint(SCALE(8*7 + i) * (z11 - z4));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,4 +25,6 @@
|
|||||||
* @author Michael Niedermayer <michaelni@gmx.at>
|
* @author Michael Niedermayer <michaelni@gmx.at>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define FAAN_POSTSCALE
|
||||||
|
|
||||||
void ff_faandct(DCTELEM * data);
|
void ff_faandct(DCTELEM * data);
|
||||||
|
@ -101,7 +101,11 @@ static void convert_matrix(MpegEncContext *s, int (*qmat)[64], uint16_t (*qmat16
|
|||||||
|
|
||||||
for(qscale=qmin; qscale<=qmax; qscale++){
|
for(qscale=qmin; qscale<=qmax; qscale++){
|
||||||
int i;
|
int i;
|
||||||
if (s->dsp.fdct == ff_jpeg_fdct_islow || s->dsp.fdct == ff_faandct) {
|
if (s->dsp.fdct == ff_jpeg_fdct_islow
|
||||||
|
#ifdef FAAN_POSTSCALE
|
||||||
|
|| s->dsp.fdct == ff_faandct
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
for(i=0;i<64;i++) {
|
for(i=0;i<64;i++) {
|
||||||
const int j= s->dsp.idct_permutation[i];
|
const int j= s->dsp.idct_permutation[i];
|
||||||
/* 16 <= qscale * quant_matrix[i] <= 7905 */
|
/* 16 <= qscale * quant_matrix[i] <= 7905 */
|
||||||
@ -112,7 +116,11 @@ static void convert_matrix(MpegEncContext *s, int (*qmat)[64], uint16_t (*qmat16
|
|||||||
qmat[qscale][i] = (int)((uint64_t_C(1) << QMAT_SHIFT) /
|
qmat[qscale][i] = (int)((uint64_t_C(1) << QMAT_SHIFT) /
|
||||||
(qscale * quant_matrix[j]));
|
(qscale * quant_matrix[j]));
|
||||||
}
|
}
|
||||||
} else if (s->dsp.fdct == fdct_ifast) {
|
} else if (s->dsp.fdct == fdct_ifast
|
||||||
|
#ifndef FAAN_POSTSCALE
|
||||||
|
|| s->dsp.fdct == ff_faandct
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
for(i=0;i<64;i++) {
|
for(i=0;i<64;i++) {
|
||||||
const int j= s->dsp.idct_permutation[i];
|
const int j= s->dsp.idct_permutation[i];
|
||||||
/* 16 <= qscale * quant_matrix[i] <= 7905 */
|
/* 16 <= qscale * quant_matrix[i] <= 7905 */
|
||||||
|
Loading…
Reference in New Issue
Block a user