mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-21 10:55:51 +02:00
Merge remote branch 'qatar/master'
* qatar/master: ac3enc: ARM optimised ac3_compute_matissa_size ac3: armv6 optimised bit_alloc_calc_bap fate: simplify fft test rules avio: document avio_alloc_context. lavf: make compute_chapters_end less picky. sierravmd: fix Indeo3 videos FFT: simplify fft8() fate: add fixed-point fft/mdct tests Fixed-point support in fft-test ape: check that number of seektable entries is equal to number of frames Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
4defa68fe2
@ -661,7 +661,7 @@ SKIPHEADERS += mpegaudio3.h
|
|||||||
|
|
||||||
EXAMPLES = api
|
EXAMPLES = api
|
||||||
|
|
||||||
TESTPROGS = cabac dct eval fft h264 iirfilter rangecoder snow
|
TESTPROGS = cabac dct eval fft fft-fixed h264 iirfilter rangecoder snow
|
||||||
TESTPROGS-$(HAVE_MMX) += motion
|
TESTPROGS-$(HAVE_MMX) += motion
|
||||||
TESTOBJS = dctref.o
|
TESTOBJS = dctref.o
|
||||||
|
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_init_arm.o
|
OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_init_arm.o \
|
||||||
|
arm/ac3dsp_arm.o
|
||||||
|
|
||||||
OBJS-$(CONFIG_DCA_DECODER) += arm/dcadsp_init_arm.o \
|
OBJS-$(CONFIG_DCA_DECODER) += arm/dcadsp_init_arm.o \
|
||||||
|
|
||||||
|
ARMV6-OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_armv6.o
|
||||||
|
|
||||||
OBJS-$(CONFIG_VP5_DECODER) += arm/vp56dsp_init_arm.o
|
OBJS-$(CONFIG_VP5_DECODER) += arm/vp56dsp_init_arm.o
|
||||||
OBJS-$(CONFIG_VP6_DECODER) += arm/vp56dsp_init_arm.o
|
OBJS-$(CONFIG_VP6_DECODER) += arm/vp56dsp_init_arm.o
|
||||||
OBJS-$(CONFIG_VP8_DECODER) += arm/vp8dsp_init_arm.o
|
OBJS-$(CONFIG_VP8_DECODER) += arm/vp8dsp_init_arm.o
|
||||||
|
52
libavcodec/arm/ac3dsp_arm.S
Normal file
52
libavcodec/arm/ac3dsp_arm.S
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2011 Mans Rullgard <mans@mansr.com>
|
||||||
|
*
|
||||||
|
* This file is part of Libav.
|
||||||
|
*
|
||||||
|
* Libav is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Libav is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with Libav; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "asm.S"
|
||||||
|
|
||||||
|
function ff_ac3_compute_mantissa_size_arm, export=1
|
||||||
|
push {r4-r8,lr}
|
||||||
|
ldm r0, {r4-r8}
|
||||||
|
mov r3, r0
|
||||||
|
mov r0, #0
|
||||||
|
1:
|
||||||
|
ldrb lr, [r1], #1
|
||||||
|
subs r2, r2, #1
|
||||||
|
blt 2f
|
||||||
|
cmp lr, #4
|
||||||
|
bgt 3f
|
||||||
|
subs lr, lr, #1
|
||||||
|
addlt r4, r4, #1
|
||||||
|
addeq r5, r5, #1
|
||||||
|
ble 1b
|
||||||
|
subs lr, lr, #2
|
||||||
|
addlt r6, r6, #1
|
||||||
|
addeq r7, r7, #1
|
||||||
|
addgt r8, r8, #1
|
||||||
|
b 1b
|
||||||
|
3:
|
||||||
|
cmp lr, #14
|
||||||
|
sublt lr, lr, #1
|
||||||
|
addgt r0, r0, #16
|
||||||
|
addle r0, r0, lr
|
||||||
|
b 1b
|
||||||
|
2:
|
||||||
|
stm r3, {r4-r8}
|
||||||
|
pop {r4-r8,pc}
|
||||||
|
endfunc
|
83
libavcodec/arm/ac3dsp_armv6.S
Normal file
83
libavcodec/arm/ac3dsp_armv6.S
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2011 Mans Rullgard <mans@mansr.com>
|
||||||
|
*
|
||||||
|
* This file is part of Libav.
|
||||||
|
*
|
||||||
|
* Libav is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Libav is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with Libav; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "asm.S"
|
||||||
|
|
||||||
|
function ff_ac3_bit_alloc_calc_bap_armv6, export=1
|
||||||
|
ldr r12, [sp]
|
||||||
|
cmp r12, #-960
|
||||||
|
beq 4f
|
||||||
|
push {r4-r11,lr}
|
||||||
|
add r5, sp, #40
|
||||||
|
movrel r4, X(ff_ac3_bin_to_band_tab)
|
||||||
|
movrel lr, X(ff_ac3_band_start_tab)
|
||||||
|
ldm r5, {r5-r7}
|
||||||
|
ldrb r4, [r4, r2]
|
||||||
|
add r1, r1, r2, lsl #1 @ psd + start
|
||||||
|
add r0, r0, r4, lsl #1 @ mask + band
|
||||||
|
add r4, lr, r4
|
||||||
|
add r7, r7, r2 @ bap + start
|
||||||
|
ldrb r10, [r4], #1
|
||||||
|
1:
|
||||||
|
ldrsh r9, [r0], #2 @ mask[band]
|
||||||
|
movw r8, #0x1fe0
|
||||||
|
sub r9, r9, r12 @ - snr_offset
|
||||||
|
mov r11, r10
|
||||||
|
ldrb r10, [r4], #1 @ band_start_tab[band++]
|
||||||
|
subs r9, r9, r5 @ - floor
|
||||||
|
movlt r9, #0
|
||||||
|
cmp r10, r3 @ - end
|
||||||
|
and r9, r9, r8 @ & 0x1fe0
|
||||||
|
subgt r8, r3, r11
|
||||||
|
suble r8, r10, r11
|
||||||
|
add r9, r9, r5 @ + floor => m
|
||||||
|
tst r8, #1
|
||||||
|
add r2, r7, r8
|
||||||
|
bne 3f
|
||||||
|
b 5f
|
||||||
|
2:
|
||||||
|
ldrsh r8, [r1], #2
|
||||||
|
ldrsh lr, [r1], #2
|
||||||
|
sub r8, r8, r9
|
||||||
|
sub lr, lr, r9
|
||||||
|
usat r8, #6, r8, asr #5 @ address
|
||||||
|
usat lr, #6, lr, asr #5
|
||||||
|
ldrb r8, [r6, r8] @ bap_tab[address]
|
||||||
|
ldrb lr, [r6, lr]
|
||||||
|
strb r8, [r7], #1 @ bap[bin]
|
||||||
|
strb lr, [r7], #1
|
||||||
|
5: cmp r7, r2
|
||||||
|
blo 2b
|
||||||
|
cmp r3, r11
|
||||||
|
bgt 1b
|
||||||
|
pop {r4-r11,pc}
|
||||||
|
3:
|
||||||
|
ldrsh r8, [r1], #2 @ psd[bin]
|
||||||
|
sub r8, r8, r9 @ - m
|
||||||
|
usat r8, #6, r8, asr #5 @ address
|
||||||
|
ldrb r8, [r6, r8] @ bap_tab[address]
|
||||||
|
strb r8, [r7], #1 @ bap[bin]
|
||||||
|
b 5b
|
||||||
|
4:
|
||||||
|
ldr r0, [sp, #12]
|
||||||
|
mov r1, #0
|
||||||
|
mov r2, #256
|
||||||
|
b memset
|
||||||
|
endfunc
|
@ -29,8 +29,21 @@ void ff_ac3_lshift_int16_neon(int16_t *src, unsigned len, unsigned shift);
|
|||||||
void ff_ac3_rshift_int32_neon(int32_t *src, unsigned len, unsigned shift);
|
void ff_ac3_rshift_int32_neon(int32_t *src, unsigned len, unsigned shift);
|
||||||
void ff_float_to_fixed24_neon(int32_t *dst, const float *src, unsigned int len);
|
void ff_float_to_fixed24_neon(int32_t *dst, const float *src, unsigned int len);
|
||||||
|
|
||||||
|
void ff_ac3_bit_alloc_calc_bap_armv6(int16_t *mask, int16_t *psd,
|
||||||
|
int start, int end,
|
||||||
|
int snr_offset, int floor,
|
||||||
|
const uint8_t *bap_tab, uint8_t *bap);
|
||||||
|
|
||||||
|
int ff_ac3_compute_mantissa_size_arm(int cnt[5], uint8_t *bap, int nb_coefs);
|
||||||
|
|
||||||
av_cold void ff_ac3dsp_init_arm(AC3DSPContext *c, int bit_exact)
|
av_cold void ff_ac3dsp_init_arm(AC3DSPContext *c, int bit_exact)
|
||||||
{
|
{
|
||||||
|
c->compute_mantissa_size = ff_ac3_compute_mantissa_size_arm;
|
||||||
|
|
||||||
|
if (HAVE_ARMV6) {
|
||||||
|
c->bit_alloc_calc_bap = ff_ac3_bit_alloc_calc_bap_armv6;
|
||||||
|
}
|
||||||
|
|
||||||
if (HAVE_NEON) {
|
if (HAVE_NEON) {
|
||||||
c->ac3_exponent_min = ff_ac3_exponent_min_neon;
|
c->ac3_exponent_min = ff_ac3_exponent_min_neon;
|
||||||
c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_neon;
|
c->ac3_max_msb_abs_int16 = ff_ac3_max_msb_abs_int16_neon;
|
||||||
|
20
libavcodec/fft-fixed-test.c
Normal file
20
libavcodec/fft-fixed-test.c
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of FFmpeg.
|
||||||
|
*
|
||||||
|
* FFMpeg is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* FFMpeg is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with FFmpeg; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#define CONFIG_FFT_FLOAT 0
|
||||||
|
#include "fft-test.c"
|
@ -27,8 +27,10 @@
|
|||||||
#include "libavutil/lfg.h"
|
#include "libavutil/lfg.h"
|
||||||
#include "libavutil/log.h"
|
#include "libavutil/log.h"
|
||||||
#include "fft.h"
|
#include "fft.h"
|
||||||
|
#if CONFIG_FFT_FLOAT
|
||||||
#include "dct.h"
|
#include "dct.h"
|
||||||
#include "rdft.h"
|
#include "rdft.h"
|
||||||
|
#endif
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
@ -47,7 +49,19 @@
|
|||||||
pim += (MUL16(are, bim) + MUL16(bre, aim));\
|
pim += (MUL16(are, bim) + MUL16(bre, aim));\
|
||||||
}
|
}
|
||||||
|
|
||||||
FFTComplex *exptab;
|
#if CONFIG_FFT_FLOAT
|
||||||
|
# define RANGE 1.0
|
||||||
|
# define REF_SCALE(x, bits) (x)
|
||||||
|
# define FMT "%10.6f"
|
||||||
|
#else
|
||||||
|
# define RANGE 16384
|
||||||
|
# define REF_SCALE(x, bits) ((x) / (1<<(bits)))
|
||||||
|
# define FMT "%6d"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct {
|
||||||
|
float re, im;
|
||||||
|
} *exptab;
|
||||||
|
|
||||||
static void fft_ref_init(int nbits, int inverse)
|
static void fft_ref_init(int nbits, int inverse)
|
||||||
{
|
{
|
||||||
@ -55,7 +69,7 @@ static void fft_ref_init(int nbits, int inverse)
|
|||||||
double c1, s1, alpha;
|
double c1, s1, alpha;
|
||||||
|
|
||||||
n = 1 << nbits;
|
n = 1 << nbits;
|
||||||
exptab = av_malloc((n / 2) * sizeof(FFTComplex));
|
exptab = av_malloc((n / 2) * sizeof(*exptab));
|
||||||
|
|
||||||
for (i = 0; i < (n/2); i++) {
|
for (i = 0; i < (n/2); i++) {
|
||||||
alpha = 2 * M_PI * (float)i / (float)n;
|
alpha = 2 * M_PI * (float)i / (float)n;
|
||||||
@ -92,12 +106,12 @@ static void fft_ref(FFTComplex *tabr, FFTComplex *tab, int nbits)
|
|||||||
CMAC(tmp_re, tmp_im, c, s, q->re, q->im);
|
CMAC(tmp_re, tmp_im, c, s, q->re, q->im);
|
||||||
q++;
|
q++;
|
||||||
}
|
}
|
||||||
tabr[i].re = tmp_re;
|
tabr[i].re = REF_SCALE(tmp_re, nbits);
|
||||||
tabr[i].im = tmp_im;
|
tabr[i].im = REF_SCALE(tmp_im, nbits);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void imdct_ref(float *out, float *in, int nbits)
|
static void imdct_ref(FFTSample *out, FFTSample *in, int nbits)
|
||||||
{
|
{
|
||||||
int n = 1<<nbits;
|
int n = 1<<nbits;
|
||||||
int k, i, a;
|
int k, i, a;
|
||||||
@ -110,12 +124,12 @@ static void imdct_ref(float *out, float *in, int nbits)
|
|||||||
f = cos(M_PI * a / (double)(2 * n));
|
f = cos(M_PI * a / (double)(2 * n));
|
||||||
sum += f * in[k];
|
sum += f * in[k];
|
||||||
}
|
}
|
||||||
out[i] = -sum;
|
out[i] = REF_SCALE(-sum, nbits - 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* NOTE: no normalisation by 1 / N is done */
|
/* NOTE: no normalisation by 1 / N is done */
|
||||||
static void mdct_ref(float *output, float *input, int nbits)
|
static void mdct_ref(FFTSample *output, FFTSample *input, int nbits)
|
||||||
{
|
{
|
||||||
int n = 1<<nbits;
|
int n = 1<<nbits;
|
||||||
int k, i;
|
int k, i;
|
||||||
@ -128,10 +142,11 @@ static void mdct_ref(float *output, float *input, int nbits)
|
|||||||
a = (2*M_PI*(2*i+1+n/2)*(2*k+1) / (4 * n));
|
a = (2*M_PI*(2*i+1+n/2)*(2*k+1) / (4 * n));
|
||||||
s += input[i] * cos(a);
|
s += input[i] * cos(a);
|
||||||
}
|
}
|
||||||
output[k] = s;
|
output[k] = REF_SCALE(s, nbits - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_FFT_FLOAT
|
||||||
static void idct_ref(float *output, float *input, int nbits)
|
static void idct_ref(float *output, float *input, int nbits)
|
||||||
{
|
{
|
||||||
int n = 1<<nbits;
|
int n = 1<<nbits;
|
||||||
@ -164,11 +179,12 @@ static void dct_ref(float *output, float *input, int nbits)
|
|||||||
output[k] = s;
|
output[k] = s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static float frandom(AVLFG *prng)
|
static FFTSample frandom(AVLFG *prng)
|
||||||
{
|
{
|
||||||
return (int16_t)av_lfg_get(prng) / 32768.0;
|
return (int16_t)av_lfg_get(prng) / 32768.0 * RANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int64_t gettime(void)
|
static int64_t gettime(void)
|
||||||
@ -178,7 +194,7 @@ static int64_t gettime(void)
|
|||||||
return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec;
|
return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int check_diff(float *tab1, float *tab2, int n, double scale)
|
static int check_diff(FFTSample *tab1, FFTSample *tab2, int n, double scale)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
double max= 0;
|
double max= 0;
|
||||||
@ -186,9 +202,9 @@ static int check_diff(float *tab1, float *tab2, int n, double scale)
|
|||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
double e= fabsf(tab1[i] - (tab2[i] / scale));
|
double e = fabsf(tab1[i] - (tab2[i] / scale)) / RANGE;
|
||||||
if (e >= 1e-3) {
|
if (e >= 1e-3) {
|
||||||
av_log(NULL, AV_LOG_ERROR, "ERROR %5d: %10.6f %10.6f\n",
|
av_log(NULL, AV_LOG_ERROR, "ERROR %5d: "FMT" "FMT"\n",
|
||||||
i, tab1[i], tab2[i]);
|
i, tab1[i], tab2[i]);
|
||||||
err = 1;
|
err = 1;
|
||||||
}
|
}
|
||||||
@ -233,8 +249,10 @@ int main(int argc, char **argv)
|
|||||||
int do_inverse = 0;
|
int do_inverse = 0;
|
||||||
FFTContext s1, *s = &s1;
|
FFTContext s1, *s = &s1;
|
||||||
FFTContext m1, *m = &m1;
|
FFTContext m1, *m = &m1;
|
||||||
|
#if CONFIG_FFT_FLOAT
|
||||||
RDFTContext r1, *r = &r1;
|
RDFTContext r1, *r = &r1;
|
||||||
DCTContext d1, *d = &d1;
|
DCTContext d1, *d = &d1;
|
||||||
|
#endif
|
||||||
int fft_nbits, fft_size, fft_size_2;
|
int fft_nbits, fft_size, fft_size_2;
|
||||||
double scale = 1.0;
|
double scale = 1.0;
|
||||||
AVLFG prng;
|
AVLFG prng;
|
||||||
@ -297,6 +315,7 @@ int main(int argc, char **argv)
|
|||||||
ff_fft_init(s, fft_nbits, do_inverse);
|
ff_fft_init(s, fft_nbits, do_inverse);
|
||||||
fft_ref_init(fft_nbits, do_inverse);
|
fft_ref_init(fft_nbits, do_inverse);
|
||||||
break;
|
break;
|
||||||
|
#if CONFIG_FFT_FLOAT
|
||||||
case TRANSFORM_RDFT:
|
case TRANSFORM_RDFT:
|
||||||
if (do_inverse)
|
if (do_inverse)
|
||||||
av_log(NULL, AV_LOG_INFO,"IDFT_C2R");
|
av_log(NULL, AV_LOG_INFO,"IDFT_C2R");
|
||||||
@ -312,6 +331,10 @@ int main(int argc, char **argv)
|
|||||||
av_log(NULL, AV_LOG_INFO,"DCT_II");
|
av_log(NULL, AV_LOG_INFO,"DCT_II");
|
||||||
ff_dct_init(d, fft_nbits, do_inverse ? DCT_III : DCT_II);
|
ff_dct_init(d, fft_nbits, do_inverse ? DCT_III : DCT_II);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
default:
|
||||||
|
av_log(NULL, AV_LOG_ERROR, "Requested transform not supported\n");
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
av_log(NULL, AV_LOG_INFO," %d test\n", fft_size);
|
av_log(NULL, AV_LOG_INFO," %d test\n", fft_size);
|
||||||
|
|
||||||
@ -328,15 +351,15 @@ int main(int argc, char **argv)
|
|||||||
switch (transform) {
|
switch (transform) {
|
||||||
case TRANSFORM_MDCT:
|
case TRANSFORM_MDCT:
|
||||||
if (do_inverse) {
|
if (do_inverse) {
|
||||||
imdct_ref((float *)tab_ref, (float *)tab1, fft_nbits);
|
imdct_ref((FFTSample *)tab_ref, (FFTSample *)tab1, fft_nbits);
|
||||||
m->imdct_calc(m, tab2, (float *)tab1);
|
m->imdct_calc(m, tab2, (FFTSample *)tab1);
|
||||||
err = check_diff((float *)tab_ref, tab2, fft_size, scale);
|
err = check_diff((FFTSample *)tab_ref, tab2, fft_size, scale);
|
||||||
} else {
|
} else {
|
||||||
mdct_ref((float *)tab_ref, (float *)tab1, fft_nbits);
|
mdct_ref((FFTSample *)tab_ref, (FFTSample *)tab1, fft_nbits);
|
||||||
|
|
||||||
m->mdct_calc(m, tab2, (float *)tab1);
|
m->mdct_calc(m, tab2, (FFTSample *)tab1);
|
||||||
|
|
||||||
err = check_diff((float *)tab_ref, tab2, fft_size / 2, scale);
|
err = check_diff((FFTSample *)tab_ref, tab2, fft_size / 2, scale);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TRANSFORM_FFT:
|
case TRANSFORM_FFT:
|
||||||
@ -345,8 +368,9 @@ int main(int argc, char **argv)
|
|||||||
s->fft_calc(s, tab);
|
s->fft_calc(s, tab);
|
||||||
|
|
||||||
fft_ref(tab_ref, tab1, fft_nbits);
|
fft_ref(tab_ref, tab1, fft_nbits);
|
||||||
err = check_diff((float *)tab_ref, (float *)tab, fft_size * 2, 1.0);
|
err = check_diff((FFTSample *)tab_ref, (FFTSample *)tab, fft_size * 2, 1.0);
|
||||||
break;
|
break;
|
||||||
|
#if CONFIG_FFT_FLOAT
|
||||||
case TRANSFORM_RDFT:
|
case TRANSFORM_RDFT:
|
||||||
if (do_inverse) {
|
if (do_inverse) {
|
||||||
tab1[ 0].im = 0;
|
tab1[ 0].im = 0;
|
||||||
@ -387,6 +411,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
err = check_diff((float *)tab_ref, (float *)tab, fft_size, 1.0);
|
err = check_diff((float *)tab_ref, (float *)tab, fft_size, 1.0);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* do a speed test */
|
/* do a speed test */
|
||||||
@ -404,15 +429,16 @@ int main(int argc, char **argv)
|
|||||||
switch (transform) {
|
switch (transform) {
|
||||||
case TRANSFORM_MDCT:
|
case TRANSFORM_MDCT:
|
||||||
if (do_inverse) {
|
if (do_inverse) {
|
||||||
m->imdct_calc(m, (float *)tab, (float *)tab1);
|
m->imdct_calc(m, (FFTSample *)tab, (FFTSample *)tab1);
|
||||||
} else {
|
} else {
|
||||||
m->mdct_calc(m, (float *)tab, (float *)tab1);
|
m->mdct_calc(m, (FFTSample *)tab, (FFTSample *)tab1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TRANSFORM_FFT:
|
case TRANSFORM_FFT:
|
||||||
memcpy(tab, tab1, fft_size * sizeof(FFTComplex));
|
memcpy(tab, tab1, fft_size * sizeof(FFTComplex));
|
||||||
s->fft_calc(s, tab);
|
s->fft_calc(s, tab);
|
||||||
break;
|
break;
|
||||||
|
#if CONFIG_FFT_FLOAT
|
||||||
case TRANSFORM_RDFT:
|
case TRANSFORM_RDFT:
|
||||||
memcpy(tab2, tab1, fft_size * sizeof(FFTSample));
|
memcpy(tab2, tab1, fft_size * sizeof(FFTSample));
|
||||||
r->rdft_calc(r, tab2);
|
r->rdft_calc(r, tab2);
|
||||||
@ -421,6 +447,7 @@ int main(int argc, char **argv)
|
|||||||
memcpy(tab2, tab1, fft_size * sizeof(FFTSample));
|
memcpy(tab2, tab1, fft_size * sizeof(FFTSample));
|
||||||
d->dct_calc(d, tab2);
|
d->dct_calc(d, tab2);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
duration = gettime() - time_start;
|
duration = gettime() - time_start;
|
||||||
@ -441,12 +468,14 @@ int main(int argc, char **argv)
|
|||||||
case TRANSFORM_FFT:
|
case TRANSFORM_FFT:
|
||||||
ff_fft_end(s);
|
ff_fft_end(s);
|
||||||
break;
|
break;
|
||||||
|
#if CONFIG_FFT_FLOAT
|
||||||
case TRANSFORM_RDFT:
|
case TRANSFORM_RDFT:
|
||||||
ff_rdft_end(r);
|
ff_rdft_end(r);
|
||||||
break;
|
break;
|
||||||
case TRANSFORM_DCT:
|
case TRANSFORM_DCT:
|
||||||
ff_dct_end(d);
|
ff_dct_end(d);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
av_free(tab);
|
av_free(tab);
|
||||||
|
@ -246,21 +246,16 @@ static void fft4(FFTComplex *z)
|
|||||||
|
|
||||||
static void fft8(FFTComplex *z)
|
static void fft8(FFTComplex *z)
|
||||||
{
|
{
|
||||||
FFTDouble t1, t2, t3, t4, t5, t6, t7, t8;
|
FFTDouble t1, t2, t3, t4, t5, t6;
|
||||||
|
|
||||||
fft4(z);
|
fft4(z);
|
||||||
|
|
||||||
BF(t1, z[5].re, z[4].re, -z[5].re);
|
BF(t1, z[5].re, z[4].re, -z[5].re);
|
||||||
BF(t2, z[5].im, z[4].im, -z[5].im);
|
BF(t2, z[5].im, z[4].im, -z[5].im);
|
||||||
BF(t3, z[7].re, z[6].re, -z[7].re);
|
BF(t5, z[7].re, z[6].re, -z[7].re);
|
||||||
BF(t4, z[7].im, z[6].im, -z[7].im);
|
BF(t6, z[7].im, z[6].im, -z[7].im);
|
||||||
BF(t8, t1, t3, t1);
|
|
||||||
BF(t7, t2, t2, t4);
|
|
||||||
BF(z[4].re, z[0].re, z[0].re, t1);
|
|
||||||
BF(z[4].im, z[0].im, z[0].im, t2);
|
|
||||||
BF(z[6].re, z[2].re, z[2].re, t7);
|
|
||||||
BF(z[6].im, z[2].im, z[2].im, t8);
|
|
||||||
|
|
||||||
|
BUTTERFLIES(z[0],z[2],z[4],z[6]);
|
||||||
TRANSFORM(z[1],z[3],z[5],z[7],sqrthalf,sqrthalf);
|
TRANSFORM(z[1],z[3],z[5],z[7],sqrthalf,sqrthalf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,6 +250,11 @@ static int ape_read_header(AVFormatContext * s, AVFormatParameters * ap)
|
|||||||
av_log(s, AV_LOG_ERROR, "Too many frames: %d\n", ape->totalframes);
|
av_log(s, AV_LOG_ERROR, "Too many frames: %d\n", ape->totalframes);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
if (ape->seektablelength && (ape->seektablelength / sizeof(*ape->seektable)) < ape->totalframes) {
|
||||||
|
av_log(s, AV_LOG_ERROR, "Number of seek entries is less than number of frames: %d vs. %d\n",
|
||||||
|
ape->seektablelength / sizeof(*ape->seektable), ape->totalframes);
|
||||||
|
return AVERROR_INVALIDDATA;
|
||||||
|
}
|
||||||
ape->frames = av_malloc(ape->totalframes * sizeof(APEFrame));
|
ape->frames = av_malloc(ape->totalframes * sizeof(APEFrame));
|
||||||
if(!ape->frames)
|
if(!ape->frames)
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
@ -454,6 +454,22 @@ attribute_deprecated void init_checksum(AVIOContext *s,
|
|||||||
attribute_deprecated unsigned long get_checksum(AVIOContext *s);
|
attribute_deprecated unsigned long get_checksum(AVIOContext *s);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Allocate and initialize an AVIOContext for buffered I/O. It must be later
|
||||||
|
* freed with av_free().
|
||||||
|
*
|
||||||
|
* @param buffer Memory block for input/output operations via AVIOContext.
|
||||||
|
* @param buffer_size The buffer size is very important for performance.
|
||||||
|
* For protocols with fixed blocksize it should be set to this blocksize.
|
||||||
|
* For others a typical size is a cache page, e.g. 4kb.
|
||||||
|
* @param write_flag Set to 1 if the buffer should be writable, 0 otherwise.
|
||||||
|
* @param opaque An opaque pointer to user-specific data.
|
||||||
|
* @param read_packet A function for refilling the buffer, may be NULL.
|
||||||
|
* @param write_packet A function for writing the buffer contents, may be NULL.
|
||||||
|
* @param seek A function for seeking to specified byte position, may be NULL.
|
||||||
|
*
|
||||||
|
* @return Allocated AVIOContext or NULL on failure.
|
||||||
|
*/
|
||||||
AVIOContext *avio_alloc_context(
|
AVIOContext *avio_alloc_context(
|
||||||
unsigned char *buffer,
|
unsigned char *buffer,
|
||||||
int buffer_size,
|
int buffer_size,
|
||||||
|
@ -99,7 +99,7 @@ static int vmd_read_header(AVFormatContext *s,
|
|||||||
if (avio_read(pb, vmd->vmd_header, VMD_HEADER_SIZE) != VMD_HEADER_SIZE)
|
if (avio_read(pb, vmd->vmd_header, VMD_HEADER_SIZE) != VMD_HEADER_SIZE)
|
||||||
return AVERROR(EIO);
|
return AVERROR(EIO);
|
||||||
|
|
||||||
if(vmd->vmd_header[16] == 'i' && vmd->vmd_header[17] == 'v' && vmd->vmd_header[18] == '3')
|
if(vmd->vmd_header[24] == 'i' && vmd->vmd_header[25] == 'v' && vmd->vmd_header[26] == '3')
|
||||||
vmd->is_indeo3 = 1;
|
vmd->is_indeo3 = 1;
|
||||||
else
|
else
|
||||||
vmd->is_indeo3 = 0;
|
vmd->is_indeo3 = 0;
|
||||||
@ -249,7 +249,7 @@ static int vmd_read_packet(AVFormatContext *s,
|
|||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
pkt->pos= avio_tell(pb);
|
pkt->pos= avio_tell(pb);
|
||||||
memcpy(pkt->data, frame->frame_record, BYTES_PER_FRAME_RECORD);
|
memcpy(pkt->data, frame->frame_record, BYTES_PER_FRAME_RECORD);
|
||||||
if(vmd->is_indeo3)
|
if(vmd->is_indeo3 && frame->frame_record[0] == 0x02)
|
||||||
ret = avio_read(pb, pkt->data, frame->frame_size);
|
ret = avio_read(pb, pkt->data, frame->frame_size);
|
||||||
else
|
else
|
||||||
ret = avio_read(pb, pkt->data + BYTES_PER_FRAME_RECORD,
|
ret = avio_read(pb, pkt->data + BYTES_PER_FRAME_RECORD,
|
||||||
|
@ -2168,21 +2168,22 @@ enum CodecID av_codec_get_id(const AVCodecTag * const *tags, unsigned int tag)
|
|||||||
|
|
||||||
static void compute_chapters_end(AVFormatContext *s)
|
static void compute_chapters_end(AVFormatContext *s)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i, j;
|
||||||
|
int64_t max_time = s->duration + (s->start_time == AV_NOPTS_VALUE) ? 0 : s->start_time;
|
||||||
|
|
||||||
for (i=0; i+1<s->nb_chapters; i++)
|
for (i = 0; i < s->nb_chapters; i++)
|
||||||
if (s->chapters[i]->end == AV_NOPTS_VALUE) {
|
if (s->chapters[i]->end == AV_NOPTS_VALUE) {
|
||||||
assert(s->chapters[i]->start <= s->chapters[i+1]->start);
|
AVChapter *ch = s->chapters[i];
|
||||||
assert(!av_cmp_q(s->chapters[i]->time_base, s->chapters[i+1]->time_base));
|
int64_t end = max_time ? av_rescale_q(max_time, AV_TIME_BASE_Q, ch->time_base)
|
||||||
s->chapters[i]->end = s->chapters[i+1]->start;
|
: INT64_MAX;
|
||||||
}
|
|
||||||
|
|
||||||
if (s->nb_chapters && s->chapters[i]->end == AV_NOPTS_VALUE) {
|
for (j = 0; j < s->nb_chapters; j++) {
|
||||||
assert(s->start_time != AV_NOPTS_VALUE);
|
AVChapter *ch1 = s->chapters[j];
|
||||||
assert(s->duration > 0);
|
int64_t next_start = av_rescale_q(ch1->start, ch1->time_base, ch->time_base);
|
||||||
s->chapters[i]->end = av_rescale_q(s->start_time + s->duration,
|
if (j != i && next_start > ch->start && next_start < end)
|
||||||
AV_TIME_BASE_Q,
|
end = next_start;
|
||||||
s->chapters[i]->time_base);
|
}
|
||||||
|
ch->end = (end == INT64_MAX) ? ch->start : end;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,35 +1,31 @@
|
|||||||
FATE_FFT += fate-fft
|
FATE_FFT = fate-fft fate-ifft \
|
||||||
fate-fft: libavcodec/fft-test$(EXESUF)
|
fate-mdct fate-imdct \
|
||||||
|
fate-rdft fate-irdft \
|
||||||
|
fate-dct1d fate-idct1d
|
||||||
|
|
||||||
fate-fft: CMD = run libavcodec/fft-test
|
fate-fft: CMD = run libavcodec/fft-test
|
||||||
|
|
||||||
FATE_FFT += fate-ifft
|
|
||||||
fate-ifft: libavcodec/fft-test$(EXESUF)
|
|
||||||
fate-ifft: CMD = run libavcodec/fft-test -i
|
fate-ifft: CMD = run libavcodec/fft-test -i
|
||||||
|
|
||||||
FATE_FFT += fate-mdct
|
|
||||||
fate-mdct: libavcodec/fft-test$(EXESUF)
|
|
||||||
fate-mdct: CMD = run libavcodec/fft-test -m
|
fate-mdct: CMD = run libavcodec/fft-test -m
|
||||||
|
|
||||||
FATE_FFT += fate-imdct
|
|
||||||
fate-imdct: libavcodec/fft-test$(EXESUF)
|
|
||||||
fate-imdct: CMD = run libavcodec/fft-test -m -i
|
fate-imdct: CMD = run libavcodec/fft-test -m -i
|
||||||
|
|
||||||
FATE_FFT += fate-rdft
|
|
||||||
fate-rdft: libavcodec/fft-test$(EXESUF)
|
|
||||||
fate-rdft: CMD = run libavcodec/fft-test -r
|
fate-rdft: CMD = run libavcodec/fft-test -r
|
||||||
|
|
||||||
FATE_FFT += fate-irdft
|
|
||||||
fate-irdft: libavcodec/fft-test$(EXESUF)
|
|
||||||
fate-irdft: CMD = run libavcodec/fft-test -r -i
|
fate-irdft: CMD = run libavcodec/fft-test -r -i
|
||||||
|
|
||||||
FATE_FFT += fate-dct1d
|
|
||||||
fate-dct1d: libavcodec/fft-test$(EXESUF)
|
|
||||||
fate-dct1d: CMD = run libavcodec/fft-test -d
|
fate-dct1d: CMD = run libavcodec/fft-test -d
|
||||||
|
|
||||||
FATE_FFT += fate-idct1d
|
|
||||||
fate-idct1d: libavcodec/fft-test$(EXESUF)
|
|
||||||
fate-idct1d: CMD = run libavcodec/fft-test -d -i
|
fate-idct1d: CMD = run libavcodec/fft-test -d -i
|
||||||
|
|
||||||
FATE_TESTS += $(FATE_FFT)
|
|
||||||
fate-fft-test: $(FATE_FFT)
|
fate-fft-test: $(FATE_FFT)
|
||||||
|
$(FATE_FFT): libavcodec/fft-test$(EXESUF)
|
||||||
$(FATE_FFT): REF = /dev/null
|
$(FATE_FFT): REF = /dev/null
|
||||||
|
|
||||||
|
FATE_FFT_FIXED = fate-fft-fixed fate-ifft-fixed \
|
||||||
|
fate-mdct-fixed fate-imdct-fixed
|
||||||
|
|
||||||
|
fate-fft-fixed: CMD = run libavcodec/fft-fixed-test
|
||||||
|
fate-ifft-fixed: CMD = run libavcodec/fft-fixed-test -i
|
||||||
|
fate-mdct-fixed: CMD = run libavcodec/fft-fixed-test -m
|
||||||
|
fate-imdct-fixed: CMD = run libavcodec/fft-fixed-test -m -i
|
||||||
|
|
||||||
|
fate-fft-fixed-test: $(FATE_FFT_FIXED)
|
||||||
|
$(FATE_FFT_FIXED): libavcodec/fft-fixed-test$(EXESUF)
|
||||||
|
$(FATE_FFT_FIXED): REF = /dev/null
|
||||||
|
|
||||||
|
FATE_TESTS += $(FATE_FFT) $(FATE_FFT_FIXED)
|
||||||
|
Loading…
Reference in New Issue
Block a user