Commit f3543969 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge remote branch 'qatar/master'

* qatar/master:
  Fixed-point MDCT with 32-bit unscaled output
  lavc: deprecate rate_emu
  lavc: mark hurry_up for removal on next major bump
  parser: mark av_parser_parse() for removal on next major bump
  lavc: add missing audioconvert includes
  jvdec: don't use deprecated CODEC_TYPE_*/PKT_FLAG_KEY

Conflicts:
	libavcodec/h264.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 85c9365d bc154882
...@@ -1218,13 +1218,15 @@ typedef struct AVCodecContext { ...@@ -1218,13 +1218,15 @@ typedef struct AVCodecContext {
*/ */
enum PixelFormat pix_fmt; enum PixelFormat pix_fmt;
#if FF_API_RATE_EMU
/** /**
* Frame rate emulation. If not zero, the lower layer (i.e. format handler) * Frame rate emulation. If not zero, the lower layer (i.e. format handler)
* has to read frames at native frame rate. * has to read frames at native frame rate.
* - encoding: Set by user. * - encoding: Set by user.
* - decoding: unused * - decoding: unused
*/ */
int rate_emu; attribute_deprecated int rate_emu;
#endif
/** /**
* If non NULL, 'draw_horiz_band' is called by the libavcodec * If non NULL, 'draw_horiz_band' is called by the libavcodec
...@@ -1330,13 +1332,15 @@ typedef struct AVCodecContext { ...@@ -1330,13 +1332,15 @@ typedef struct AVCodecContext {
int b_frame_strategy; int b_frame_strategy;
#if FF_API_HURRY_UP
/** /**
* hurry up amount * hurry up amount
* - encoding: unused * - encoding: unused
* - decoding: Set by user. 1-> Skip B-frames, 2-> Skip IDCT/dequant too, 5-> Skip everything except header * - decoding: Set by user. 1-> Skip B-frames, 2-> Skip IDCT/dequant too, 5-> Skip everything except header
* @deprecated Deprecated in favor of skip_idct and skip_frame. * @deprecated Deprecated in favor of skip_idct and skip_frame.
*/ */
int hurry_up; attribute_deprecated int hurry_up;
#endif
struct AVCodec *codec; struct AVCodec *codec;
......
...@@ -39,6 +39,8 @@ ...@@ -39,6 +39,8 @@
#include "libavutil/intmath.h" #include "libavutil/intmath.h"
#include "mathops.h" #include "mathops.h"
void ff_mdct_calcw_c(FFTContext *s, FFTDouble *output, const FFTSample *input);
#define SCALE_FLOAT(a, bits) lrint((a) * (double)(1 << (bits))) #define SCALE_FLOAT(a, bits) lrint((a) * (double)(1 << (bits)))
#define FIX15(a) av_clip(SCALE_FLOAT(a, 15), -32767, 32767) #define FIX15(a) av_clip(SCALE_FLOAT(a, 15), -32767, 32767)
...@@ -49,11 +51,17 @@ ...@@ -49,11 +51,17 @@
y = (a + b) >> 1; \ y = (a + b) >> 1; \
} while (0) } while (0)
#define CMUL(dre, dim, are, aim, bre, bim) do { \ #define CMULS(dre, dim, are, aim, bre, bim, sh) do { \
(dre) = (MUL16(are, bre) - MUL16(aim, bim)) >> 15; \ (dre) = (MUL16(are, bre) - MUL16(aim, bim)) >> sh; \
(dim) = (MUL16(are, bim) + MUL16(aim, bre)) >> 15; \ (dim) = (MUL16(are, bim) + MUL16(aim, bre)) >> sh; \
} while (0) } while (0)
#define CMUL(dre, dim, are, aim, bre, bim) \
CMULS(dre, dim, are, aim, bre, bim, 15)
#define CMULL(dre, dim, are, aim, bre, bim) \
CMULS(dre, dim, are, aim, bre, bim, 0)
#endif /* CONFIG_FFT_FLOAT */ #endif /* CONFIG_FFT_FLOAT */
#define ff_imdct_calc_c FFT_NAME(ff_imdct_calc_c) #define ff_imdct_calc_c FFT_NAME(ff_imdct_calc_c)
......
...@@ -123,6 +123,9 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse) ...@@ -123,6 +123,9 @@ av_cold int ff_fft_init(FFTContext *s, int nbits, int inverse)
if (ARCH_ARM) ff_fft_init_arm(s); if (ARCH_ARM) ff_fft_init_arm(s);
if (HAVE_ALTIVEC) ff_fft_init_altivec(s); if (HAVE_ALTIVEC) ff_fft_init_altivec(s);
if (HAVE_MMX) ff_fft_init_mmx(s); if (HAVE_MMX) ff_fft_init_mmx(s);
if (CONFIG_MDCT) s->mdct_calcw = s->mdct_calc;
#else
if (CONFIG_MDCT) s->mdct_calcw = ff_mdct_calcw_c;
#endif #endif
for(j=4; j<=nbits; j++) { for(j=4; j<=nbits; j++) {
......
...@@ -53,6 +53,10 @@ typedef struct FFTContext FFTContext; ...@@ -53,6 +53,10 @@ typedef struct FFTContext FFTContext;
#endif /* CONFIG_FFT_FLOAT */ #endif /* CONFIG_FFT_FLOAT */
typedef struct FFTDComplex {
FFTDouble re, im;
} FFTDComplex;
/* FFT computation */ /* FFT computation */
struct FFTContext { struct FFTContext {
...@@ -77,6 +81,7 @@ struct FFTContext { ...@@ -77,6 +81,7 @@ struct FFTContext {
void (*imdct_calc)(struct FFTContext *s, FFTSample *output, const FFTSample *input); void (*imdct_calc)(struct FFTContext *s, FFTSample *output, const FFTSample *input);
void (*imdct_half)(struct FFTContext *s, FFTSample *output, const FFTSample *input); void (*imdct_half)(struct FFTContext *s, FFTSample *output, const FFTSample *input);
void (*mdct_calc)(struct FFTContext *s, FFTSample *output, const FFTSample *input); void (*mdct_calc)(struct FFTContext *s, FFTSample *output, const FFTSample *input);
void (*mdct_calcw)(struct FFTContext *s, FFTDouble *output, const FFTSample *input);
int fft_permutation; int fft_permutation;
#define FF_FFT_PERM_DEFAULT 0 #define FF_FFT_PERM_DEFAULT 0
#define FF_FFT_PERM_SWAP_LSBS 1 #define FF_FFT_PERM_SWAP_LSBS 1
......
...@@ -595,12 +595,14 @@ retry: ...@@ -595,12 +595,14 @@ retry:
goto retry; goto retry;
} }
// for hurry_up==5 // for skipping the frame
s->current_picture.pict_type= s->pict_type; s->current_picture.pict_type= s->pict_type;
s->current_picture.key_frame= s->pict_type == FF_I_TYPE; s->current_picture.key_frame= s->pict_type == FF_I_TYPE;
#if FF_API_HURRY_UP
/* skip everything if we are in a hurry>=5 */ /* skip everything if we are in a hurry>=5 */
if(avctx->hurry_up>=5) return get_consumed_bytes(s, buf_size); if(avctx->hurry_up>=5) return get_consumed_bytes(s, buf_size);
#endif
if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE) if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE)
||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE) ||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE)
|| avctx->skip_frame >= AVDISCARD_ALL) || avctx->skip_frame >= AVDISCARD_ALL)
......
...@@ -606,20 +606,24 @@ retry: ...@@ -606,20 +606,24 @@ retry:
if((s->codec_id==CODEC_ID_H263 || s->codec_id==CODEC_ID_H263P || s->codec_id == CODEC_ID_H263I)) if((s->codec_id==CODEC_ID_H263 || s->codec_id==CODEC_ID_H263P || s->codec_id == CODEC_ID_H263I))
s->gob_index = ff_h263_get_gob_height(s); s->gob_index = ff_h263_get_gob_height(s);
// for hurry_up==5 // for skipping the frame
s->current_picture.pict_type= s->pict_type; s->current_picture.pict_type= s->pict_type;
s->current_picture.key_frame= s->pict_type == FF_I_TYPE; s->current_picture.key_frame= s->pict_type == FF_I_TYPE;
/* skip B-frames if we don't have reference frames */ /* skip B-frames if we don't have reference frames */
if(s->last_picture_ptr==NULL && (s->pict_type==FF_B_TYPE || s->dropable)) return get_consumed_bytes(s, buf_size); if(s->last_picture_ptr==NULL && (s->pict_type==FF_B_TYPE || s->dropable)) return get_consumed_bytes(s, buf_size);
#if FF_API_HURRY_UP
/* skip b frames if we are in a hurry */ /* skip b frames if we are in a hurry */
if(avctx->hurry_up && s->pict_type==FF_B_TYPE) return get_consumed_bytes(s, buf_size); if(avctx->hurry_up && s->pict_type==FF_B_TYPE) return get_consumed_bytes(s, buf_size);
#endif
if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE) if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE)
|| (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE) || (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE)
|| avctx->skip_frame >= AVDISCARD_ALL) || avctx->skip_frame >= AVDISCARD_ALL)
return get_consumed_bytes(s, buf_size); return get_consumed_bytes(s, buf_size);
#if FF_API_HURRY_UP
/* skip everything if we are in a hurry>=5 */ /* skip everything if we are in a hurry>=5 */
if(avctx->hurry_up>=5) return get_consumed_bytes(s, buf_size); if(avctx->hurry_up>=5) return get_consumed_bytes(s, buf_size);
#endif
if(s->next_p_frame_damaged){ if(s->next_p_frame_damaged){
if(s->pict_type==FF_B_TYPE) if(s->pict_type==FF_B_TYPE)
......
...@@ -3313,8 +3313,12 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){ ...@@ -3313,8 +3313,12 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
buf_index += consumed; buf_index += consumed;
if( (s->hurry_up == 1 && h->nal_ref_idc == 0) //FIXME do not discard SEI id //FIXME do not discard SEI id
||(avctx->skip_frame >= AVDISCARD_NONREF && h->nal_ref_idc == 0)) if(
#if FF_API_HURRY_UP
(s->hurry_up == 1 && h->nal_ref_idc == 0) ||
#endif
(avctx->skip_frame >= AVDISCARD_NONREF && h->nal_ref_idc == 0))
continue; continue;
again: again:
...@@ -3350,7 +3354,10 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){ ...@@ -3350,7 +3354,10 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
ff_vdpau_h264_picture_start(s); ff_vdpau_h264_picture_start(s);
} }
if(hx->redundant_pic_count==0 && hx->s.hurry_up < 5 if(hx->redundant_pic_count==0
#if FF_API_HURRY_UP
&& hx->s.hurry_up < 5
#endif
&& (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc) && (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc)
&& (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos!=FF_B_TYPE) && (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos!=FF_B_TYPE)
&& (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==FF_I_TYPE) && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==FF_I_TYPE)
...@@ -3388,7 +3395,9 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){ ...@@ -3388,7 +3395,9 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
if(hx->redundant_pic_count==0 && hx->intra_gb_ptr && hx->s.data_partitioning if(hx->redundant_pic_count==0 && hx->intra_gb_ptr && hx->s.data_partitioning
&& s->context_initialized && s->context_initialized
#if FF_API_HURRY_UP
&& s->hurry_up < 5 && s->hurry_up < 5
#endif
&& (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc) && (avctx->skip_frame < AVDISCARD_NONREF || hx->nal_ref_idc)
&& (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos!=FF_B_TYPE) && (avctx->skip_frame < AVDISCARD_BIDIR || hx->slice_type_nos!=FF_B_TYPE)
&& (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==FF_I_TYPE) && (avctx->skip_frame < AVDISCARD_NONKEY || hx->slice_type_nos==FF_I_TYPE)
...@@ -3511,7 +3520,12 @@ static int decode_frame(AVCodecContext *avctx, ...@@ -3511,7 +3520,12 @@ static int decode_frame(AVCodecContext *avctx,
} }
if(!(s->flags2 & CODEC_FLAG2_CHUNKS) && !s->current_picture_ptr){ if(!(s->flags2 & CODEC_FLAG2_CHUNKS) && !s->current_picture_ptr){
if (avctx->skip_frame >= AVDISCARD_NONREF || s->hurry_up) return 0; if (avctx->skip_frame >= AVDISCARD_NONREF
#if FF_API_HURRY_UP
|| s->hurry_up
#endif
)
return 0;
av_log(avctx, AV_LOG_ERROR, "no frame!\n"); av_log(avctx, AV_LOG_ERROR, "no frame!\n");
return -1; return -1;
} }
......
...@@ -205,7 +205,7 @@ static av_cold int decode_close(AVCodecContext *avctx) ...@@ -205,7 +205,7 @@ static av_cold int decode_close(AVCodecContext *avctx)
AVCodec ff_jv_decoder = { AVCodec ff_jv_decoder = {
.name = "jv", .name = "jv",
.long_name = NULL_IF_CONFIG_SMALL("Bitmap Brothers JV video"), .long_name = NULL_IF_CONFIG_SMALL("Bitmap Brothers JV video"),
.type = CODEC_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
.id = CODEC_ID_JV, .id = CODEC_ID_JV,
.priv_data_size = sizeof(JvContext), .priv_data_size = sizeof(JvContext),
.init = decode_init, .init = decode_init,
......
...@@ -18,3 +18,47 @@ ...@@ -18,3 +18,47 @@
#define CONFIG_FFT_FLOAT 0 #define CONFIG_FFT_FLOAT 0
#include "mdct.c" #include "mdct.c"
/* same as ff_mdct_calcw_c with double-width unscaled output */
void ff_mdct_calcw_c(FFTContext *s, FFTDouble *out, const FFTSample *input)
{
int i, j, n, n8, n4, n2, n3;
FFTDouble re, im;
const uint16_t *revtab = s->revtab;
const FFTSample *tcos = s->tcos;
const FFTSample *tsin = s->tsin;
FFTComplex *x = s->tmp_buf;
FFTDComplex *o = (FFTDComplex *)out;
n = 1 << s->mdct_bits;
n2 = n >> 1;
n4 = n >> 2;
n8 = n >> 3;
n3 = 3 * n4;
/* pre rotation */
for(i=0;i<n8;i++) {
re = RSCALE(-input[2*i+n3] - input[n3-1-2*i]);
im = RSCALE(-input[n4+2*i] + input[n4-1-2*i]);
j = revtab[i];
CMUL(x[j].re, x[j].im, re, im, -tcos[i], tsin[i]);
re = RSCALE( input[2*i] - input[n2-1-2*i]);
im = RSCALE(-input[n2+2*i] - input[ n-1-2*i]);
j = revtab[n8 + i];
CMUL(x[j].re, x[j].im, re, im, -tcos[n8 + i], tsin[n8 + i]);
}
s->fft_calc(s, x);
/* post rotation */
for(i=0;i<n8;i++) {
FFTDouble r0, i0, r1, i1;
CMULL(i1, r0, x[n8-i-1].re, x[n8-i-1].im, -tsin[n8-i-1], -tcos[n8-i-1]);
CMULL(i0, r1, x[n8+i ].re, x[n8+i ].im, -tsin[n8+i ], -tcos[n8+i ]);
o[n8-i-1].re = r0;
o[n8-i-1].im = i0;
o[n8+i ].re = r1;
o[n8+i ].im = i1;
}
}
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <stdint.h> #include <stdint.h>
#include "libavutil/crc.h" #include "libavutil/crc.h"
#include "libavutil/audioconvert.h"
#include "get_bits.h" #include "get_bits.h"
#include "parser.h" #include "parser.h"
#include "mlp_parser.h" #include "mlp_parser.h"
......
...@@ -2459,14 +2459,18 @@ static int decode_chunks(AVCodecContext *avctx, ...@@ -2459,14 +2459,18 @@ static int decode_chunks(AVCodecContext *avctx,
/* Skip P-frames if we do not have a reference frame or we have an invalid header. */ /* Skip P-frames if we do not have a reference frame or we have an invalid header. */
if(s2->pict_type==FF_P_TYPE && !s->sync) break; if(s2->pict_type==FF_P_TYPE && !s->sync) break;
} }
#if FF_API_HURRY_UP
/* Skip B-frames if we are in a hurry. */ /* Skip B-frames if we are in a hurry. */
if(avctx->hurry_up && s2->pict_type==FF_B_TYPE) break; if(avctx->hurry_up && s2->pict_type==FF_B_TYPE) break;
#endif
if( (avctx->skip_frame >= AVDISCARD_NONREF && s2->pict_type==FF_B_TYPE) if( (avctx->skip_frame >= AVDISCARD_NONREF && s2->pict_type==FF_B_TYPE)
||(avctx->skip_frame >= AVDISCARD_NONKEY && s2->pict_type!=FF_I_TYPE) ||(avctx->skip_frame >= AVDISCARD_NONKEY && s2->pict_type!=FF_I_TYPE)
|| avctx->skip_frame >= AVDISCARD_ALL) || avctx->skip_frame >= AVDISCARD_ALL)
break; break;
#if FF_API_HURRY_UP
/* Skip everything if we are in a hurry>=5. */ /* Skip everything if we are in a hurry>=5. */
if(avctx->hurry_up>=5) break; if(avctx->hurry_up>=5) break;
#endif
if (!s->mpeg_enc_ctx_allocated) break; if (!s->mpeg_enc_ctx_allocated) break;
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
* MPEG Audio decoder. * MPEG Audio decoder.
*/ */
#include "libavutil/audioconvert.h"
#include "avcodec.h" #include "avcodec.h"
#include "get_bits.h" #include "get_bits.h"
#include "dsputil.h" #include "dsputil.h"
......
...@@ -1120,7 +1120,9 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx) ...@@ -1120,7 +1120,9 @@ int MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
} }
} }
#if FF_API_HURRY_UP
s->hurry_up= s->avctx->hurry_up; s->hurry_up= s->avctx->hurry_up;
#endif
s->error_recognition= avctx->error_recognition; s->error_recognition= avctx->error_recognition;
/* set dequantizer, we can't do it during init as it might change for mpeg4 /* set dequantizer, we can't do it during init as it might change for mpeg4
...@@ -2112,7 +2114,9 @@ void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64], ...@@ -2112,7 +2114,9 @@ void MPV_decode_mb_internal(MpegEncContext *s, DCTELEM block[12][64],
} }
/* skip dequant / idct if we are really late ;) */ /* skip dequant / idct if we are really late ;) */
#if FF_API_HURRY_UP
if(s->hurry_up>1) goto skip_idct; if(s->hurry_up>1) goto skip_idct;
#endif
if(s->avctx->skip_idct){ if(s->avctx->skip_idct){
if( (s->avctx->skip_idct >= AVDISCARD_NONREF && s->pict_type == FF_B_TYPE) if( (s->avctx->skip_idct >= AVDISCARD_NONREF && s->pict_type == FF_B_TYPE)
||(s->avctx->skip_idct >= AVDISCARD_NONKEY && s->pict_type != FF_I_TYPE) ||(s->avctx->skip_idct >= AVDISCARD_NONKEY && s->pict_type != FF_I_TYPE)
......
...@@ -390,8 +390,10 @@ typedef struct MpegEncContext { ...@@ -390,8 +390,10 @@ typedef struct MpegEncContext {
int no_rounding; /**< apply no rounding to motion compensation (MPEG4, msmpeg4, ...) int no_rounding; /**< apply no rounding to motion compensation (MPEG4, msmpeg4, ...)
for b-frames rounding mode is always 0 */ for b-frames rounding mode is always 0 */
#if FF_API_HURRY_UP
int hurry_up; /**< when set to 1 during decoding, b frames will be skipped int hurry_up; /**< when set to 1 during decoding, b frames will be skipped
when set to 2 idct/dequant will be skipped too */ when set to 2 idct/dequant will be skipped too */
#endif
/* macroblock layer */ /* macroblock layer */
int mb_x, mb_y; int mb_x, mb_y;
......
...@@ -105,7 +105,9 @@ static const AVOption options[]={ ...@@ -105,7 +105,9 @@ static const AVOption options[]={
{"extradata_size", NULL, OFFSET(extradata_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, {"extradata_size", NULL, OFFSET(extradata_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
{"time_base", NULL, OFFSET(time_base), FF_OPT_TYPE_RATIONAL, DEFAULT, INT_MIN, INT_MAX}, {"time_base", NULL, OFFSET(time_base), FF_OPT_TYPE_RATIONAL, DEFAULT, INT_MIN, INT_MAX},
{"g", "set the group of picture size", OFFSET(gop_size), FF_OPT_TYPE_INT, 12, INT_MIN, INT_MAX, V|E}, {"g", "set the group of picture size", OFFSET(gop_size), FF_OPT_TYPE_INT, 12, INT_MIN, INT_MAX, V|E},
#if FF_API_RATE_EMU
{"rate_emu", "frame rate emulation", OFFSET(rate_emu), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, {"rate_emu", "frame rate emulation", OFFSET(rate_emu), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
#endif
{"ar", "set audio sampling rate (in Hz)", OFFSET(sample_rate), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, {"ar", "set audio sampling rate (in Hz)", OFFSET(sample_rate), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
{"ac", "set number of audio channels", OFFSET(channels), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, {"ac", "set number of audio channels", OFFSET(channels), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
{"cutoff", "set cutoff bandwidth", OFFSET(cutoff), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, A|E}, {"cutoff", "set cutoff bandwidth", OFFSET(cutoff), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, A|E},
...@@ -125,7 +127,9 @@ static const AVOption options[]={ ...@@ -125,7 +127,9 @@ static const AVOption options[]={
{"rc_strategy", "ratecontrol method", OFFSET(rc_strategy), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"rc_strategy", "ratecontrol method", OFFSET(rc_strategy), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
{"b_strategy", "strategy to choose between I/P/B-frames", OFFSET(b_frame_strategy), FF_OPT_TYPE_INT, 0, INT_MIN, INT_MAX, V|E}, {"b_strategy", "strategy to choose between I/P/B-frames", OFFSET(b_frame_strategy), FF_OPT_TYPE_INT, 0, INT_MIN, INT_MAX, V|E},
{"wpredp", "weighted prediction analysis method", OFFSET(weighted_p_pred), FF_OPT_TYPE_INT, 0, INT_MIN, INT_MAX, V|E}, {"wpredp", "weighted prediction analysis method", OFFSET(weighted_p_pred), FF_OPT_TYPE_INT, 0, INT_MIN, INT_MAX, V|E},
{"hurry_up", NULL, OFFSET(hurry_up), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D}, #if FF_API_HURRY_UP
{"hurry_up", "deprecated, use skip_idct/skip_frame instead", OFFSET(hurry_up), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D},
#endif
{"ps", "rtp payload size in bytes", OFFSET(rtp_payload_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E}, {"ps", "rtp payload size in bytes", OFFSET(rtp_payload_size), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|E},
{"mv_bits", NULL, OFFSET(mv_bits), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, {"mv_bits", NULL, OFFSET(mv_bits), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
{"header_bits", NULL, OFFSET(header_bits), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX}, {"header_bits", NULL, OFFSET(header_bits), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX},
......
...@@ -105,6 +105,7 @@ void ff_fetch_timestamp(AVCodecParserContext *s, int off, int remove){ ...@@ -105,6 +105,7 @@ void ff_fetch_timestamp(AVCodecParserContext *s, int off, int remove){
} }
} }
#if LIBAVCODEC_VERSION_MINOR < 53
/** /**
* *
* @param buf input * @param buf input
...@@ -139,6 +140,7 @@ int av_parser_parse(AVCodecParserContext *s, ...@@ -139,6 +140,7 @@ int av_parser_parse(AVCodecParserContext *s,
{ {
return av_parser_parse2(s, avctx, poutbuf, poutbuf_size, buf, buf_size, pts, dts, AV_NOPTS_VALUE); return av_parser_parse2(s, avctx, poutbuf, poutbuf_size, buf, buf_size, pts, dts, AV_NOPTS_VALUE);
} }
#endif
int av_parser_parse2(AVCodecParserContext *s, int av_parser_parse2(AVCodecParserContext *s,
AVCodecContext *avctx, AVCodecContext *avctx,
......
...@@ -380,7 +380,9 @@ static void update_context_from_user(AVCodecContext *dst, AVCodecContext *src) ...@@ -380,7 +380,9 @@ static void update_context_from_user(AVCodecContext *dst, AVCodecContext *src)
dst->release_buffer = src->release_buffer; dst->release_buffer = src->release_buffer;
dst->opaque = src->opaque; dst->opaque = src->opaque;
#if FF_API_HURRY_UP
dst->hurry_up = src->hurry_up; dst->hurry_up = src->hurry_up;
#endif
dst->dsp_mask = src->dsp_mask; dst->dsp_mask = src->dsp_mask;
dst->debug = src->debug; dst->debug = src->debug;
dst->debug_mv = src->debug_mv; dst->debug_mv = src->debug_mv;
......
...@@ -1454,15 +1454,19 @@ int ff_rv34_decode_frame(AVCodecContext *avctx, ...@@ -1454,15 +1454,19 @@ int ff_rv34_decode_frame(AVCodecContext *avctx,
} }
if((!s->last_picture_ptr || !s->last_picture_ptr->data[0]) && si.type == FF_B_TYPE) if((!s->last_picture_ptr || !s->last_picture_ptr->data[0]) && si.type == FF_B_TYPE)
return -1; return -1;
#if FF_API_HURRY_UP
/* skip b frames if we are in a hurry */ /* skip b frames if we are in a hurry */
if(avctx->hurry_up && si.type==FF_B_TYPE) return buf_size; if(avctx->hurry_up && si.type==FF_B_TYPE) return buf_size;
#endif
if( (avctx->skip_frame >= AVDISCARD_NONREF && si.type==FF_B_TYPE) if( (avctx->skip_frame >= AVDISCARD_NONREF && si.type==FF_B_TYPE)
|| (avctx->skip_frame >= AVDISCARD_NONKEY && si.type!=FF_I_TYPE) || (avctx->skip_frame >= AVDISCARD_NONKEY && si.type!=FF_I_TYPE)
|| avctx->skip_frame >= AVDISCARD_ALL) || avctx->skip_frame >= AVDISCARD_ALL)
return buf_size; return buf_size;
#if FF_API_HURRY_UP
/* skip everything if we are in a hurry>=5 */ /* skip everything if we are in a hurry>=5 */
if(avctx->hurry_up>=5) if(avctx->hurry_up>=5)
return buf_size; return buf_size;
#endif
for(i=0; i<slice_count; i++){ for(i=0; i<slice_count; i++){
int offset= get_slice_offset(avctx, slices_hdr, i); int offset= get_slice_offset(avctx, slices_hdr, i);
......
...@@ -684,7 +684,9 @@ static int svq1_decode_frame(AVCodecContext *avctx, ...@@ -684,7 +684,9 @@ static int svq1_decode_frame(AVCodecContext *avctx,
//this should be removed after libavcodec can handle more flexible picture types & ordering //this should be removed after libavcodec can handle more flexible picture types & ordering
if(s->pict_type==FF_B_TYPE && s->last_picture_ptr==NULL) return buf_size; if(s->pict_type==FF_B_TYPE && s->last_picture_ptr==NULL) return buf_size;
#if FF_API_HURRY_UP
if(avctx->hurry_up && s->pict_type==FF_B_TYPE) return buf_size; if(avctx->hurry_up && s->pict_type==FF_B_TYPE) return buf_size;
#endif
if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE) if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE)
||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE) ||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE)
|| avctx->skip_frame >= AVDISCARD_ALL) || avctx->skip_frame >= AVDISCARD_ALL)
......
...@@ -945,19 +945,21 @@ static int svq3_decode_frame(AVCodecContext *avctx, ...@@ -945,19 +945,21 @@ static int svq3_decode_frame(AVCodecContext *avctx,
s->adaptive_quant, s->qscale, h->slice_num); s->adaptive_quant, s->qscale, h->slice_num);
} }
/* for hurry_up == 5 */ /* for skipping the frame */
s->current_picture.pict_type = s->pict_type; s->current_picture.pict_type = s->pict_type;
s->current_picture.key_frame = (s->pict_type == FF_I_TYPE); s->current_picture.key_frame = (s->pict_type == FF_I_TYPE);
/* Skip B-frames if we do not have reference frames. */ /* Skip B-frames if we do not have reference frames. */
if (s->last_picture_ptr == NULL && s->pict_type == FF_B_TYPE) if (s->last_picture_ptr == NULL && s->pict_type == FF_B_TYPE)
return 0; return 0;
#if FF_API_HURRY_UP
/* Skip B-frames if we are in a hurry. */ /* Skip B-frames if we are in a hurry. */
if (avctx->hurry_up && s->pict_type == FF_B_TYPE) if (avctx->hurry_up && s->pict_type == FF_B_TYPE)
return 0; return 0;
/* Skip everything if we are in a hurry >= 5. */ /* Skip everything if we are in a hurry >= 5. */
if (avctx->hurry_up >= 5) if (avctx->hurry_up >= 5)
return 0; return 0;
#endif
if ( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == FF_B_TYPE) if ( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type == FF_B_TYPE)
||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != FF_I_TYPE) ||(avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type != FF_I_TYPE)
|| avctx->skip_frame >= AVDISCARD_ALL) || avctx->skip_frame >= AVDISCARD_ALL)
......
...@@ -3374,7 +3374,7 @@ static int vc1_decode_frame(AVCodecContext *avctx, ...@@ -3374,7 +3374,7 @@ static int vc1_decode_frame(AVCodecContext *avctx,
goto err; goto err;
} }
// for hurry_up==5 // for skipping the frame
s->current_picture.pict_type= s->pict_type; s->current_picture.pict_type= s->pict_type;
s->current_picture.key_frame= s->pict_type == FF_I_TYPE; s->current_picture.key_frame= s->pict_type == FF_I_TYPE;
...@@ -3382,17 +3382,21 @@ static int vc1_decode_frame(AVCodecContext *avctx, ...@@ -3382,17 +3382,21 @@ static int vc1_decode_frame(AVCodecContext *avctx,
if(s->last_picture_ptr==NULL && (s->pict_type==FF_B_TYPE || s->dropable)){ if(s->last_picture_ptr==NULL && (s->pict_type==FF_B_TYPE || s->dropable)){
goto err; goto err;
} }
#if FF_API_HURRY_UP
/* skip b frames if we are in a hurry */ /* skip b frames if we are in a hurry */
if(avctx->hurry_up && s->pict_type==FF_B_TYPE) return -1;//buf_size; if(avctx->hurry_up && s->pict_type==FF_B_TYPE) return -1;//buf_size;
#endif
if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE) if( (avctx->skip_frame >= AVDISCARD_NONREF && s->pict_type==FF_B_TYPE)
|| (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE) || (avctx->skip_frame >= AVDISCARD_NONKEY && s->pict_type!=FF_I_TYPE)
|| avctx->skip_frame >= AVDISCARD_ALL) { || avctx->skip_frame >= AVDISCARD_ALL) {
goto end; goto end;
} }
#if FF_API_HURRY_UP
/* skip everything if we are in a hurry>=5 */ /* skip everything if we are in a hurry>=5 */
if(avctx->hurry_up>=5) { if(avctx->hurry_up>=5) {
goto err; goto err;
} }
#endif
if(s->next_p_frame_damaged){ if(s->next_p_frame_damaged){
if(s->pict_type==FF_B_TYPE) if(s->pict_type==FF_B_TYPE)
......
...@@ -71,5 +71,11 @@ ...@@ -71,5 +71,11 @@
#ifndef FF_API_OLD_AUDIOCONVERT #ifndef FF_API_OLD_AUDIOCONVERT
#define FF_API_OLD_AUDIOCONVERT (LIBAVCODEC_VERSION_MAJOR < 53) #define FF_API_OLD_AUDIOCONVERT (LIBAVCODEC_VERSION_MAJOR < 53)
#endif #endif
#ifndef FF_API_HURRY_UP
#define FF_API_HURRY_UP (LIBAVCODEC_VERSION_MAJOR < 53)
#endif
#ifndef FF_API_RATE_EMU
#define FF_API_RATE_EMU (LIBAVCODEC_VERSION_MAJOR < 53)
#endif
#endif /* AVCODEC_VERSION_H */ #endif /* AVCODEC_VERSION_H */
...@@ -74,7 +74,7 @@ static int read_header(AVFormatContext *s, ...@@ -74,7 +74,7 @@ static int read_header(AVFormatContext *s,
if (!ast || !vst) if (!ast || !vst)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
vst->codec->codec_type = CODEC_TYPE_VIDEO; vst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
vst->codec->codec_id = CODEC_ID_JV; vst->codec->codec_id = CODEC_ID_JV;
vst->codec->codec_tag = 0; /* no fourcc */ vst->codec->codec_tag = 0; /* no fourcc */
vst->codec->width = avio_rl16(pb); vst->codec->width = avio_rl16(pb);
...@@ -85,7 +85,7 @@ static int read_header(AVFormatContext *s, ...@@ -85,7 +85,7 @@ static int read_header(AVFormatContext *s,
avio_skip(pb, 4); avio_skip(pb, 4);
ast->codec->codec_type = CODEC_TYPE_AUDIO; ast->codec->codec_type = AVMEDIA_TYPE_AUDIO;
ast->codec->codec_id = CODEC_ID_PCM_U8; ast->codec->codec_id = CODEC_ID_PCM_U8;
ast->codec->codec_tag = 0; /* no fourcc */ ast->codec->codec_tag = 0; /* no fourcc */
ast->codec->sample_rate = avio_rl16(pb); ast->codec->sample_rate = avio_rl16(pb);
...@@ -151,7 +151,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -151,7 +151,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
pkt->stream_index = 0; pkt->stream_index = 0;
pkt->pts = e->timestamp; pkt->pts = e->timestamp;
pkt->flags |= PKT_FLAG_KEY; pkt->flags |= AV_PKT_FLAG_KEY;
return 0; return 0;
} }
case JV_VIDEO: case JV_VIDEO:
...@@ -170,7 +170,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt) ...@@ -170,7 +170,7 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
pkt->stream_index = 1; pkt->stream_index = 1;
pkt->pts = jv->pts; pkt->pts = jv->pts;
if (jvf->video_type != 1) if (jvf->video_type != 1)
pkt->flags |= PKT_FLAG_KEY; pkt->flags |= AV_PKT_FLAG_KEY;
return 0; return 0;
} }
case JV_PADDING: case JV_PADDING:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment