You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
fixed incorrect global gain - slightly increased precision of n^(4/3) table
Originally committed as revision 557 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
@@ -279,12 +279,17 @@ static int int_pow(int i, int *exp_ptr)
|
|||||||
a = a << 1;
|
a = a << 1;
|
||||||
eq--;
|
eq--;
|
||||||
}
|
}
|
||||||
*exp_ptr = eq;
|
/* now POW_FRAC_ONE <= a < 2 * POW_FRAC_ONE */
|
||||||
#if POW_FRAC_BITS == FRAC_BITS
|
#if (POW_FRAC_BITS - 1) > FRAC_BITS
|
||||||
return a;
|
a = (a + (1 << (POW_FRAC_BITS - FRAC_BITS - 1))) >> (POW_FRAC_BITS - FRAC_BITS);
|
||||||
#else
|
/* correct overflow */
|
||||||
return (a + (1 << (POW_FRAC_BITS - FRAC_BITS - 1))) >> (POW_FRAC_BITS - FRAC_BITS);
|
if (a >= 2 * (1 << FRAC_BITS)) {
|
||||||
|
a = a >> 1;
|
||||||
|
eq++;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
*exp_ptr = eq;
|
||||||
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int decode_init(AVCodecContext * avctx)
|
static int decode_init(AVCodecContext * avctx)
|
||||||
@@ -388,10 +393,6 @@ static int decode_init(AVCodecContext * avctx)
|
|||||||
for(i=1;i<TABLE_4_3_SIZE;i++) {
|
for(i=1;i<TABLE_4_3_SIZE;i++) {
|
||||||
int e, m;
|
int e, m;
|
||||||
m = int_pow(i, &e);
|
m = int_pow(i, &e);
|
||||||
#if FRAC_BITS <= 15
|
|
||||||
if ((unsigned short)m != m)
|
|
||||||
m = 65535;
|
|
||||||
#endif
|
|
||||||
#if 0
|
#if 0
|
||||||
/* test code */
|
/* test code */
|
||||||
{
|
{
|
||||||
@@ -401,8 +402,10 @@ static int decode_init(AVCodecContext * avctx)
|
|||||||
fm = frexp(f, &e1);
|
fm = frexp(f, &e1);
|
||||||
m1 = FIXR(2 * fm);
|
m1 = FIXR(2 * fm);
|
||||||
#if FRAC_BITS <= 15
|
#if FRAC_BITS <= 15
|
||||||
if ((unsigned short)m1 != m1)
|
if ((unsigned short)m1 != m1) {
|
||||||
m1 = 65535;
|
m1 = m1 >> 1;
|
||||||
|
e1++;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
e1--;
|
e1--;
|
||||||
if (m != m1 || e != e1) {
|
if (m != m1 || e != e1) {
|
||||||
@@ -413,9 +416,8 @@ static int decode_init(AVCodecContext * avctx)
|
|||||||
#endif
|
#endif
|
||||||
/* normalized to FRAC_BITS */
|
/* normalized to FRAC_BITS */
|
||||||
table_4_3_value[i] = m;
|
table_4_3_value[i] = m;
|
||||||
table_4_3_exp[i] = e - 1;
|
table_4_3_exp[i] = e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for(i=0;i<7;i++) {
|
for(i=0;i<7;i++) {
|
||||||
float f;
|
float f;
|
||||||
|
Reference in New Issue
Block a user