* qatar/master:
Fix compilation of iirfilter-test.
libx264: handle closed GOP codec flag
lavf: remove duplicate assignment in avformat_alloc_context.
lavf: use designated initializers for AVClasses.
flvdec: clenup debug code
asfdec: fix possible overread on broken files.
asfdec: do not fall back to binary/generic search
asfdec: reindent after previous commit c7bd5ed
asfdec: fallback to binary search internally
mpegaudio: add _fixed suffix to some names
Modify x86util.asm to ease transitioning to 10-bit H.264 assembly.
dct: build dct32 as separate object files
qdm2: include correct header for rdft
Conflicts:
ffpresets/libx264-fast.ffpreset
ffpresets/libx264-fast_firstpass.ffpreset
ffpresets/libx264-faster.ffpreset
ffpresets/libx264-faster_firstpass.ffpreset
ffpresets/libx264-medium.ffpreset
ffpresets/libx264-medium_firstpass.ffpreset
ffpresets/libx264-placebo.ffpreset
ffpresets/libx264-placebo_firstpass.ffpreset
ffpresets/libx264-slow.ffpreset
ffpresets/libx264-slow_firstpass.ffpreset
ffpresets/libx264-slower.ffpreset
ffpresets/libx264-slower_firstpass.ffpreset
ffpresets/libx264-superfast.ffpreset
ffpresets/libx264-superfast_firstpass.ffpreset
ffpresets/libx264-ultrafast.ffpreset
ffpresets/libx264-ultrafast_firstpass.ffpreset
ffpresets/libx264-veryfast.ffpreset
ffpresets/libx264-veryfast_firstpass.ffpreset
ffpresets/libx264-veryslow.ffpreset
ffpresets/libx264-veryslow_firstpass.ffpreset
libavformat/flvdec.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
tags/n0.8
@@ -2927,8 +2927,8 @@ enabled libvpx && { | |||||
enabled libvpx_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VPX_CQ" -lvpx || | enabled libvpx_encoder && { check_lib2 "vpx/vpx_encoder.h vpx/vp8cx.h" "vpx_codec_enc_init_ver VPX_CQ" -lvpx || | ||||
die "ERROR: libvpx encoder version must be >=0.9.6"; } } | die "ERROR: libvpx encoder version must be >=0.9.6"; } } | ||||
enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 && | enabled libx264 && require libx264 x264.h x264_encoder_encode -lx264 && | ||||
{ check_cpp_condition x264.h "X264_BUILD >= 99" || | |||||
die "ERROR: libx264 version must be >= 0.99."; } | |||||
{ check_cpp_condition x264.h "X264_BUILD >= 115" || | |||||
die "ERROR: libx264 version must be >= 0.115."; } | |||||
enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs | enabled libxavs && require libxavs xavs.h xavs_encoder_encode -lxavs | ||||
enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore | enabled libxvid && require libxvid xvid.h xvid_global -lxvidcore | ||||
enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib | enabled mlib && require mediaLib mlib_types.h mlib_VectorSub_S16_U8_Mod -lmlib | ||||
@@ -1,5 +1,5 @@ | |||||
coder=0 | coder=0 | ||||
flags=+loop | |||||
flags=+loop+cgop | |||||
cmp=+chroma | cmp=+chroma | ||||
partitions=-parti8x8+parti4x4+partp8x8-partp4x4-partb8x8 | partitions=-parti8x8+parti4x4+partp8x8-partp4x4-partb8x8 | ||||
me_method=hex | me_method=hex | ||||
@@ -1,5 +1,5 @@ | |||||
coder=1 | coder=1 | ||||
flags=+loop | |||||
flags=+loop+cgop | |||||
cmp=+chroma | cmp=+chroma | ||||
partitions=+parti8x8+parti4x4+partp8x8+partp4x4-partb8x8 | partitions=+parti8x8+parti4x4+partp8x8+partp4x4-partb8x8 | ||||
me_method=esa | me_method=esa | ||||
@@ -1,5 +1,5 @@ | |||||
coder=1 | coder=1 | ||||
flags=+loop | |||||
flags=+loop+cgop | |||||
cmp=+chroma | cmp=+chroma | ||||
partitions=-parti8x8+parti4x4+partp8x8+partp4x4-partb8x8 | partitions=-parti8x8+parti4x4+partp8x8+partp4x4-partb8x8 | ||||
me_method=hex | me_method=hex | ||||
@@ -1,5 +1,5 @@ | |||||
coder=1 | coder=1 | ||||
flags=+loop | |||||
flags=+loop+cgop | |||||
cmp=+chroma | cmp=+chroma | ||||
partitions=+parti8x8+parti4x4+partp8x8+partp4x4-partb8x8 | partitions=+parti8x8+parti4x4+partp8x8+partp4x4-partb8x8 | ||||
me_method=umh | me_method=umh | ||||
@@ -1,5 +1,5 @@ | |||||
coder=1 | coder=1 | ||||
flags=+loop | |||||
flags=+loop+cgop | |||||
cmp=+chroma | cmp=+chroma | ||||
partitions=+parti8x8+parti4x4+partp8x8+partp4x4-partb8x8 | partitions=+parti8x8+parti4x4+partp8x8+partp4x4-partb8x8 | ||||
me_method=umh | me_method=umh | ||||
@@ -1,5 +1,5 @@ | |||||
coder=0 | coder=0 | ||||
flags=+loop | |||||
flags=+loop+cgop | |||||
cmp=+chroma | cmp=+chroma | ||||
partitions=-parti8x8-parti4x4-partp8x8-partp4x4-partb8x8 | partitions=-parti8x8-parti4x4-partp8x8-partp4x4-partb8x8 | ||||
me_method=dia | me_method=dia | ||||
@@ -28,7 +28,7 @@ OBJS-$(CONFIG_AANDCT) += aandcttab.o | |||||
OBJS-$(CONFIG_AC3DSP) += ac3dsp.o | OBJS-$(CONFIG_AC3DSP) += ac3dsp.o | ||||
OBJS-$(CONFIG_CRYSTALHD) += crystalhd.o | OBJS-$(CONFIG_CRYSTALHD) += crystalhd.o | ||||
OBJS-$(CONFIG_ENCODERS) += faandct.o jfdctfst.o jfdctint.o | OBJS-$(CONFIG_ENCODERS) += faandct.o jfdctfst.o jfdctint.o | ||||
OBJS-$(CONFIG_DCT) += dct.o | |||||
OBJS-$(CONFIG_DCT) += dct.o dct32_fixed.o dct32_float.o | |||||
OBJS-$(CONFIG_DWT) += dwt.o | OBJS-$(CONFIG_DWT) += dwt.o | ||||
OBJS-$(CONFIG_DXVA2) += dxva2.o | OBJS-$(CONFIG_DXVA2) += dxva2.o | ||||
FFT-OBJS-$(CONFIG_HARDCODED_TABLES) += cos_tables.o cos_fixed_tables.o | FFT-OBJS-$(CONFIG_HARDCODED_TABLES) += cos_tables.o cos_fixed_tables.o | ||||
@@ -30,9 +30,7 @@ | |||||
#include <math.h> | #include <math.h> | ||||
#include "libavutil/mathematics.h" | #include "libavutil/mathematics.h" | ||||
#include "dct.h" | #include "dct.h" | ||||
#define DCT32_FLOAT | |||||
#include "dct32.c" | |||||
#include "dct32.h" | |||||
/* sin((M_PI * x / (2*n)) */ | /* sin((M_PI * x / (2*n)) */ | ||||
#define SIN(s,n,x) (s->costab[(n) - (x)]) | #define SIN(s,n,x) (s->costab[(n) - (x)]) | ||||
@@ -210,7 +208,7 @@ av_cold int ff_dct_init(DCTContext *s, int nbits, enum DCTTransformType inverse) | |||||
} | } | ||||
} | } | ||||
s->dct32 = dct32; | |||||
s->dct32 = ff_dct32_float; | |||||
if (HAVE_MMX) ff_dct_init_mmx(s); | if (HAVE_MMX) ff_dct_init_mmx(s); | ||||
return 0; | return 0; | ||||
@@ -19,10 +19,19 @@ | |||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||||
*/ | */ | ||||
#ifdef DCT32_FLOAT | |||||
#include "dct32.h" | |||||
#include "mathops.h" | |||||
#if DCT32_FLOAT | |||||
# define dct32 ff_dct32_float | |||||
# define FIXHR(x) ((float)(x)) | # define FIXHR(x) ((float)(x)) | ||||
# define MULH3(x, y, s) ((s)*(y)*(x)) | # define MULH3(x, y, s) ((s)*(y)*(x)) | ||||
# define INTFLOAT float | # define INTFLOAT float | ||||
#else | |||||
# define dct32 ff_dct32_fixed | |||||
# define FIXHR(a) ((int)((a) * (1LL<<32) + 0.5)) | |||||
# define MULH3(x, y, s) MULH((s)*(x), y) | |||||
# define INTFLOAT int | |||||
#endif | #endif | ||||
@@ -103,7 +112,7 @@ | |||||
#define ADD(a, b) val##a += val##b | #define ADD(a, b) val##a += val##b | ||||
/* DCT32 without 1/sqrt(2) coef zero scaling. */ | /* DCT32 without 1/sqrt(2) coef zero scaling. */ | ||||
static void dct32(INTFLOAT *out, const INTFLOAT *tab) | |||||
void dct32(INTFLOAT *out, const INTFLOAT *tab) | |||||
{ | { | ||||
INTFLOAT tmp0, tmp1; | INTFLOAT tmp0, tmp1; | ||||
@@ -0,0 +1,25 @@ | |||||
/* | |||||
* 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 | |||||
*/ | |||||
#ifndef AVCODEC_DCT32_H | |||||
#define AVCODEC_DCT32_H | |||||
void ff_dct32_float(float *dst, const float *src); | |||||
void ff_dct32_fixed(int *dst, const int *src); | |||||
#endif |
@@ -0,0 +1,20 @@ | |||||
/* | |||||
* 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 | |||||
*/ | |||||
#define DCT32_FLOAT 0 | |||||
#include "dct32.c" |
@@ -0,0 +1,20 @@ | |||||
/* | |||||
* 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 | |||||
*/ | |||||
#define DCT32_FLOAT 1 | |||||
#include "dct32.c" |
@@ -324,7 +324,7 @@ int main(void) | |||||
int i; | int i; | ||||
FILE* fd; | FILE* fd; | ||||
fcoeffs = ff_iir_filter_init_coeffs(FF_FILTER_TYPE_BUTTERWORTH, | |||||
fcoeffs = ff_iir_filter_init_coeffs(NULL, FF_FILTER_TYPE_BUTTERWORTH, | |||||
FF_FILTER_MODE_LOWPASS, FILT_ORDER, | FF_FILTER_MODE_LOWPASS, FILT_ORDER, | ||||
cutoff_coeff, 0.0, 0.0); | cutoff_coeff, 0.0, 0.0); | ||||
fstate = ff_iir_filter_init_state(FILT_ORDER); | fstate = ff_iir_filter_init_state(FILT_ORDER); | ||||
@@ -367,6 +367,8 @@ static av_cold int X264_init(AVCodecContext *avctx) | |||||
x4->params.b_interlaced = avctx->flags & CODEC_FLAG_INTERLACED_DCT; | x4->params.b_interlaced = avctx->flags & CODEC_FLAG_INTERLACED_DCT; | ||||
x4->params.b_open_gop = !(avctx->flags & CODEC_FLAG_CLOSED_GOP); | |||||
x4->params.i_slice_count = avctx->slices; | x4->params.i_slice_count = avctx->slices; | ||||
x4->params.vui.b_fullrange = avctx->pix_fmt == PIX_FMT_YUVJ420P; | x4->params.vui.b_fullrange = avctx->pix_fmt == PIX_FMT_YUVJ420P; | ||||
@@ -36,7 +36,7 @@ | |||||
void ff_mpc_init(void) | void ff_mpc_init(void) | ||||
{ | { | ||||
ff_mpa_synth_init(ff_mpa_synth_window); | |||||
ff_mpa_synth_init_fixed(ff_mpa_synth_window_fixed); | |||||
} | } | ||||
/** | /** | ||||
@@ -51,8 +51,8 @@ static void mpc_synth(MPCContext *c, int16_t *out, int channels) | |||||
for(ch = 0; ch < channels; ch++){ | for(ch = 0; ch < channels; ch++){ | ||||
samples_ptr = samples + ch; | samples_ptr = samples + ch; | ||||
for(i = 0; i < SAMPLES_PER_BAND; i++) { | for(i = 0; i < SAMPLES_PER_BAND; i++) { | ||||
ff_mpa_synth_filter(c->synth_buf[ch], &(c->synth_buf_offset[ch]), | |||||
ff_mpa_synth_window, &dither_state, | |||||
ff_mpa_synth_filter_fixed(c->synth_buf[ch], &(c->synth_buf_offset[ch]), | |||||
ff_mpa_synth_window_fixed, &dither_state, | |||||
samples_ptr, channels, | samples_ptr, channels, | ||||
c->sb_samples[ch][i]); | c->sb_samples[ch][i]); | ||||
samples_ptr += 32 * channels; | samples_ptr += 32 * channels; | ||||
@@ -158,9 +158,9 @@ typedef struct HuffTable { | |||||
int ff_mpa_l2_select_table(int bitrate, int nb_channels, int freq, int lsf); | int ff_mpa_l2_select_table(int bitrate, int nb_channels, int freq, int lsf); | ||||
int ff_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate, int *channels, int *frame_size, int *bitrate); | int ff_mpa_decode_header(AVCodecContext *avctx, uint32_t head, int *sample_rate, int *channels, int *frame_size, int *bitrate); | ||||
extern MPA_INT ff_mpa_synth_window[]; | |||||
void ff_mpa_synth_init(MPA_INT *window); | |||||
void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, | |||||
extern MPA_INT ff_mpa_synth_window_fixed[]; | |||||
void ff_mpa_synth_init_fixed(MPA_INT *window); | |||||
void ff_mpa_synth_filter_fixed(MPA_INT *synth_buf_ptr, int *synth_buf_offset, | |||||
MPA_INT *window, int *dither_state, | MPA_INT *window, int *dither_state, | ||||
OUT_INT *samples, int incr, | OUT_INT *samples, int incr, | ||||
INTFLOAT sb_samples[SBLIMIT]); | INTFLOAT sb_samples[SBLIMIT]); | ||||
@@ -33,9 +33,9 @@ int main(void) | |||||
WRITE_ARRAY("static const", int8_t, table_4_3_exp); | WRITE_ARRAY("static const", int8_t, table_4_3_exp); | ||||
WRITE_ARRAY("static const", uint32_t, table_4_3_value); | WRITE_ARRAY("static const", uint32_t, table_4_3_value); | ||||
WRITE_ARRAY("static const", uint32_t, exp_table); | |||||
WRITE_ARRAY("static const", uint32_t, exp_table_fixed); | |||||
WRITE_ARRAY("static const", float, exp_table_float); | WRITE_ARRAY("static const", float, exp_table_float); | ||||
WRITE_2D_ARRAY("static const", uint32_t, expval_table); | |||||
WRITE_2D_ARRAY("static const", uint32_t, expval_table_fixed); | |||||
WRITE_2D_ARRAY("static const", float, expval_table_float); | WRITE_2D_ARRAY("static const", float, expval_table_float); | ||||
return 0; | return 0; | ||||
@@ -33,8 +33,8 @@ | |||||
#else | #else | ||||
static int8_t table_4_3_exp[TABLE_4_3_SIZE]; | static int8_t table_4_3_exp[TABLE_4_3_SIZE]; | ||||
static uint32_t table_4_3_value[TABLE_4_3_SIZE]; | static uint32_t table_4_3_value[TABLE_4_3_SIZE]; | ||||
static uint32_t exp_table[512]; | |||||
static uint32_t expval_table[512][16]; | |||||
static uint32_t exp_table_fixed[512]; | |||||
static uint32_t expval_table_fixed[512][16]; | |||||
static float exp_table_float[512]; | static float exp_table_float[512]; | ||||
static float expval_table_float[512][16]; | static float expval_table_float[512][16]; | ||||
@@ -59,10 +59,10 @@ static void mpegaudio_tableinit(void) | |||||
for (exponent = 0; exponent < 512; exponent++) { | for (exponent = 0; exponent < 512; exponent++) { | ||||
for (value = 0; value < 16; value++) { | for (value = 0; value < 16; value++) { | ||||
double f = (double)value * cbrtf(value) * pow(2, (exponent - 400) * 0.25 + FRAC_BITS + 5); | double f = (double)value * cbrtf(value) * pow(2, (exponent - 400) * 0.25 + FRAC_BITS + 5); | ||||
expval_table[exponent][value] = llrint(f); | |||||
expval_table_fixed[exponent][value] = llrint(f); | |||||
expval_table_float[exponent][value] = f; | expval_table_float[exponent][value] = f; | ||||
} | } | ||||
exp_table[exponent] = expval_table[exponent][1]; | |||||
exp_table_fixed[exponent] = expval_table_fixed[exponent][1]; | |||||
exp_table_float[exponent] = expval_table_float[exponent][1]; | exp_table_float[exponent] = expval_table_float[exponent][1]; | ||||
} | } | ||||
} | } | ||||
@@ -29,6 +29,7 @@ | |||||
#include "get_bits.h" | #include "get_bits.h" | ||||
#include "dsputil.h" | #include "dsputil.h" | ||||
#include "mathops.h" | #include "mathops.h" | ||||
#include "dct32.h" | |||||
/* | /* | ||||
* TODO: | * TODO: | ||||
@@ -57,7 +58,7 @@ | |||||
# define FIXHR(a) ((int)((a) * (1LL<<32) + 0.5)) | # define FIXHR(a) ((int)((a) * (1LL<<32) + 0.5)) | ||||
# define MULH3(x, y, s) MULH((s)*(x), y) | # define MULH3(x, y, s) MULH((s)*(x), y) | ||||
# define MULLx(x, y, s) MULL(x,y,s) | # define MULLx(x, y, s) MULL(x,y,s) | ||||
# define RENAME(a) a | |||||
# define RENAME(a) a ## _fixed | |||||
# define OUT_FMT AV_SAMPLE_FMT_S16 | # define OUT_FMT AV_SAMPLE_FMT_S16 | ||||
#endif | #endif | ||||
@@ -68,12 +69,6 @@ | |||||
#include "mpegaudiodata.h" | #include "mpegaudiodata.h" | ||||
#include "mpegaudiodectab.h" | #include "mpegaudiodectab.h" | ||||
#if CONFIG_FLOAT | |||||
# include "fft.h" | |||||
#else | |||||
# include "dct32.c" | |||||
#endif | |||||
static void compute_antialias(MPADecodeContext *s, GranuleDef *g); | static void compute_antialias(MPADecodeContext *s, GranuleDef *g); | ||||
static void apply_window_mp3_c(MPA_INT *synth_buf, MPA_INT *window, | static void apply_window_mp3_c(MPA_INT *synth_buf, MPA_INT *window, | ||||
int *dither_state, OUT_INT *samples, int incr); | int *dither_state, OUT_INT *samples, int incr); | ||||
@@ -626,7 +621,7 @@ static void apply_window_mp3_c(MPA_INT *synth_buf, MPA_INT *window, | |||||
32 samples. */ | 32 samples. */ | ||||
/* XXX: optimize by avoiding ring buffer usage */ | /* XXX: optimize by avoiding ring buffer usage */ | ||||
#if !CONFIG_FLOAT | #if !CONFIG_FLOAT | ||||
void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, | |||||
void ff_mpa_synth_filter_fixed(MPA_INT *synth_buf_ptr, int *synth_buf_offset, | |||||
MPA_INT *window, int *dither_state, | MPA_INT *window, int *dither_state, | ||||
OUT_INT *samples, int incr, | OUT_INT *samples, int incr, | ||||
INTFLOAT sb_samples[SBLIMIT]) | INTFLOAT sb_samples[SBLIMIT]) | ||||
@@ -637,7 +632,7 @@ void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, | |||||
offset = *synth_buf_offset; | offset = *synth_buf_offset; | ||||
synth_buf = synth_buf_ptr + offset; | synth_buf = synth_buf_ptr + offset; | ||||
dct32(synth_buf, sb_samples); | |||||
ff_dct32_fixed(synth_buf, sb_samples); | |||||
apply_window_mp3_c(synth_buf, window, dither_state, samples, incr); | apply_window_mp3_c(synth_buf, window, dither_state, samples, incr); | ||||
offset = (offset - 32) & 511; | offset = (offset - 32) & 511; | ||||
@@ -38,7 +38,7 @@ | |||||
#include "avcodec.h" | #include "avcodec.h" | ||||
#include "get_bits.h" | #include "get_bits.h" | ||||
#include "dsputil.h" | #include "dsputil.h" | ||||
#include "fft.h" | |||||
#include "rdft.h" | |||||
#include "mpegaudio.h" | #include "mpegaudio.h" | ||||
#include "qdm2data.h" | #include "qdm2data.h" | ||||
@@ -1616,8 +1616,8 @@ static void qdm2_synthesis_filter (QDM2Context *q, int index) | |||||
OUT_INT *samples_ptr = samples + ch; | OUT_INT *samples_ptr = samples + ch; | ||||
for (i = 0; i < 8; i++) { | for (i = 0; i < 8; i++) { | ||||
ff_mpa_synth_filter(q->synth_buf[ch], &(q->synth_buf_offset[ch]), | |||||
ff_mpa_synth_window, &dither_state, | |||||
ff_mpa_synth_filter_fixed(q->synth_buf[ch], &(q->synth_buf_offset[ch]), | |||||
ff_mpa_synth_window_fixed, &dither_state, | |||||
samples_ptr, q->nb_channels, | samples_ptr, q->nb_channels, | ||||
q->sb_samples[ch][(8 * index) + i]); | q->sb_samples[ch][(8 * index) + i]); | ||||
samples_ptr += 32 * q->nb_channels; | samples_ptr += 32 * q->nb_channels; | ||||
@@ -1646,7 +1646,7 @@ static av_cold void qdm2_init(QDM2Context *q) { | |||||
initialized = 1; | initialized = 1; | ||||
qdm2_init_vlc(); | qdm2_init_vlc(); | ||||
ff_mpa_synth_init(ff_mpa_synth_window); | |||||
ff_mpa_synth_init_fixed(ff_mpa_synth_window_fixed); | |||||
softclip_table_init(); | softclip_table_init(); | ||||
rnd_table_init(); | rnd_table_init(); | ||||
init_noise_samples(); | init_noise_samples(); | ||||
@@ -59,12 +59,12 @@ SECTION .text | |||||
%endmacro | %endmacro | ||||
%macro HADAMARD8 0 | %macro HADAMARD8 0 | ||||
SUMSUB_BADC m0, m1, m2, m3 | |||||
SUMSUB_BADC m4, m5, m6, m7 | |||||
SUMSUB_BADC m0, m2, m1, m3 | |||||
SUMSUB_BADC m4, m6, m5, m7 | |||||
SUMSUB_BADC m0, m4, m1, m5 | |||||
SUMSUB_BADC m2, m6, m3, m7 | |||||
SUMSUB_BADC w, 0, 1, 2, 3 | |||||
SUMSUB_BADC w, 4, 5, 6, 7 | |||||
SUMSUB_BADC w, 0, 2, 1, 3 | |||||
SUMSUB_BADC w, 4, 6, 5, 7 | |||||
SUMSUB_BADC w, 0, 4, 1, 5 | |||||
SUMSUB_BADC w, 2, 6, 3, 7 | |||||
%endmacro | %endmacro | ||||
%macro ABS1_SUM 3 | %macro ABS1_SUM 3 | ||||
@@ -59,11 +59,11 @@ SECTION .text | |||||
movq m2, [%2+16] | movq m2, [%2+16] | ||||
movq m3, [%2+24] | movq m3, [%2+24] | ||||
IDCT4_1D 0, 1, 2, 3, 4, 5 | |||||
IDCT4_1D w, 0, 1, 2, 3, 4, 5 | |||||
mova m6, [pw_32] | mova m6, [pw_32] | ||||
TRANSPOSE4x4W 0, 1, 2, 3, 4 | TRANSPOSE4x4W 0, 1, 2, 3, 4 | ||||
paddw m0, m6 | paddw m0, m6 | ||||
IDCT4_1D 0, 1, 2, 3, 4, 5 | |||||
IDCT4_1D w, 0, 1, 2, 3, 4, 5 | |||||
pxor m7, m7 | pxor m7, m7 | ||||
STORE_DIFFx2 m0, m1, m4, m5, m7, 6, %1, %3 | STORE_DIFFx2 m0, m1, m4, m5, m7, 6, %1, %3 | ||||
@@ -118,13 +118,13 @@ cglobal h264_idct_add_mmx, 3, 3, 0 | |||||
mova m2, %1 | mova m2, %1 | ||||
mova m5, %2 | mova m5, %2 | ||||
SUMSUB_BA m5, m2 | |||||
SUMSUB_BA m6, m5 | |||||
SUMSUB_BA m4, m2 | |||||
SUMSUB_BA m7, m6 | |||||
SUMSUB_BA m0, m4 | |||||
SUMSUB_BA m3, m2 | |||||
SUMSUB_BA m1, m5 | |||||
SUMSUB_BA w, 5, 2 | |||||
SUMSUB_BA w, 6, 5 | |||||
SUMSUB_BA w, 4, 2 | |||||
SUMSUB_BA w, 7, 6 | |||||
SUMSUB_BA w, 0, 4 | |||||
SUMSUB_BA w, 3, 2 | |||||
SUMSUB_BA w, 1, 5 | |||||
SWAP 7, 6, 4, 5, 2, 3, 1, 0 ; 70315246 -> 01234567 | SWAP 7, 6, 4, 5, 2, 3, 1, 0 ; 70315246 -> 01234567 | ||||
%endmacro | %endmacro | ||||
@@ -715,10 +715,10 @@ x264_add8x4_idct_sse2: | |||||
movhps m1, [r2+40] | movhps m1, [r2+40] | ||||
movhps m2, [r2+48] | movhps m2, [r2+48] | ||||
movhps m3, [r2+56] | movhps m3, [r2+56] | ||||
IDCT4_1D 0,1,2,3,4,5 | |||||
IDCT4_1D w,0,1,2,3,4,5 | |||||
TRANSPOSE2x4x4W 0,1,2,3,4 | TRANSPOSE2x4x4W 0,1,2,3,4 | ||||
paddw m0, [pw_32] | paddw m0, [pw_32] | ||||
IDCT4_1D 0,1,2,3,4,5 | |||||
IDCT4_1D w,0,1,2,3,4,5 | |||||
pxor m7, m7 | pxor m7, m7 | ||||
STORE_DIFFx2 m0, m1, m4, m5, m7, 6, r0, r3 | STORE_DIFFx2 m0, m1, m4, m5, m7, 6, r0, r3 | ||||
lea r0, [r0+r3*2] | lea r0, [r0+r3*2] | ||||
@@ -859,8 +859,8 @@ cglobal h264_idct_add8_sse2, 5, 7, 8 | |||||
;void ff_h264_luma_dc_dequant_idct_mmx(DCTELEM *output, DCTELEM *input, int qmul) | ;void ff_h264_luma_dc_dequant_idct_mmx(DCTELEM *output, DCTELEM *input, int qmul) | ||||
%macro WALSH4_1D 5 | %macro WALSH4_1D 5 | ||||
SUMSUB_BADC m%4, m%3, m%2, m%1, m%5 | |||||
SUMSUB_BADC m%4, m%2, m%3, m%1, m%5 | |||||
SUMSUB_BADC w, %4, %3, %2, %1, %5 | |||||
SUMSUB_BADC w, %4, %2, %3, %1, %5 | |||||
SWAP %1, %4, %3 | SWAP %1, %4, %3 | ||||
%endmacro | %endmacro | ||||
@@ -1106,10 +1106,10 @@ cglobal vp8_idct_dc_add4uv_mmx, 3, 3 | |||||
; %5/%6 are temporary registers | ; %5/%6 are temporary registers | ||||
; we assume m6/m7 have constant words 20091/17734 loaded in them | ; we assume m6/m7 have constant words 20091/17734 loaded in them | ||||
%macro VP8_IDCT_TRANSFORM4x4_1D 6 | %macro VP8_IDCT_TRANSFORM4x4_1D 6 | ||||
SUMSUB_BA m%3, m%1, m%5 ;t0, t1 | |||||
SUMSUB_BA w, %3, %1, %5 ;t0, t1 | |||||
VP8_MULTIPLY_SUMSUB m%2, m%4, m%5,m%6 ;t2, t3 | VP8_MULTIPLY_SUMSUB m%2, m%4, m%5,m%6 ;t2, t3 | ||||
SUMSUB_BA m%4, m%3, m%5 ;tmp0, tmp3 | |||||
SUMSUB_BA m%2, m%1, m%5 ;tmp1, tmp2 | |||||
SUMSUB_BA w, %4, %3, %5 ;tmp0, tmp3 | |||||
SUMSUB_BA w, %2, %1, %5 ;tmp1, tmp2 | |||||
SWAP %4, %1 | SWAP %4, %1 | ||||
SWAP %4, %3 | SWAP %4, %3 | ||||
%endmacro | %endmacro | ||||
@@ -1181,8 +1181,8 @@ VP8_IDCT_ADD sse | |||||
%endmacro | %endmacro | ||||
%macro HADAMARD4_1D 4 | %macro HADAMARD4_1D 4 | ||||
SUMSUB_BADC m%2, m%1, m%4, m%3 | |||||
SUMSUB_BADC m%4, m%2, m%3, m%1 | |||||
SUMSUB_BADC w, %2, %1, %4, %3 | |||||
SUMSUB_BADC w, %4, %2, %3, %1 | |||||
SWAP %1, %4, %3 | SWAP %1, %4, %3 | ||||
%endmacro | %endmacro | ||||
@@ -208,6 +208,17 @@ | |||||
pminub %2, %4 | pminub %2, %4 | ||||
%endmacro | %endmacro | ||||
%macro ABSD2_MMX 4 | |||||
pxor %3, %3 | |||||
pxor %4, %4 | |||||
pcmpgtd %3, %1 | |||||
pcmpgtd %4, %2 | |||||
pxor %1, %3 | |||||
pxor %2, %4 | |||||
psubd %1, %3 | |||||
psubd %2, %4 | |||||
%endmacro | |||||
%macro ABSB_SSSE3 2 | %macro ABSB_SSSE3 2 | ||||
pabsb %1, %1 | pabsb %1, %1 | ||||
%endmacro | %endmacro | ||||
@@ -230,12 +241,7 @@ | |||||
%macro SPLATB_MMX 3 | %macro SPLATB_MMX 3 | ||||
movd %1, [%2-3] ;to avoid crossing a cacheline | movd %1, [%2-3] ;to avoid crossing a cacheline | ||||
punpcklbw %1, %1 | punpcklbw %1, %1 | ||||
%if mmsize==16 | |||||
pshuflw %1, %1, 0xff | |||||
punpcklqdq %1, %1 | |||||
%else | |||||
pshufw %1, %1, 0xff | |||||
%endif | |||||
SPLATW %1, %1, 3 | |||||
%endmacro | %endmacro | ||||
%macro SPLATB_SSSE3 3 | %macro SPLATB_SSSE3 3 | ||||
@@ -243,125 +249,169 @@ | |||||
pshufb %1, %3 | pshufb %1, %3 | ||||
%endmacro | %endmacro | ||||
%macro PALIGNR_MMX 4 | |||||
%ifnidn %4, %2 | |||||
%macro PALIGNR_MMX 4-5 ; [dst,] src1, src2, imm, tmp | |||||
%define %%dst %1 | |||||
%if %0==5 | |||||
%ifnidn %1, %2 | |||||
mova %%dst, %2 | |||||
%endif | |||||
%rotate 1 | |||||
%endif | |||||
%ifnidn %4, %2 | |||||
mova %4, %2 | mova %4, %2 | ||||
%endif | |||||
%if mmsize == 8 | |||||
psllq %1, (8-%3)*8 | |||||
%endif | |||||
%if mmsize==8 | |||||
psllq %%dst, (8-%3)*8 | |||||
psrlq %4, %3*8 | psrlq %4, %3*8 | ||||
%else | |||||
pslldq %1, 16-%3 | |||||
%else | |||||
pslldq %%dst, 16-%3 | |||||
psrldq %4, %3 | psrldq %4, %3 | ||||
%endif | |||||
por %1, %4 | |||||
%endif | |||||
por %%dst, %4 | |||||
%endmacro | %endmacro | ||||
%macro PALIGNR_SSSE3 4 | |||||
%macro PALIGNR_SSSE3 4-5 | |||||
%if %0==5 | |||||
palignr %1, %2, %3, %4 | |||||
%else | |||||
palignr %1, %2, %3 | palignr %1, %2, %3 | ||||
%endif | |||||
%endmacro | %endmacro | ||||
%macro DEINTB 5 ; mask, reg1, mask, reg2, optional src to fill masks from | %macro DEINTB 5 ; mask, reg1, mask, reg2, optional src to fill masks from | ||||
%ifnum %5 | %ifnum %5 | ||||
mova m%1, m%5 | |||||
mova m%3, m%5 | |||||
pand m%3, m%5, m%4 ; src .. y6 .. y4 | |||||
pand m%1, m%5, m%2 ; dst .. y6 .. y4 | |||||
%else | %else | ||||
mova m%1, %5 | mova m%1, %5 | ||||
mova m%3, m%1 | |||||
pand m%3, m%1, m%4 ; src .. y6 .. y4 | |||||
pand m%1, m%1, m%2 ; dst .. y6 .. y4 | |||||
%endif | %endif | ||||
pand m%1, m%2 ; dst .. y6 .. y4 | |||||
pand m%3, m%4 ; src .. y6 .. y4 | |||||
psrlw m%2, 8 ; dst .. y7 .. y5 | |||||
psrlw m%4, 8 ; src .. y7 .. y5 | |||||
psrlw m%2, 8 ; dst .. y7 .. y5 | |||||
psrlw m%4, 8 ; src .. y7 .. y5 | |||||
%endmacro | %endmacro | ||||
%macro SUMSUB_BA 2-3 | |||||
%if %0==2 | |||||
paddw %1, %2 | |||||
paddw %2, %2 | |||||
psubw %2, %1 | |||||
%macro SUMSUB_BA 3-4 | |||||
%if %0==3 | |||||
padd%1 m%2, m%3 | |||||
padd%1 m%3, m%3 | |||||
psub%1 m%3, m%2 | |||||
%else | |||||
%if avx_enabled == 0 | |||||
mova m%4, m%2 | |||||
padd%1 m%2, m%3 | |||||
psub%1 m%3, m%4 | |||||
%else | %else | ||||
mova %3, %1 | |||||
paddw %1, %2 | |||||
psubw %2, %3 | |||||
padd%1 m%4, m%2, m%3 | |||||
psub%1 m%3, m%2 | |||||
SWAP %2, %4 | |||||
%endif | |||||
%endif | %endif | ||||
%endmacro | %endmacro | ||||
%macro SUMSUB_BADC 4-5 | |||||
%if %0==5 | |||||
SUMSUB_BA %1, %2, %5 | |||||
SUMSUB_BA %3, %4, %5 | |||||
%macro SUMSUB_BADC 5-6 | |||||
%if %0==6 | |||||
SUMSUB_BA %1, %2, %3, %6 | |||||
SUMSUB_BA %1, %4, %5, %6 | |||||
%else | %else | ||||
paddw %1, %2 | |||||
paddw %3, %4 | |||||
paddw %2, %2 | |||||
paddw %4, %4 | |||||
psubw %2, %1 | |||||
psubw %4, %3 | |||||
padd%1 m%2, m%3 | |||||
padd%1 m%4, m%5 | |||||
padd%1 m%3, m%3 | |||||
padd%1 m%5, m%5 | |||||
psub%1 m%3, m%2 | |||||
psub%1 m%5, m%4 | |||||
%endif | %endif | ||||
%endmacro | %endmacro | ||||
%macro SUMSUB2_AB 3 | |||||
mova %3, %1 | |||||
paddw %1, %1 | |||||
paddw %1, %2 | |||||
psubw %3, %2 | |||||
psubw %3, %2 | |||||
%macro SUMSUB2_AB 4 | |||||
%ifnum %3 | |||||
psub%1 m%4, m%2, m%3 | |||||
psub%1 m%4, m%3 | |||||
padd%1 m%2, m%2 | |||||
padd%1 m%2, m%3 | |||||
%else | |||||
mova m%4, m%2 | |||||
padd%1 m%2, m%2 | |||||
padd%1 m%2, %3 | |||||
psub%1 m%4, %3 | |||||
psub%1 m%4, %3 | |||||
%endif | |||||
%endmacro | %endmacro | ||||
%macro SUMSUB2_BA 3 | |||||
mova m%3, m%1 | |||||
paddw m%1, m%2 | |||||
paddw m%1, m%2 | |||||
psubw m%2, m%3 | |||||
psubw m%2, m%3 | |||||
%macro SUMSUB2_BA 4 | |||||
%if avx_enabled == 0 | |||||
mova m%4, m%2 | |||||
padd%1 m%2, m%3 | |||||
padd%1 m%2, m%3 | |||||
psub%1 m%3, m%4 | |||||
psub%1 m%3, m%4 | |||||
%else | |||||
padd%1 m%4, m%2, m%3 | |||||
padd%1 m%4, m%3 | |||||
psub%1 m%3, m%2 | |||||
psub%1 m%3, m%2 | |||||
SWAP %2, %4 | |||||
%endif | |||||
%endmacro | %endmacro | ||||
%macro SUMSUBD2_AB 4 | |||||
mova %4, %1 | |||||
mova %3, %2 | |||||
psraw %2, 1 ; %2: %2>>1 | |||||
psraw %1, 1 ; %1: %1>>1 | |||||
paddw %2, %4 ; %2: %2>>1+%1 | |||||
psubw %1, %3 ; %1: %1>>1-%2 | |||||
%macro SUMSUBD2_AB 5 | |||||
%ifnum %4 | |||||
psra%1 m%5, m%2, 1 ; %3: %3>>1 | |||||
psra%1 m%4, m%3, 1 ; %2: %2>>1 | |||||
padd%1 m%4, m%2 ; %3: %3>>1+%2 | |||||
psub%1 m%5, m%3 ; %2: %2>>1-%3 | |||||
SWAP %2, %5 | |||||
SWAP %3, %4 | |||||
%else | |||||
mova %5, m%2 | |||||
mova %4, m%3 | |||||
psra%1 m%3, 1 ; %3: %3>>1 | |||||
psra%1 m%2, 1 ; %2: %2>>1 | |||||
padd%1 m%3, %5 ; %3: %3>>1+%2 | |||||
psub%1 m%2, %4 ; %2: %2>>1-%3 | |||||
%endif | |||||
%endmacro | %endmacro | ||||
%macro DCT4_1D 5 | %macro DCT4_1D 5 | ||||
%ifnum %5 | %ifnum %5 | ||||
SUMSUB_BADC m%4, m%1, m%3, m%2; m%5 | |||||
SUMSUB_BA m%3, m%4, m%5 | |||||
SUMSUB2_AB m%1, m%2, m%5 | |||||
SUMSUB_BADC w, %4, %1, %3, %2, %5 | |||||
SUMSUB_BA w, %3, %4, %5 | |||||
SUMSUB2_AB w, %1, %2, %5 | |||||
SWAP %1, %3, %4, %5, %2 | SWAP %1, %3, %4, %5, %2 | ||||
%else | %else | ||||
SUMSUB_BADC m%4, m%1, m%3, m%2 | |||||
SUMSUB_BA m%3, m%4 | |||||
mova [%5], m%2 | |||||
SUMSUB2_AB m%1, [%5], m%2 | |||||
SUMSUB_BADC w, %4, %1, %3, %2 | |||||
SUMSUB_BA w, %3, %4 | |||||
mova [%5], m%2 | |||||
SUMSUB2_AB w, %1, [%5], %2 | |||||
SWAP %1, %3, %4, %2 | SWAP %1, %3, %4, %2 | ||||
%endif | %endif | ||||
%endmacro | %endmacro | ||||
%macro IDCT4_1D 5-6 | |||||
%ifnum %5 | |||||
SUMSUBD2_AB m%2, m%4, m%6, m%5 | |||||
; %2: %2>>1-%4 %4: %2+%4>>1 | |||||
SUMSUB_BA m%3, m%1, m%6 | |||||
; %3: %1+%3 %1: %1-%3 | |||||
SUMSUB_BADC m%4, m%3, m%2, m%1, m%6 | |||||
; %4: %1+%3 + (%2+%4>>1) | |||||
; %3: %1+%3 - (%2+%4>>1) | |||||
; %2: %1-%3 + (%2>>1-%4) | |||||
; %1: %1-%3 - (%2>>1-%4) | |||||
%macro IDCT4_1D 6-7 | |||||
%ifnum %6 | |||||
SUMSUBD2_AB %1, %3, %5, %7, %6 | |||||
; %3: %3>>1-%5 %5: %3+%5>>1 | |||||
SUMSUB_BA %1, %4, %2, %7 | |||||
; %4: %2+%4 %2: %2-%4 | |||||
SUMSUB_BADC %1, %5, %4, %3, %2, %7 | |||||
; %5: %2+%4 + (%3+%5>>1) | |||||
; %4: %2+%4 - (%3+%5>>1) | |||||
; %3: %2-%4 + (%3>>1-%5) | |||||
; %2: %2-%4 - (%3>>1-%5) | |||||
%else | %else | ||||
SUMSUBD2_AB m%2, m%4, [%5], [%5+16] | |||||
SUMSUB_BA m%3, m%1 | |||||
SUMSUB_BADC m%4, m%3, m%2, m%1 | |||||
%ifidn %1, w | |||||
SUMSUBD2_AB %1, %3, %5, [%6], [%6+16] | |||||
%else | |||||
SUMSUBD2_AB %1, %3, %5, [%6], [%6+32] | |||||
%endif | |||||
SUMSUB_BA %1, %4, %2 | |||||
SUMSUB_BADC %1, %5, %4, %3, %2 | |||||
%endif | %endif | ||||
SWAP %1, %4, %3 | |||||
; %1: %1+%3 + (%2+%4>>1) row0 | |||||
; %2: %1-%3 + (%2>>1-%4) row1 | |||||
; %3: %1-%3 - (%2>>1-%4) row2 | |||||
; %4: %1+%3 - (%2+%4>>1) row3 | |||||
SWAP %2, %5, %4 | |||||
; %2: %2+%4 + (%3+%5>>1) row0 | |||||
; %3: %2-%4 + (%3>>1-%5) row1 | |||||
; %4: %2-%4 - (%3>>1-%5) row2 | |||||
; %5: %2+%4 - (%3+%5>>1) row3 | |||||
%endmacro | %endmacro | ||||
@@ -848,7 +848,10 @@ static int asf_read_frame_header(AVFormatContext *s, AVIOContext *pb){ | |||||
} | } | ||||
if (asf->packet_flags & 0x01) { | if (asf->packet_flags & 0x01) { | ||||
DO_2BITS(asf->packet_segsizetype >> 6, asf->packet_frag_size, 0); // 0 is illegal | DO_2BITS(asf->packet_segsizetype >> 6, asf->packet_frag_size, 0); // 0 is illegal | ||||
if(asf->packet_frag_size > asf->packet_size_left - rsize){ | |||||
if (rsize > asf->packet_size_left) { | |||||
av_log(s, AV_LOG_ERROR, "packet_replic_size is invalid\n"); | |||||
return -1; | |||||
} else if(asf->packet_frag_size > asf->packet_size_left - rsize){ | |||||
if (asf->packet_frag_size > asf->packet_size_left - rsize + asf->packet_padsize) { | if (asf->packet_frag_size > asf->packet_size_left - rsize + asf->packet_padsize) { | ||||
av_log(s, AV_LOG_ERROR, "packet_frag_size is invalid (%d-%d)\n", asf->packet_size_left, rsize); | av_log(s, AV_LOG_ERROR, "packet_frag_size is invalid (%d-%d)\n", asf->packet_size_left, rsize); | ||||
return -1; | return -1; | ||||
@@ -1261,21 +1264,22 @@ static int asf_read_seek(AVFormatContext *s, int stream_index, int64_t pts, int | |||||
if (!asf->index_read) | if (!asf->index_read) | ||||
asf_build_simple_index(s, stream_index); | asf_build_simple_index(s, stream_index); | ||||
if(!(asf->index_read && st->index_entries)){ | |||||
if(av_seek_frame_binary(s, stream_index, pts, flags)<0) | |||||
return -1; | |||||
}else{ | |||||
if((asf->index_read && st->index_entries)){ | |||||
index= av_index_search_timestamp(st, pts, flags); | index= av_index_search_timestamp(st, pts, flags); | ||||
if(index<0) | |||||
return -1; | |||||
if(index >= 0) { | |||||
/* find the position */ | |||||
pos = st->index_entries[index].pos; | |||||
/* find the position */ | |||||
pos = st->index_entries[index].pos; | |||||
/* do the seek */ | |||||
av_log(s, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", pos); | |||||
avio_seek(s->pb, pos, SEEK_SET); | |||||
/* do the seek */ | |||||
av_log(s, AV_LOG_DEBUG, "SEEKTO: %"PRId64"\n", pos); | |||||
avio_seek(s->pb, pos, SEEK_SET); | |||||
asf_reset_header(s); | |||||
return 0; | |||||
} | |||||
} | } | ||||
/* no index or seeking by index failed */ | |||||
if(av_seek_frame_binary(s, stream_index, pts, flags)<0) | |||||
return -1; | |||||
asf_reset_header(s); | asf_reset_header(s); | ||||
return 0; | return 0; | ||||
} | } | ||||
@@ -1290,4 +1294,5 @@ AVInputFormat ff_asf_demuxer = { | |||||
asf_read_close, | asf_read_close, | ||||
asf_read_seek, | asf_read_seek, | ||||
asf_read_pts, | asf_read_pts, | ||||
.flags = AVFMT_NOBINSEARCH | AVFMT_NOGENSEARCH, | |||||
}; | }; |
@@ -258,6 +258,8 @@ typedef struct AVFormatParameters { | |||||
#define AVFMT_VARIABLE_FPS 0x0400 /**< Format allows variable fps. */ | #define AVFMT_VARIABLE_FPS 0x0400 /**< Format allows variable fps. */ | ||||
#define AVFMT_NODIMENSIONS 0x0800 /**< Format does not need width/height */ | #define AVFMT_NODIMENSIONS 0x0800 /**< Format does not need width/height */ | ||||
#define AVFMT_NOSTREAMS 0x1000 /**< Format does not require any streams */ | #define AVFMT_NOSTREAMS 0x1000 /**< Format does not require any streams */ | ||||
#define AVFMT_NOBINSEARCH 0x2000 /**< Format does not allow to fallback to binary search via read_timestamp */ | |||||
#define AVFMT_NOGENSEARCH 0x4000 /**< Format does not allow to fallback to generic search */ | |||||
typedef struct AVOutputFormat { | typedef struct AVOutputFormat { | ||||
const char *name; | const char *name; | ||||
@@ -375,7 +375,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) | |||||
size = avio_rb24(s->pb); | size = avio_rb24(s->pb); | ||||
dts = avio_rb24(s->pb); | dts = avio_rb24(s->pb); | ||||
dts |= avio_r8(s->pb) << 24; | dts |= avio_r8(s->pb) << 24; | ||||
// av_log(s, AV_LOG_DEBUG, "type:%d, size:%d, dts:%d\n", type, size, dts); | |||||
av_dlog(s, "type:%d, size:%d, dts:%"PRId64"\n", type, size, dts); | |||||
if (url_feof(s->pb)) | if (url_feof(s->pb)) | ||||
return AVERROR_EOF; | return AVERROR_EOF; | ||||
avio_skip(s->pb, 3); /* stream id, always 0 */ | avio_skip(s->pb, 3); /* stream id, always 0 */ | ||||
@@ -421,7 +421,7 @@ static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) | |||||
st= create_stream(s, is_audio); | st= create_stream(s, is_audio); | ||||
s->ctx_flags &= ~AVFMTCTX_NOHEADER; | s->ctx_flags &= ~AVFMTCTX_NOHEADER; | ||||
} | } | ||||
// av_log(s, AV_LOG_DEBUG, "%d %X %d \n", is_audio, flags, st->discard); | |||||
av_dlog(s, "%d %X %d \n", is_audio, flags, st->discard); | |||||
if( (st->discard >= AVDISCARD_NONKEY && !((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY || is_audio)) | if( (st->discard >= AVDISCARD_NONKEY && !((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY || is_audio)) | ||||
||(st->discard >= AVDISCARD_BIDIR && ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_DISP_INTER && !is_audio)) | ||(st->discard >= AVDISCARD_BIDIR && ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_DISP_INTER && !is_audio)) | ||||
|| st->discard >= AVDISCARD_ALL | || st->discard >= AVDISCARD_ALL | ||||
@@ -1742,10 +1742,12 @@ int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, int f | |||||
return 0; | return 0; | ||||
} | } | ||||
if(s->iformat->read_timestamp) | |||||
if(s->iformat->read_timestamp && !(s->iformat->flags & AVFMT_NOBINSEARCH)) | |||||
return av_seek_frame_binary(s, stream_index, timestamp, flags); | return av_seek_frame_binary(s, stream_index, timestamp, flags); | ||||
else | |||||
else if (!(s->iformat->flags & AVFMT_NOGENSEARCH)) | |||||
return av_seek_frame_generic(s, stream_index, timestamp, flags); | return av_seek_frame_generic(s, stream_index, timestamp, flags); | ||||
else | |||||
return -1; | |||||
} | } | ||||
int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags) | int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags) | ||||