]> git.sesse.net Git - ffmpeg/commitdiff
Merge remote-tracking branch 'qatar/master'
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 13 Jan 2012 00:07:30 +0000 (01:07 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 13 Jan 2012 00:29:48 +0000 (01:29 +0100)
* qatar/master: (21 commits)
  utils: Check for extradata size overflows.
  ARM: rv34: fix asm syntax in dc transform functions
  avio: Fix the value of the deprecated URL_FLAG_NONBLOCK
  rv34: fix and optimise frame dependency checking
  rv34: NEON optimised dc only inverse transform
  avprobe: use avio_size() instead of deprecated AVFormatContext.file_size.
  ffmenc: remove references to deprecated AVFormatContext.timestamp.
  lavf: undeprecate read_seek().
  avserver: remove code using deprecated CODEC_CAP_PARSE_ONLY.
  lavc: replace some remaining FF_I_TYPE with AV_PICTURE_TYPE_I
  lavc: ifdef out parse_only AVOption
  nellymoserdec: SAMPLE_FMT -> AV_SAMPLE_FMT
  mpegvideo_enc: ifdef out/replace references to deprecated codec flags.
  riff: remove references to sonic codec ids
  indeo4: add some missing static and const qualifiers
  rv34: DC-only inverse transform
  avconv: use AVFrame.width/height/format instead of corresponding AVCodecContext fields
  lavfi: move version macros to a new installed header version.h
  vsrc_buffer: release the buffer on uninit.
  rgb2rgb: rgb12tobgr12()
  ...

Conflicts:
avconv.c
doc/APIchanges
ffprobe.c
libavfilter/Makefile
libavfilter/avfilter.h
libswscale/rgb2rgb.c
libswscale/rgb2rgb.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
30 files changed:
avconv.c
doc/APIchanges
ffmpeg.c
ffprobe.c
ffserver.c
libavcodec/aacdec.c
libavcodec/arm/rv34dsp_init_neon.c
libavcodec/arm/rv34dsp_neon.S
libavcodec/internal.h
libavcodec/mpegvideo_enc.c
libavcodec/options.c
libavcodec/rv34.c
libavcodec/rv34data.h
libavcodec/rv34dsp.c
libavcodec/rv34dsp.h
libavcodec/utils.c
libavcodec/x86/Makefile
libavcodec/x86/rv34dsp.asm [new file with mode: 0644]
libavcodec/x86/rv34dsp_init.c [new file with mode: 0644]
libavfilter/Makefile
libavfilter/avfilter.h
libavfilter/version.h [new file with mode: 0644]
libavfilter/vsrc_buffer.c
libavformat/avformat.h
libavformat/avio.h
libavformat/ffmenc.c
libavformat/riff.c
libavformat/utils.c
libavformat/version.h
libswscale/rgb2rgb.c

index 5f0422cc5dda1409d2e751d9450e984b370d0c0e..0c6ef6d82df9000b9ed6e31ff7c538a238fdedf2 100644 (file)
--- a/avconv.c
+++ b/avconv.c
@@ -1316,19 +1316,20 @@ static void do_video_resample(OutputStream *ost,
     AVCodecContext *enc = ost->st->codec;
     *out_picture = in_picture;
 
-    resample_changed = ost->resample_width   != dec->width  ||
-                       ost->resample_height  != dec->height ||
-                       ost->resample_pix_fmt != dec->pix_fmt;
+    resample_changed = ost->resample_width   != in_picture->width  ||
+                       ost->resample_height  != in_picture->height ||
+                       ost->resample_pix_fmt != in_picture->format;
 
     if (resample_changed) {
         av_log(NULL, AV_LOG_INFO,
-               "Input stream #%d:%d frame changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s\n",
+               "Input stream #%d:%d frame changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s / frm size:%dx%d fmt:%s\n",
                ist->file_index, ist->st->index,
                ost->resample_width, ost->resample_height, av_get_pix_fmt_name(ost->resample_pix_fmt),
-               dec->width         , dec->height         , av_get_pix_fmt_name(dec->pix_fmt));
-        ost->resample_width   = dec->width;
-        ost->resample_height  = dec->height;
-        ost->resample_pix_fmt = dec->pix_fmt;
+               dec->width         , dec->height         , av_get_pix_fmt_name(dec->pix_fmt),
+               in_picture->width, in_picture->height, av_get_pix_fmt_name(in_picture->format));
+        ost->resample_width   = in_picture->width;
+        ost->resample_height  = in_picture->height;
+        ost->resample_pix_fmt = in_picture->format;
     }
 
     ost->video_resample = dec->width   != enc->width  ||
@@ -1362,9 +1363,9 @@ static void do_video_resample(OutputStream *ost,
               0, ost->resample_height, (*out_picture)->data, (*out_picture)->linesize);
     }
     if (resample_changed) {
-        ost->resample_width   = dec->width;
-        ost->resample_height  = dec->height;
-        ost->resample_pix_fmt = dec->pix_fmt;
+        ost->resample_width   = in_picture->width;
+        ost->resample_height  = in_picture->height;
+        ost->resample_pix_fmt = in_picture->format;
     }
 }
 #endif
index b146cb00ad785b34de6587d776dddbc0074a8bb9..3b3da66eee1f2562998b1074641f94c55b3dc9f8 100644 (file)
@@ -13,6 +13,9 @@ libavutil:   2011-04-18
 
 API changes, most recent first:
 
+2012-01-xx - xxxxxxx - lavfi 2.15.0
+  Add a new installed header -- libavfilter/version.h -- with version macros.
+
 2011-12-08 - a502939 - lavfi 2.52.0
   Add av_buffersink_poll_frame() to buffersink.h.
 
index 884abdee6c861131aeb581ff14ba3979443d5b19..997333ec4afc110242885403c9a2d53c4e7699b7 100644 (file)
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1365,25 +1365,26 @@ static void do_video_resample(OutputStream *ost,
 #else
     AVCodecContext *dec = ist->st->codec;
     AVCodecContext *enc = ost->st->codec;
-    int resample_changed = ost->resample_width   != dec->width  ||
-                           ost->resample_height  != dec->height ||
-                           ost->resample_pix_fmt != dec->pix_fmt;
+    int resample_changed = ost->resample_width   != in_picture->width  ||
+                           ost->resample_height  != in_picture->height ||
+                           ost->resample_pix_fmt != in_picture->format;
 
     *out_picture = in_picture;
     if (resample_changed) {
         av_log(NULL, AV_LOG_INFO,
-               "Input stream #%d:%d frame changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s\n",
+               "Input stream #%d:%d frame changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s / frm size:%dx%d fmt:%s\n",
                ist->file_index, ist->st->index,
                ost->resample_width, ost->resample_height, av_get_pix_fmt_name(ost->resample_pix_fmt),
-               dec->width         , dec->height         , av_get_pix_fmt_name(dec->pix_fmt));
-        ost->resample_width   = dec->width;
-        ost->resample_height  = dec->height;
-        ost->resample_pix_fmt = dec->pix_fmt;
+               dec->width         , dec->height         , av_get_pix_fmt_name(dec->pix_fmt),
+               in_picture->width, in_picture->height, av_get_pix_fmt_name(in_picture->format));
+        ost->resample_width   = in_picture->width;
+        ost->resample_height  = in_picture->height;
+        ost->resample_pix_fmt = in_picture->format;
     }
 
-    ost->video_resample = dec->width   != enc->width  ||
-                          dec->height  != enc->height ||
-                          dec->pix_fmt != enc->pix_fmt;
+    ost->video_resample = in_picture->width   != enc->width  ||
+                          in_picture->height  != enc->height ||
+                          in_picture->format  != enc->pix_fmt;
 
     if (ost->video_resample) {
         *out_picture = &ost->resample_frame;
@@ -1399,7 +1400,7 @@ static void do_video_resample(OutputStream *ost,
             }
             /* initialize a new scaler context */
             sws_freeContext(ost->img_resample_ctx);
-            ost->img_resample_ctx = sws_getContext(dec->width, dec->height, dec->pix_fmt,
+            ost->img_resample_ctx = sws_getContext(in_picture->width, in_picture->height, in_picture->format,
                                                    enc->width, enc->height, enc->pix_fmt,
                                                    ost->sws_flags, NULL, NULL, NULL);
             if (ost->img_resample_ctx == NULL) {
index 954a829c4bad6a49488ab32a2db30b1a6c287e7c..61c66aef1a22b971bef109aca3bd7ca643d1f270 100644 (file)
--- a/ffprobe.c
+++ b/ffprobe.c
@@ -1516,7 +1516,7 @@ static void show_streams(WriterContext *w, AVFormatContext *fmt_ctx)
 static void show_format(WriterContext *w, AVFormatContext *fmt_ctx)
 {
     char val_str[128];
-    int64_t size = avio_size(fmt_ctx->pb);
+    int64_t size = fmt_ctx->pb ? avio_size(fmt_ctx->pb) : -1;
 
     print_section_header("format");
     print_str("filename",         fmt_ctx->filename);
index 80a36c7b0cd2c437cc0111e19d98dfc9405343d3..c225a94e3b2bdbf47131674c57b5d441af668d14 100644 (file)
@@ -2119,22 +2119,6 @@ static void compute_status(HTTPContext *c)
     c->buffer_end = c->pb_buffer + len;
 }
 
-/* check if the parser needs to be opened for stream i */
-static void open_parser(AVFormatContext *s, int i)
-{
-    AVStream *st = s->streams[i];
-    AVCodec *codec;
-
-    if (!st->codec->codec) {
-        codec = avcodec_find_decoder(st->codec->codec_id);
-        if (codec && (codec->capabilities & CODEC_CAP_PARSE_ONLY)) {
-            st->codec->parse_only = 1;
-            if (avcodec_open2(st->codec, codec, NULL) < 0)
-                st->codec->parse_only = 0;
-        }
-    }
-}
-
 static int open_input_stream(HTTPContext *c, const char *info)
 {
     char buf[128];
@@ -2180,10 +2164,6 @@ static int open_input_stream(HTTPContext *c, const char *info)
         return -1;
     }
 
-    /* open each parser */
-    for(i=0;i<s->nb_streams;i++)
-        open_parser(s, i);
-
     /* choose stream as clock source (we favorize video stream if
        present) for packet sending */
     c->pts_stream_index = 0;
index b7f76a61daa44eb7775eb9d607441d849a698eef..77ee59f0abc783cdf2b2ac08ef396d50dce7ae41 100644 (file)
@@ -2393,6 +2393,8 @@ static int latm_decode_audio_specific_config(struct LATMContext *latmctx,
                                "config not byte aligned.\n", 1);
         return AVERROR_INVALIDDATA;
     }
+    if (asclen <= 0)
+        return AVERROR_INVALIDDATA;
     bits_consumed = decode_audio_specific_config(NULL, avctx, &m4ac,
                                          gb->buffer + (config_start_bit / 8),
                                          asclen, sync_extension);
index 9a09fde7a92b48bb723ece92724c0a8ff49abcd9..16bda46658dac08f7aa66a3cfcfe45b9fda4ac8b 100644 (file)
 void ff_rv34_inv_transform_neon(DCTELEM *block);
 void ff_rv34_inv_transform_noround_neon(DCTELEM *block);
 
+void ff_rv34_inv_transform_dc_neon(DCTELEM *block);
+void ff_rv34_inv_transform_noround_dc_neon(DCTELEM *block);
+
 void ff_rv34dsp_init_neon(RV34DSPContext *c, DSPContext* dsp)
 {
-    c->rv34_inv_transform_tab[0] = ff_rv34_inv_transform_neon;
-    c->rv34_inv_transform_tab[1] = ff_rv34_inv_transform_noround_neon;
+    c->rv34_inv_transform_tab[0]    = ff_rv34_inv_transform_neon;
+    c->rv34_inv_transform_tab[1]    = ff_rv34_inv_transform_noround_neon;
+    c->rv34_inv_transform_dc_tab[0] = ff_rv34_inv_transform_dc_neon;
+    c->rv34_inv_transform_dc_tab[1] = ff_rv34_inv_transform_noround_dc_neon;
 }
index f700f5c321861a393dea8fe4544886df09e6fa38..1e8d4b49a1f1b425314029a09cb557dc06434ec1 100644 (file)
@@ -107,3 +107,32 @@ function ff_rv34_inv_transform_noround_neon, export=1
         vst4.16         {d0[3], d1[3], d2[3], d3[3]}, [r2,:64], r1
         bx              lr
 endfunc
+
+/* void rv34_inv_transform_dc_c(DCTELEM *block) */
+function ff_rv34_inv_transform_dc_neon, export=1
+        vld1.16         {d28[]}, [r0,:16]       @ block[0]
+        vmov.i16        d4,  #169
+        mov             r1,  #16
+        vmull.s16       q3,  d28, d4
+        vrshrn.s32      d0,  q3,  #10
+        vst1.16         {d0}, [r0,:64], r1
+        vst1.16         {d0}, [r0,:64], r1
+        vst1.16         {d0}, [r0,:64], r1
+        vst1.16         {d0}, [r0,:64], r1
+        bx              lr
+endfunc
+
+/* void rv34_inv_transform_dc_noround_c(DCTELEM *block) */
+function ff_rv34_inv_transform_noround_dc_neon, export=1
+        vld1.16         {d28[]}, [r0,:16]       @ block[0]
+        vmov.i16        d4,  #251
+        vorr.s16        d4,  #256               @ 13^2 * 3
+        mov             r1,  #16
+        vmull.s16       q3,  d28, d4
+        vshrn.s32       d0,  q3,  #11
+        vst1.64         {d0}, [r0,:64], r1
+        vst1.64         {d0}, [r0,:64], r1
+        vst1.64         {d0}, [r0,:64], r1
+        vst1.64         {d0}, [r0,:64], r1
+        bx              lr
+endfunc
index 13deb871203efe41a0c67de82570aaf469eb5d2e..068b34bbaa40bbee78162aa3ef3a7bc378258201 100644 (file)
@@ -99,4 +99,11 @@ void ff_init_buffer_info(AVCodecContext *s, AVFrame *pic);
 int avpriv_lock_avformat(void);
 int avpriv_unlock_avformat(void);
 
+/**
+ * Maximum size in bytes of extradata.
+ * This value was chosen such that every bit of the buffer is
+ * addressable by a 32-bit signed integer as used by get_bits.
+ */
+#define FF_MAX_EXTRADATA_SIZE ((1 << 28) - FF_INPUT_BUFFER_PADDING_SIZE)
+
 #endif /* AVCODEC_INTERNAL_H */
index a02dd7bdb4f25dba1c4a7e06f8273554ccc7f086..ab611baea1981e2aca36115ced3729a5815ca258 100644 (file)
@@ -500,8 +500,11 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
                    avctx->sample_aspect_ratio.num,  avctx->sample_aspect_ratio.den, 255);
     }
 
-    if ((s->flags & (CODEC_FLAG_INTERLACED_DCT | CODEC_FLAG_INTERLACED_ME |
-                     CODEC_FLAG_ALT_SCAN)) &&
+    if ((s->flags & (CODEC_FLAG_INTERLACED_DCT | CODEC_FLAG_INTERLACED_ME
+#if FF_API_MPEGVIDEO_GLOBAL_OPTS
+                    | CODEC_FLAG_ALT_SCAN
+#endif
+        )) &&
         s->codec_id != CODEC_ID_MPEG4 && s->codec_id != CODEC_ID_MPEG2VIDEO) {
         av_log(avctx, AV_LOG_ERROR, "interlacing not supported by codec\n");
         return -1;
@@ -533,12 +536,14 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
         return -1;
     }
 
+#if FF_API_MPEGVIDEO_GLOBAL_OPTS
     if ((s->flags2 & CODEC_FLAG2_INTRA_VLC) &&
         s->codec_id != CODEC_ID_MPEG2VIDEO) {
         av_log(avctx, AV_LOG_ERROR,
                "intra vlc table not supported by codec\n");
         return -1;
     }
+#endif
 
     if (s->flags & CODEC_FLAG_LOW_DELAY) {
         if (s->codec_id != CODEC_ID_MPEG2VIDEO) {
@@ -572,8 +577,11 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
         s->codec_id != CODEC_ID_MPEG4      &&
         s->codec_id != CODEC_ID_MPEG1VIDEO &&
         s->codec_id != CODEC_ID_MPEG2VIDEO &&
-        (s->codec_id != CODEC_ID_H263P ||
-         !(s->flags & CODEC_FLAG_H263P_SLICE_STRUCT))) {
+        (s->codec_id != CODEC_ID_H263P
+#if FF_API_MPEGVIDEO_GLOBAL_OPTS
+         || !(s->flags & CODEC_FLAG_H263P_SLICE_STRUCT)
+#endif
+         )) {
         av_log(avctx, AV_LOG_ERROR,
                "multi threaded encoding not supported by codec\n");
         return -1;
@@ -813,8 +821,8 @@ av_cold int MPV_encode_init(AVCodecContext *avctx)
 
     s->progressive_frame    =
     s->progressive_sequence = !(avctx->flags & (CODEC_FLAG_INTERLACED_DCT |
-                                                CODEC_FLAG_INTERLACED_ME  |
-                                                CODEC_FLAG_ALT_SCAN));
+                                                CODEC_FLAG_INTERLACED_ME) ||
+                                s->alternate_scan);
 
     /* init */
     if (MPV_common_init(s) < 0)
index 27c8e502b8026a25eebeaeed72ca6be56c4d790b..b1efc866ddd1c157a22ab5e5dd464fa25650943e 100644 (file)
@@ -216,7 +216,9 @@ static const AVOption options[]={
 {"explode", "abort decoding on minor error recognition", 0, AV_OPT_TYPE_CONST, {.dbl = AV_EF_EXPLODE }, INT_MIN, INT_MAX, V|D, "err_filter"},
 {"has_b_frames", NULL, OFFSET(has_b_frames), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX},
 {"block_align", NULL, OFFSET(block_align), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX},
+#if FF_API_PARSE_FRAME
 {"parse_only", NULL, OFFSET(parse_only), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX},
+#endif
 {"mpeg_quant", "use MPEG quantizers instead of H.263", OFFSET(mpeg_quant), AV_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
 {"stats_out", NULL, OFFSET(stats_out), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX},
 {"stats_in", NULL, OFFSET(stats_in), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX},
index 805f407102972465f9bb6888d75d7d9cec8a680f..2be9b3cd388a61b074378bfa5d8dd97a7f73c1f2 100644 (file)
@@ -204,7 +204,7 @@ static int rv34_decode_cbp(GetBitContext *gb, RV34VLC *vlc, int table)
     }
 
     for(i = 0; i < 4; i++){
-        t = modulo_three_table[code][i];
+        t = (modulo_three_table[code] >> (6 - 2*i)) & 3;
         if(t == 1)
             cbp |= cbp_masks[get_bits1(gb)] << i;
         if(t == 2)
@@ -238,41 +238,42 @@ static inline void decode_coeff(DCTELEM *dst, int coef, int esc, GetBitContext *
  */
 static inline void decode_subblock(DCTELEM *dst, int code, const int is_block2, GetBitContext *gb, VLC *vlc, int q)
 {
-    int coeffs[4];
+    int flags = modulo_three_table[code];
 
-    coeffs[0] = modulo_three_table[code][0];
-    coeffs[1] = modulo_three_table[code][1];
-    coeffs[2] = modulo_three_table[code][2];
-    coeffs[3] = modulo_three_table[code][3];
-    decode_coeff(dst  , coeffs[0], 3, gb, vlc, q);
+    decode_coeff(    dst+0, (flags >> 6)    , 3, gb, vlc, q);
     if(is_block2){
-        decode_coeff(dst+8, coeffs[1], 2, gb, vlc, q);
-        decode_coeff(dst+1, coeffs[2], 2, gb, vlc, q);
+        decode_coeff(dst+8, (flags >> 4) & 3, 2, gb, vlc, q);
+        decode_coeff(dst+1, (flags >> 2) & 3, 2, gb, vlc, q);
     }else{
-        decode_coeff(dst+1, coeffs[1], 2, gb, vlc, q);
-        decode_coeff(dst+8, coeffs[2], 2, gb, vlc, q);
+        decode_coeff(dst+1, (flags >> 4) & 3, 2, gb, vlc, q);
+        decode_coeff(dst+8, (flags >> 2) & 3, 2, gb, vlc, q);
     }
-    decode_coeff(dst+9, coeffs[3], 2, gb, vlc, q);
+    decode_coeff(    dst+9, (flags >> 0) & 3, 2, gb, vlc, q);
+}
+
+/**
+ * Decode a single coefficient.
+ */
+static inline void decode_subblock1(DCTELEM *dst, int code, GetBitContext *gb, VLC *vlc, int q)
+{
+    int coeff = modulo_three_table[code] >> 6;
+    decode_coeff(dst, coeff, 3, gb, vlc, q);
 }
 
 static inline void decode_subblock3(DCTELEM *dst, int code, const int is_block2, GetBitContext *gb, VLC *vlc,
                                     int q_dc, int q_ac1, int q_ac2)
 {
-    int coeffs[4];
+    int flags = modulo_three_table[code];
 
-    coeffs[0] = modulo_three_table[code][0];
-    coeffs[1] = modulo_three_table[code][1];
-    coeffs[2] = modulo_three_table[code][2];
-    coeffs[3] = modulo_three_table[code][3];
-    decode_coeff(dst  , coeffs[0], 3, gb, vlc, q_dc);
+    decode_coeff(    dst+0, (flags >> 6)    , 3, gb, vlc, q_dc);
     if(is_block2){
-        decode_coeff(dst+8, coeffs[1], 2, gb, vlc, q_ac1);
-        decode_coeff(dst+1, coeffs[2], 2, gb, vlc, q_ac1);
+        decode_coeff(dst+8, (flags >> 4) & 3, 2, gb, vlc, q_ac1);
+        decode_coeff(dst+1, (flags >> 2) & 3, 2, gb, vlc, q_ac1);
     }else{
-        decode_coeff(dst+1, coeffs[1], 2, gb, vlc, q_ac1);
-        decode_coeff(dst+8, coeffs[2], 2, gb, vlc, q_ac1);
+        decode_coeff(dst+1, (flags >> 4) & 3, 2, gb, vlc, q_ac1);
+        decode_coeff(dst+8, (flags >> 2) & 3, 2, gb, vlc, q_ac1);
     }
-    decode_coeff(dst+9, coeffs[3], 2, gb, vlc, q_ac2);
+    decode_coeff(    dst+9, (flags >> 0) & 3, 2, gb, vlc, q_ac2);
 }
 
 /**
@@ -286,16 +287,24 @@ static inline void decode_subblock3(DCTELEM *dst, int code, const int is_block2,
  *  o--o
  */
 
-static inline void rv34_decode_block(DCTELEM *dst, GetBitContext *gb, RV34VLC *rvlc, int fc, int sc, int q_dc, int q_ac1, int q_ac2)
+static inline int rv34_decode_block(DCTELEM *dst, GetBitContext *gb, RV34VLC *rvlc, int fc, int sc, int q_dc, int q_ac1, int q_ac2)
 {
-    int code, pattern;
+    int code, pattern, has_ac = 1;
 
     code = get_vlc2(gb, rvlc->first_pattern[fc].table, 9, 2);
 
     pattern = code & 0x7;
 
     code >>= 3;
-    decode_subblock3(dst, code, 0, gb, &rvlc->coefficient, q_dc, q_ac1, q_ac2);
+
+    if (modulo_three_table[code] & 0x3F) {
+        decode_subblock3(dst, code, 0, gb, &rvlc->coefficient, q_dc, q_ac1, q_ac2);
+    } else {
+        decode_subblock1(dst, code, gb, &rvlc->coefficient, q_dc);
+        if (!pattern)
+            return 0;
+        has_ac = 0;
+    }
 
     if(pattern & 4){
         code = get_vlc2(gb, rvlc->second_pattern[sc].table, 9, 2);
@@ -309,7 +318,7 @@ static inline void rv34_decode_block(DCTELEM *dst, GetBitContext *gb, RV34VLC *r
         code = get_vlc2(gb, rvlc->third_pattern[sc].table, 9, 2);
         decode_subblock(dst + 8*2+2, code, 0, gb, &rvlc->coefficient, q_ac2);
     }
-
+    return has_ac || pattern;
 }
 
 /**
@@ -676,7 +685,8 @@ static inline void rv34_mc(RV34DecContext *r, const int block_type,
 
     if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME)) {
         /* wait for the referenced mb row to be finished */
-        int mb_row = FFMIN(s->mb_height - 1, s->mb_y + ((yoff + my + 21) >> 4));
+        int mb_row = FFMIN(s->mb_height - 1,
+                           s->mb_y + ((yoff + my + 5 + 8 * height) >> 4));
         AVFrame *f = dir ? &s->next_picture_ptr->f : &s->last_picture_ptr->f;
         ff_thread_await_progress(f, mb_row, 0);
     }
@@ -838,7 +848,7 @@ static int rv34_decode_mv(RV34DecContext *r, int block_type)
         //surprisingly, it uses motion scheme from next reference frame
         /* wait for the current mb row to be finished */
         if (HAVE_THREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME))
-            ff_thread_await_progress(&s->next_picture_ptr->f, s->mb_y - 1, 0);
+            ff_thread_await_progress(&s->next_picture_ptr->f, FFMAX(0, s->mb_y-1), 0);
 
         next_bt = s->next_picture_ptr->f.mb_type[s->mb_x + s->mb_y * s->mb_stride];
         if(IS_INTRA(next_bt) || IS_SKIP(next_bt)){
@@ -1118,7 +1128,7 @@ static int rv34_decode_macroblock(RV34DecContext *r, int8_t *intra_types)
     MpegEncContext *s = &r->s;
     GetBitContext *gb = &s->gb;
     int cbp, cbp2;
-    int q_dc, q_ac;
+    int q_dc, q_ac, has_ac;
     int i, blknum, blkoff;
     LOCAL_ALIGNED_16(DCTELEM, block16, [64]);
     int luma_dc_quant;
@@ -1157,33 +1167,45 @@ static int rv34_decode_macroblock(RV34DecContext *r, int8_t *intra_types)
     if(r->is16){
         q_dc = rv34_qscale_tab[luma_dc_quant];
         q_ac = rv34_qscale_tab[s->qscale];
-        memset(block16, 0, 64 * sizeof(*block16));
-        rv34_decode_block(block16, gb, r->cur_vlcs, 3, 0, q_dc, q_dc, q_ac);
-        r->rdsp.rv34_inv_transform_tab[1](block16);
+        s->dsp.clear_block(block16);
+        if (rv34_decode_block(block16, gb, r->cur_vlcs, 3, 0, q_dc, q_dc, q_ac))
+            r->rdsp.rv34_inv_transform_tab[1](block16);
+        else
+            r->rdsp.rv34_inv_transform_dc_tab[1](block16);
     }
 
     q_ac = rv34_qscale_tab[s->qscale];
     for(i = 0; i < 16; i++, cbp >>= 1){
+        DCTELEM *ptr;
         if(!r->is16 && !(cbp & 1)) continue;
         blknum = ((i & 2) >> 1) + ((i & 8) >> 2);
         blkoff = ((i & 1) << 2) + ((i & 4) << 3);
+        ptr    = s->block[blknum] + blkoff;
         if(cbp & 1)
-            rv34_decode_block(s->block[blknum] + blkoff, gb,
-                              r->cur_vlcs, r->luma_vlc, 0, q_ac, q_ac, q_ac);
+            has_ac = rv34_decode_block(ptr, gb, r->cur_vlcs, r->luma_vlc, 0, q_ac, q_ac, q_ac);
+        else
+            has_ac = 0;
         if(r->is16) //FIXME: optimize
-            s->block[blknum][blkoff] = block16[(i & 3) | ((i & 0xC) << 1)];
-        r->rdsp.rv34_inv_transform_tab[0](s->block[blknum] + blkoff);
+            ptr[0] = block16[(i & 3) | ((i & 0xC) << 1)];
+        if(has_ac)
+            r->rdsp.rv34_inv_transform_tab[0](ptr);
+        else
+            r->rdsp.rv34_inv_transform_dc_tab[0](ptr);
     }
     if(r->block_type == RV34_MB_P_MIX16x16)
         r->cur_vlcs = choose_vlc_set(r->si.quant, r->si.vlc_set, 1);
     q_dc = rv34_qscale_tab[rv34_chroma_quant[1][s->qscale]];
     q_ac = rv34_qscale_tab[rv34_chroma_quant[0][s->qscale]];
     for(; i < 24; i++, cbp >>= 1){
+        DCTELEM *ptr;
         if(!(cbp & 1)) continue;
         blknum = ((i & 4) >> 2) + 4;
         blkoff = ((i & 1) << 2) + ((i & 2) << 4);
-        rv34_decode_block(s->block[blknum] + blkoff, gb, r->cur_vlcs, r->chroma_vlc, 1, q_dc, q_ac, q_ac);
-        r->rdsp.rv34_inv_transform_tab[0](s->block[blknum] + blkoff);
+        ptr    = s->block[blknum] + blkoff;
+        if (rv34_decode_block(ptr, gb, r->cur_vlcs, r->chroma_vlc, 1, q_dc, q_ac, q_ac))
+            r->rdsp.rv34_inv_transform_tab[0](ptr);
+        else
+            r->rdsp.rv34_inv_transform_dc_tab[0](ptr);
     }
     if (IS_INTRA(s->current_picture_ptr->f.mb_type[mb_pos]))
         rv34_output_macroblock(r, intra_types, cbp2, r->is16);
index 1b608e7e3569b2255bdb791fe28afbd301520456..8be26a3943183980c3a1a22e7e51cd36fa48ea28 100644 (file)
@@ -50,34 +50,22 @@ static const uint8_t rv34_cbp_code[16] = {
  * A lot of four-tuples in RV40 are represented as c0*27+c1*9+c2*3+c3.
  * This table allows conversion from a value back to a vector.
  */
-static const uint8_t modulo_three_table[108][4] = {
- { 0, 0, 0, 0 }, { 0, 0, 0, 1 }, { 0, 0, 0, 2 }, { 0, 0, 1, 0 },
- { 0, 0, 1, 1 }, { 0, 0, 1, 2 }, { 0, 0, 2, 0 }, { 0, 0, 2, 1 },
- { 0, 0, 2, 2 }, { 0, 1, 0, 0 }, { 0, 1, 0, 1 }, { 0, 1, 0, 2 },
- { 0, 1, 1, 0 }, { 0, 1, 1, 1 }, { 0, 1, 1, 2 }, { 0, 1, 2, 0 },
- { 0, 1, 2, 1 }, { 0, 1, 2, 2 }, { 0, 2, 0, 0 }, { 0, 2, 0, 1 },
- { 0, 2, 0, 2 }, { 0, 2, 1, 0 }, { 0, 2, 1, 1 }, { 0, 2, 1, 2 },
- { 0, 2, 2, 0 }, { 0, 2, 2, 1 }, { 0, 2, 2, 2 }, { 1, 0, 0, 0 },
- { 1, 0, 0, 1 }, { 1, 0, 0, 2 }, { 1, 0, 1, 0 }, { 1, 0, 1, 1 },
- { 1, 0, 1, 2 }, { 1, 0, 2, 0 }, { 1, 0, 2, 1 }, { 1, 0, 2, 2 },
- { 1, 1, 0, 0 }, { 1, 1, 0, 1 }, { 1, 1, 0, 2 }, { 1, 1, 1, 0 },
- { 1, 1, 1, 1 }, { 1, 1, 1, 2 }, { 1, 1, 2, 0 }, { 1, 1, 2, 1 },
- { 1, 1, 2, 2 }, { 1, 2, 0, 0 }, { 1, 2, 0, 1 }, { 1, 2, 0, 2 },
- { 1, 2, 1, 0 }, { 1, 2, 1, 1 }, { 1, 2, 1, 2 }, { 1, 2, 2, 0 },
- { 1, 2, 2, 1 }, { 1, 2, 2, 2 }, { 2, 0, 0, 0 }, { 2, 0, 0, 1 },
- { 2, 0, 0, 2 }, { 2, 0, 1, 0 }, { 2, 0, 1, 1 }, { 2, 0, 1, 2 },
- { 2, 0, 2, 0 }, { 2, 0, 2, 1 }, { 2, 0, 2, 2 }, { 2, 1, 0, 0 },
- { 2, 1, 0, 1 }, { 2, 1, 0, 2 }, { 2, 1, 1, 0 }, { 2, 1, 1, 1 },
- { 2, 1, 1, 2 }, { 2, 1, 2, 0 }, { 2, 1, 2, 1 }, { 2, 1, 2, 2 },
- { 2, 2, 0, 0 }, { 2, 2, 0, 1 }, { 2, 2, 0, 2 }, { 2, 2, 1, 0 },
- { 2, 2, 1, 1 }, { 2, 2, 1, 2 }, { 2, 2, 2, 0 }, { 2, 2, 2, 1 },
- { 2, 2, 2, 2 }, { 3, 0, 0, 0 }, { 3, 0, 0, 1 }, { 3, 0, 0, 2 },
- { 3, 0, 1, 0 }, { 3, 0, 1, 1 }, { 3, 0, 1, 2 }, { 3, 0, 2, 0 },
- { 3, 0, 2, 1 }, { 3, 0, 2, 2 }, { 3, 1, 0, 0 }, { 3, 1, 0, 1 },
- { 3, 1, 0, 2 }, { 3, 1, 1, 0 }, { 3, 1, 1, 1 }, { 3, 1, 1, 2 },
- { 3, 1, 2, 0 }, { 3, 1, 2, 1 }, { 3, 1, 2, 2 }, { 3, 2, 0, 0 },
- { 3, 2, 0, 1 }, { 3, 2, 0, 2 }, { 3, 2, 1, 0 }, { 3, 2, 1, 1 },
- { 3, 2, 1, 2 }, { 3, 2, 2, 0 }, { 3, 2, 2, 1 }, { 3, 2, 2, 2 },
+static const uint8_t modulo_three_table[108] = {
+    0x00, 0x01, 0x02, 0x04, 0x05, 0x06, 0x08, 0x09, 0x0A,
+    0x10, 0x11, 0x12, 0x14, 0x15, 0x16, 0x18, 0x19, 0x1A,
+    0x20, 0x21, 0x22, 0x24, 0x25, 0x26, 0x28, 0x29, 0x2A,
+
+    0x40, 0x41, 0x42, 0x44, 0x45, 0x46, 0x48, 0x49, 0x4A,
+    0x50, 0x51, 0x52, 0x54, 0x55, 0x56, 0x58, 0x59, 0x5A,
+    0x60, 0x61, 0x62, 0x64, 0x65, 0x66, 0x68, 0x69, 0x6A,
+
+    0x80, 0x81, 0x82, 0x84, 0x85, 0x86, 0x88, 0x89, 0x8A,
+    0x90, 0x91, 0x92, 0x94, 0x95, 0x96, 0x98, 0x99, 0x9A,
+    0xA0, 0xA1, 0xA2, 0xA4, 0xA5, 0xA6, 0xA8, 0xA9, 0xAA,
+
+    0xC0, 0xC1, 0xC2, 0xC4, 0xC5, 0xC6, 0xC8, 0xC9, 0xCA,
+    0xD0, 0xD1, 0xD2, 0xD4, 0xD5, 0xD6, 0xD8, 0xD9, 0xDA,
+    0xE0, 0xE1, 0xE2, 0xE4, 0xE5, 0xE6, 0xE8, 0xE9, 0xEA,
 };
 
 /**
index 1f4cea8544f5c8af6bbe23acc2b9aa6e717c1f09..1767be4173e4db32a42606cc427bf08d86e2381b 100644 (file)
@@ -97,13 +97,37 @@ static void rv34_inv_transform_noround_c(DCTELEM *block){
     }
 }
 
+static void rv34_inv_transform_dc_c(DCTELEM *block)
+{
+    DCTELEM dc = (13 * 13 * block[0] + 0x200) >> 10;
+    int i, j;
+
+    for (i = 0; i < 4; i++, block += 8)
+        for (j = 0; j < 4; j++)
+            block[j] = dc;
+}
+
+static void rv34_inv_transform_dc_noround_c(DCTELEM *block)
+{
+    DCTELEM dc = (13 * 13 * 3 * block[0]) >> 11;
+    int i, j;
+
+    for (i = 0; i < 4; i++, block += 8)
+        for (j = 0; j < 4; j++)
+            block[j] = dc;
+}
+
 /** @} */ // transform
 
 
 av_cold void ff_rv34dsp_init(RV34DSPContext *c, DSPContext* dsp) {
     c->rv34_inv_transform_tab[0] = rv34_inv_transform_c;
     c->rv34_inv_transform_tab[1] = rv34_inv_transform_noround_c;
+    c->rv34_inv_transform_dc_tab[0]  = rv34_inv_transform_dc_c;
+    c->rv34_inv_transform_dc_tab[1]  = rv34_inv_transform_dc_noround_c;
 
     if (HAVE_NEON)
         ff_rv34dsp_init_neon(c, dsp);
+    if (HAVE_MMX)
+        ff_rv34dsp_init_x86(c, dsp);
 }
index f2bc20e911e6f36376167f6991565e4318d8717a..6f53a099283912b19e064761ad1cac1b208e195f 100644 (file)
@@ -56,6 +56,7 @@ typedef struct RV34DSPContext {
     h264_chroma_mc_func avg_chroma_pixels_tab[3];
     rv40_weight_func rv40_weight_pixels_tab[2];
     rv34_inv_transform_func rv34_inv_transform_tab[2];
+    void (*rv34_inv_transform_dc_tab[2])(DCTELEM *block);
     rv40_weak_loop_filter_func rv40_weak_loop_filter[2];
     rv40_strong_loop_filter_func rv40_strong_loop_filter[2];
     rv40_loop_filter_strength_func rv40_loop_filter_strength[2];
@@ -66,6 +67,7 @@ void ff_rv34dsp_init(RV34DSPContext *c, DSPContext* dsp);
 void ff_rv40dsp_init(RV34DSPContext *c, DSPContext* dsp);
 
 void ff_rv34dsp_init_neon(RV34DSPContext *c, DSPContext *dsp);
+void ff_rv34dsp_init_x86(RV34DSPContext *c, DSPContext *dsp);
 
 void ff_rv40dsp_init_x86(RV34DSPContext *c, DSPContext *dsp);
 void ff_rv40dsp_init_neon(RV34DSPContext *c, DSPContext *dsp);
index b79e23e1c126014b63a807024bf479ab1b6c73aa..77811b0f91fc7a80598b12a7d7df76ded7f7aae8 100644 (file)
@@ -653,6 +653,9 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVD
     int ret = 0;
     AVDictionary *tmp = NULL;
 
+    if (avctx->extradata_size < 0 || avctx->extradata_size >= FF_MAX_EXTRADATA_SIZE)
+        return AVERROR(EINVAL);
+
     if (options)
         av_dict_copy(&tmp, *options, 0);
 
index 9c455d29c47aeb5556311bda75b75f74d32ab81b..1066b20139b76f1d6372c5bdf246162f5dc30ec2 100644 (file)
@@ -26,7 +26,11 @@ YASM-OBJS-$(CONFIG_H264PRED)           += x86/h264_intrapred.o          \
                                           x86/h264_intrapred_10bit.o
 MMX-OBJS-$(CONFIG_H264PRED)            += x86/h264_intrapred_init.o
 
-MMX-OBJS-$(CONFIG_RV40_DECODER)        += x86/rv40dsp.o                 \
+MMX-OBJS-$(CONFIG_RV30_DECODER)        += x86/rv34dsp_init.o
+YASM-OBJS-$(CONFIG_RV30_DECODER)       += x86/rv34dsp.o
+MMX-OBJS-$(CONFIG_RV40_DECODER)        += x86/rv34dsp_init.o            \
+                                          x86/rv40dsp.o
+YASM-OBJS-$(CONFIG_RV40_DECODER)       += x86/rv34dsp.o
 
 YASM-OBJS-$(CONFIG_VC1_DECODER)        += x86/vc1dsp_yasm.o
 
diff --git a/libavcodec/x86/rv34dsp.asm b/libavcodec/x86/rv34dsp.asm
new file mode 100644 (file)
index 0000000..58f1af0
--- /dev/null
@@ -0,0 +1,55 @@
+;******************************************************************************
+;* MMX/SSE2-optimized functions for the RV30 and RV40 decoders
+;* Copyright (C) 2012 Christophe Gisquet <christophe.gisquet@gmail.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 "x86inc.asm"
+%include "x86util.asm"
+
+SECTION .text
+
+%macro IDCT_DC_NOROUND 1
+    imul   %1, 13*13*3
+    sar    %1, 11
+%endmacro
+
+%macro IDCT_DC_ROUND 1
+    imul   %1, 13*13
+    add    %1, 0x200
+    sar    %1, 10
+%endmacro
+
+%macro rv34_idct_dequant4x4_dc 1
+cglobal rv34_idct_dequant4x4_%1_mmx2, 1, 2, 0
+    movsx   r1, word [r0]
+    IDCT_DC r1
+    movd    mm0, r1
+    pshufw  mm0, mm0, 0
+    movq    [r0+ 0], mm0
+    movq    [r0+16], mm0
+    movq    [r0+32], mm0
+    movq    [r0+48], mm0
+    REP_RET
+%endmacro
+
+INIT_MMX
+%define IDCT_DC IDCT_DC_ROUND
+rv34_idct_dequant4x4_dc dc
+%define IDCT_DC IDCT_DC_NOROUND
+rv34_idct_dequant4x4_dc dc_noround
diff --git a/libavcodec/x86/rv34dsp_init.c b/libavcodec/x86/rv34dsp_init.c
new file mode 100644 (file)
index 0000000..4317e9b
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * RV30/40 MMX/SSE2 optimizations
+ * Copyright (C) 2012 Christophe Gisquet <christophe.gisquet@gmail.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 "libavutil/cpu.h"
+#include "libavutil/x86_cpu.h"
+#include "libavcodec/dsputil.h"
+#include "libavcodec/rv34dsp.h"
+
+void ff_rv34_idct_dequant4x4_dc_mmx2(DCTELEM *block);
+void ff_rv34_idct_dequant4x4_dc_noround_mmx2(DCTELEM *block);
+
+av_cold void ff_rv34dsp_init_x86(RV34DSPContext* c, DSPContext *dsp)
+{
+#if HAVE_YASM
+    int mm_flags = av_get_cpu_flags();
+
+    if (mm_flags & AV_CPU_FLAG_MMX2) {
+        c->rv34_inv_transform_dc_tab[0] = ff_rv34_idct_dequant4x4_dc_mmx2;
+        c->rv34_inv_transform_dc_tab[1] = ff_rv34_idct_dequant4x4_dc_noround_mmx2;
+    }
+#endif
+}
index d4b71d27c03b6d4c3e67b1c5867e5fb3ff54800f..d21d5f4230e2062c4944aa3cf37b6281876631e2 100644 (file)
@@ -10,7 +10,7 @@ FFLIBS-$(CONFIG_MOVIE_FILTER) += avformat avcodec
 FFLIBS-$(CONFIG_SCALE_FILTER) += swscale
 FFLIBS-$(CONFIG_MP_FILTER) += avcodec
 
-HEADERS = avcodec.h avfilter.h avfiltergraph.h buffersink.h vsrc_buffer.h
+HEADERS = avcodec.h avfilter.h avfiltergraph.h buffersink.h version.h vsrc_buffer.h
 
 OBJS = allfilters.o                                                     \
        avfilter.o                                                       \
index 1746907273c53b8ed9489ad6d89b4073e490eebd..9c7a2e5bbf16177d35dc5b99c9e94ac7610a2168 100644 (file)
 #include "libavutil/rational.h"
 #include "libavcodec/avcodec.h"
 
-#define LIBAVFILTER_VERSION_MAJOR  2
-#define LIBAVFILTER_VERSION_MINOR 58
-#define LIBAVFILTER_VERSION_MICRO 101
-
-#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
-                                               LIBAVFILTER_VERSION_MINOR, \
-                                               LIBAVFILTER_VERSION_MICRO)
-#define LIBAVFILTER_VERSION     AV_VERSION(LIBAVFILTER_VERSION_MAJOR,   \
-                                           LIBAVFILTER_VERSION_MINOR,   \
-                                           LIBAVFILTER_VERSION_MICRO)
-#define LIBAVFILTER_BUILD       LIBAVFILTER_VERSION_INT
 
 #ifndef FF_API_OLD_VSINK_API
 #define FF_API_OLD_VSINK_API        (LIBAVFILTER_VERSION_MAJOR < 3)
@@ -50,6 +39,8 @@
 
 #include <stddef.h>
 
+#include "libavfilter/version.h"
+
 /**
  * Return the LIBAVFILTER_VERSION_INT constant.
  */
diff --git a/libavfilter/version.h b/libavfilter/version.h
new file mode 100644 (file)
index 0000000..0eb5f7e
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Version macros.
+ *
+ * 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 AVFILTER_VERSION_H
+#define AVFILTER_VERSION_H
+
+/**
+ * @file
+ * Libavfilter version macros
+ */
+
+#include "libavutil/avutil.h"
+
+#define LIBAVFILTER_VERSION_MAJOR  2
+#define LIBAVFILTER_VERSION_MINOR 59
+#define LIBAVFILTER_VERSION_MICRO 100
+
+#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
+                                               LIBAVFILTER_VERSION_MINOR, \
+                                               LIBAVFILTER_VERSION_MICRO)
+#define LIBAVFILTER_VERSION     AV_VERSION(LIBAVFILTER_VERSION_MAJOR,   \
+                                           LIBAVFILTER_VERSION_MINOR,   \
+                                           LIBAVFILTER_VERSION_MICRO)
+#define LIBAVFILTER_BUILD       LIBAVFILTER_VERSION_INT
+
+#endif // AVFILTER_VERSION_H
index 362449342e66b3953eb2b283ded24f52910de87b..743698eff952752f07469dc5ac00da12fc71cfaf 100644 (file)
@@ -182,6 +182,14 @@ static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
     return 0;
 }
 
+static av_cold void uninit(AVFilterContext *ctx)
+{
+    BufferSourceContext *s = ctx->priv;
+    if (s->picref)
+        avfilter_unref_buffer(s->picref);
+    s->picref = NULL;
+}
+
 static int query_formats(AVFilterContext *ctx)
 {
     BufferSourceContext *c = ctx->priv;
@@ -235,6 +243,7 @@ AVFilter avfilter_vsrc_buffer = {
     .query_formats = query_formats,
 
     .init      = init,
+    .uninit    = uninit,
 
     .inputs    = (const AVFilterPad[]) {{ .name = NULL }},
     .outputs   = (const AVFilterPad[]) {{ .name      = "default",
index 2ed6b56e7ce312d41aa02b0e3ce605d6ee1e0933..0dcaee5d6475f4797e54c46580a43586113235f1 100644 (file)
@@ -508,7 +508,6 @@ typedef struct AVInputFormat {
      */
     int (*read_close)(struct AVFormatContext *);
 
-#if FF_API_READ_SEEK
     /**
      * Seek to a given timestamp relative to the frames in
      * stream component stream_index.
@@ -517,9 +516,9 @@ typedef struct AVInputFormat {
      *              match is available.
      * @return >= 0 on success (but not necessarily the new offset)
      */
-    attribute_deprecated int (*read_seek)(struct AVFormatContext *,
-                                          int stream_index, int64_t timestamp, int flags);
-#endif
+    int (*read_seek)(struct AVFormatContext *,
+                     int stream_index, int64_t timestamp, int flags);
+
     /**
      * Get the next timestamp in stream[stream_index].time_base units.
      * @return the timestamp or AV_NOPTS_VALUE if an error occurred
index 9570f0051de5c4d68b30cebdd0dc5967c57663ac..a8698a8419861f7f0aae6d62d47c2e1f355860ba 100644 (file)
@@ -210,7 +210,7 @@ attribute_deprecated int url_poll(URLPollEntry *poll_table, int n, int timeout);
  * Warning: non-blocking protocols is work-in-progress; this flag may be
  * silently ignored.
  */
-#define URL_FLAG_NONBLOCK 4
+#define URL_FLAG_NONBLOCK 8
 
 typedef int URLInterruptCB(void);
 extern URLInterruptCB *url_interrupt_cb;
index cd4ee613267572c5137204f87febf7bfb37ff39b..69d924d09ccc72aaca377085853331a34046ee5b 100644 (file)
@@ -207,7 +207,7 @@ static int ffm_write_packet(AVFormatContext *s, AVPacket *pkt)
     uint8_t header[FRAME_HEADER_SIZE+4];
     int header_size = FRAME_HEADER_SIZE;
 
-    dts = s->timestamp + pkt->dts;
+    dts = pkt->dts;
     /* packet size & key_frame */
     header[0] = pkt->stream_index;
     header[1] = 0;
@@ -215,7 +215,7 @@ static int ffm_write_packet(AVFormatContext *s, AVPacket *pkt)
         header[1] |= FLAG_KEY_FRAME;
     AV_WB24(header+2, pkt->size);
     AV_WB24(header+5, pkt->duration);
-    AV_WB64(header+8, s->timestamp + pkt->pts);
+    AV_WB64(header+8, pkt->pts);
     if (pkt->pts != pkt->dts) {
         header[1] |= FLAG_DTS;
         AV_WB32(header+16, pkt->pts - pkt->dts);
index cd2c9a0f0c9f828329275e3e887d28d26ba3e711..f5ac746b87f91247613a10993a0c9e7b029c7f52 100644 (file)
@@ -338,8 +338,6 @@ const AVCodecTag ff_codec_wav_tags[] = {
     { CODEC_ID_AAC_LATM,        0x1602 },
     { CODEC_ID_AC3,             0x2000 },
     { CODEC_ID_DTS,             0x2001 },
-    { CODEC_ID_SONIC,           0x2048 },
-    { CODEC_ID_SONIC_LS,        0x2048 },
     { CODEC_ID_PCM_MULAW,       0x6c75 },
     { CODEC_ID_AAC,             0x706d },
     { CODEC_ID_AAC,             0x4143 },
index e4b28d226c0af3dc75d4828127f92d645327991d..7606a8eac8766c1ab2c92dca19c493993a82e3a9 100644 (file)
@@ -2544,9 +2544,11 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
         }
         if(st->parser && st->parser->parser->split && !st->codec->extradata){
             int i= st->parser->parser->split(st->codec, pkt->data, pkt->size);
-            if(i){
+            if (i > 0 && i < FF_MAX_EXTRADATA_SIZE) {
                 st->codec->extradata_size= i;
                 st->codec->extradata= av_malloc(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
+                if (!st->codec->extradata)
+                    return AVERROR(ENOMEM);
                 memcpy(st->codec->extradata, pkt->data, st->codec->extradata_size);
                 memset(st->codec->extradata + i, 0, FF_INPUT_BUFFER_PADDING_SIZE);
             }
index b8adb922fb935998b4de844e8b6cb475c3fd4681..e2cc0fb26ba326704e7f9b4a349018404b80bdba 100644 (file)
@@ -50,9 +50,6 @@
 #ifndef FF_API_OLD_METADATA2
 #define FF_API_OLD_METADATA2           (LIBAVFORMAT_VERSION_MAJOR < 54)
 #endif
-#ifndef FF_API_READ_SEEK
-#define FF_API_READ_SEEK               (LIBAVFORMAT_VERSION_MAJOR < 54)
-#endif
 #ifndef FF_API_OLD_AVIO
 #define FF_API_OLD_AVIO                (LIBAVFORMAT_VERSION_MAJOR < 54)
 #endif
index eb7ca7ba1a9629528e96183e682f4f29c633d7fc..31ebc20a680f2cb6f1a26a0be90599b6956c3e49 100644 (file)
@@ -284,14 +284,14 @@ void rgb15tobgr15(const uint8_t *src, uint8_t *dst, int src_size)
 
 void rgb12tobgr12(const uint8_t *src, uint8_t *dst, int src_size)
 {
+    uint16_t *d = (uint16_t*)dst;
+    uint16_t *s = (uint16_t*)src;
     int i;
     int num_pixels = src_size >> 1;
 
     for (i = 0; i < num_pixels; i++) {
-        unsigned br;
-        unsigned rgb = ((const uint16_t *)src)[i];
-        br = rgb & 0x0F0F;
-        ((uint16_t *)dst)[i] = (br >> 8) | (rgb & 0x00F0) | (br << 8);
+        unsigned rgb = s[i];
+        d[i] = (rgb << 8 | rgb & 0xF0 | rgb >> 8) & 0xFFF;
     }
 }