]> git.sesse.net Git - ffmpeg/commitdiff
Merge remote-tracking branch 'qatar/master'
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 30 Jul 2012 21:04:28 +0000 (23:04 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 30 Jul 2012 21:28:31 +0000 (23:28 +0200)
* qatar/master:
  avformat: Drop pointless "format" from container long names
  swscale: bury one more piece of inline asm under HAVE_INLINE_ASM.
  wv: K&R formatting cosmetics
  configure: Add missing descriptions to help output
  h264_ps: declare array of colorspace strings on its own line.
  fate: amix: specify f32 sample format for comparison
  tiny_psnr: support 32-bit float samples
  eamad/eatgq/eatqi: call special EA IDCT directly
  eamad: remove use of MpegEncContext
  mpegvideo: remove unnecessary inclusions of faandct.h
  af_asyncts: avoid overflow in out_size with large delta values
  af_asyncts: add first_pts option

Conflicts:
configure
libavcodec/eamad.c
libavcodec/h264_ps.c
libavformat/crcenc.c
libavformat/ffmdec.c
libavformat/ffmenc.c
libavformat/framecrcenc.c
libavformat/md5enc.c
libavformat/nutdec.c
libavformat/rawenc.c
libavformat/yuv4mpeg.c
tests/tiny_psnr.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
104 files changed:
1  2 
configure
doc/filters.texi
libavcodec/dsputil.c
libavcodec/dsputil.h
libavcodec/eaidct.c
libavcodec/eaidct.h
libavcodec/eamad.c
libavcodec/eatgq.c
libavcodec/eatqi.c
libavcodec/h264_ps.c
libavcodec/mpegvideo.c
libavcodec/mpegvideo_common.h
libavfilter/af_asyncts.c
libavformat/4xm.c
libavformat/amr.c
libavformat/apc.c
libavformat/assdec.c
libavformat/assenc.c
libavformat/avs.c
libavformat/bethsoftvid.c
libavformat/cdg.c
libavformat/cdxl.c
libavformat/crcenc.c
libavformat/daud.c
libavformat/dsicin.c
libavformat/dv.c
libavformat/dvenc.c
libavformat/electronicarts.c
libavformat/ffmdec.c
libavformat/ffmenc.c
libavformat/ffmetadec.c
libavformat/ffmetaenc.c
libavformat/flic.c
libavformat/framecrcenc.c
libavformat/g723_1.c
libavformat/h264dec.c
libavformat/hls.c
libavformat/idcin.c
libavformat/idroqdec.c
libavformat/idroqenc.c
libavformat/ilbc.c
libavformat/ipmovie.c
libavformat/iss.c
libavformat/lmlm4.c
libavformat/lxfdec.c
libavformat/m4vdec.c
libavformat/matroskadec.c
libavformat/matroskaenc.c
libavformat/md5enc.c
libavformat/mm.c
libavformat/movenc.c
libavformat/mpegenc.c
libavformat/mpjpeg.c
libavformat/mtv.c
libavformat/mvi.c
libavformat/mxg.c
libavformat/ncdec.c
libavformat/nullenc.c
libavformat/nutdec.c
libavformat/nutenc.c
libavformat/nuv.c
libavformat/pcmdec.c
libavformat/pcmenc.c
libavformat/pmpdec.c
libavformat/psxstr.c
libavformat/pva.c
libavformat/qcp.c
libavformat/r3d.c
libavformat/rawenc.c
libavformat/rawvideodec.c
libavformat/rl2.c
libavformat/rmdec.c
libavformat/rmenc.c
libavformat/rpl.c
libavformat/rsodec.c
libavformat/rsoenc.c
libavformat/rtpenc.c
libavformat/rtsp.c
libavformat/rtspdec.c
libavformat/rtspenc.c
libavformat/sapdec.c
libavformat/sapenc.c
libavformat/segafilm.c
libavformat/sierravmd.c
libavformat/sol.c
libavformat/soxdec.c
libavformat/soxenc.c
libavformat/srtdec.c
libavformat/srtenc.c
libavformat/tiertexseq.c
libavformat/vc1test.c
libavformat/vocdec.c
libavformat/vocenc.c
libavformat/wav.c
libavformat/wc3movie.c
libavformat/westwood_aud.c
libavformat/westwood_vqa.c
libavformat/wv.c
libavformat/xa.c
libavformat/yop.c
libavformat/yuv4mpeg.c
libswscale/swscale.c
tests/fate/filter.mak
tests/tiny_psnr.c

diff --cc configure
index 54b2ce24bffea20b3a5d4c5cbcfafa4d704e8974,a39ead7b780ca9c6bfeafb3a000203b759ca3512..6203eca025599740d573c4f16a5d05ec89085aa6
+++ b/configure
@@@ -223,26 -205,24 +225,28 @@@ Advanced options (experts only)
    --target-os=OS           compiler targets OS [$target_os]
    --target-exec=CMD        command to run executables on target
    --target-path=DIR        path to view of build directory on target
 -  --nm=NM                  use nm tool
 +  --nm=NM                  use nm tool NM [$nm_default]
    --ar=AR                  use archive tool AR [$ar_default]
    --as=AS                  use assembler AS [$as_default]
 +  --yasmexe=EXE            use yasm-compatible assembler EXE [$yasmexe_default]
    --cc=CC                  use C compiler CC [$cc_default]
 -  --ld=LD                  use linker LD
 +  --cxx=CXX                use C compiler CXX [$cxx_default]
+   --dep-cc=DEPCC           use dependency generator DEPCC [$cc_default]
 +  --ld=LD                  use linker LD [$ld_default]
    --host-cc=HOSTCC         use host C compiler HOSTCC
    --host-cflags=HCFLAGS    use HCFLAGS when compiling for host
    --host-ldflags=HLDFLAGS  use HLDFLAGS when linking for host
    --host-libs=HLIBS        use libs HLIBS when linking for host
+   --host-os=OS             compiler host OS [$target_os]
    --extra-cflags=ECFLAGS   add ECFLAGS to CFLAGS [$CFLAGS]
 +  --extra-cxxflags=ECFLAGS add ECFLAGS to CXXFLAGS [$CXXFLAGS]
    --extra-ldflags=ELDFLAGS add ELDFLAGS to LDFLAGS [$LDFLAGS]
    --extra-libs=ELIBS       add ELIBS [$ELIBS]
    --extra-version=STRING   version string suffix []
-   --optflags               override optimization-related compiler flags
+   --optflags=OPTFLAGS      override optimization-related compiler flags
    --build-suffix=SUFFIX    library name suffix []
    --malloc-prefix=PREFIX   prefix malloc and related names with PREFIX
 +  --progs-suffix=SUFFIX    program name suffix []
    --arch=ARCH              select architecture [$arch]
    --cpu=CPU                select the minimum required CPU (affects
                             instruction selection, may crash on older CPUs)
Simple merge
Simple merge
Simple merge
Simple merge
index 0000000000000000000000000000000000000000,4c0b5ae16eb0b1ce8e34cfc07b5baae4dfcbf44c..a436673e8851565cdde1733797badbc9ea732bb3
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,27 +1,27 @@@
 - * This file is part of Libav.
+ /*
 - * Libav is free software; you can redistribute it and/or
++ * This file is part of FFmpeg
+  *
 - * Libav is distributed in the hope that it will be useful,
++ * FFmpeg is free software; you can redistribute it and/or
+  * modify it under the terms of the GNU Lesser General Public
+  * License as published by the Free Software Foundation; either
+  * version 2.1 of the License, or (at your option) any later version.
+  *
 - * License along with Libav; if not, write to the Free Software
++ * FFmpeg is distributed in the hope that it will be useful,
+  * but WITHOUT ANY WARRANTY; without even the implied warranty of
+  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+  * Lesser General Public License for more details.
+  *
+  * You should have received a copy of the GNU Lesser General Public
++ * License along with FFmpeg; if not, write to the Free Software
+  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+  */
+ #ifndef AVCODEC_EAIDCT_H
+ #define AVCODEC_EAIDCT_H
+ #include <stdint.h>
+ #include "dsputil.h"
+ void ff_ea_idct_put_c(uint8_t *dest, int linesize, DCTELEM *block);
+ #endif /* AVCODEC_EAIDCT_H */
index d36ef9afced6c8abce8684f6f436f582facefb38,ca7439397f4c42620b4d3975979c924b02eb9618..d6839b17ea89c62967939a293c33065f56b79e23
@@@ -83,23 -88,16 +88,22 @@@ static inline void comp(unsigned char *
  static inline void comp_block(MadContext *t, int mb_x, int mb_y,
                                int j, int mv_x, int mv_y, int add)
  {
-     MpegEncContext *s = &t->s;
      if (j < 4) {
-         if (offset >= (s->height - 7) * t->last_frame.linesize[0] - 7)
 +        unsigned offset = (mb_y*16 + ((j&2)<<2) + mv_y)*t->last_frame.linesize[0] + mb_x*16 + ((j&1)<<3) + mv_x;
++        if (offset >= (t->avctx->height - 7) * t->last_frame.linesize[0] - 7)
 +            return;
          comp(t->frame.data[0] + (mb_y*16 + ((j&2)<<2))*t->frame.linesize[0] + mb_x*16 + ((j&1)<<3),
               t->frame.linesize[0],
 -             t->last_frame.data[0] + (mb_y*16 + ((j&2)<<2) + mv_y)*t->last_frame.linesize[0] + mb_x*16 + ((j&1)<<3) + mv_x,
 +             t->last_frame.data[0] + offset,
               t->last_frame.linesize[0], add);
-     } else if (!(s->avctx->flags & CODEC_FLAG_GRAY)) {
+     } else if (!(t->avctx->flags & CODEC_FLAG_GRAY)) {
          int index = j - 3;
-         if (offset >= (s->height/2 - 7) * t->last_frame.linesize[index] - 7)
 +        unsigned offset = (mb_y * 8 + (mv_y/2))*t->last_frame.linesize[index] + mb_x * 8 + (mv_x/2);
++        if (offset >= (t->avctx->height/2 - 7) * t->last_frame.linesize[index] - 7)
 +            return;
          comp(t->frame.data[index] + (mb_y*8)*t->frame.linesize[index] + mb_x * 8,
               t->frame.linesize[index],
 -             t->last_frame.data[index] + (mb_y * 8 + (mv_y/2))*t->last_frame.linesize[index] + mb_x * 8 + (mv_x/2),
 +             t->last_frame.data[index] + offset,
               t->last_frame.linesize[index], add);
      }
  }
@@@ -119,13 -116,12 +122,12 @@@ static inline void idct_put(MadContext 
      }
  }
  
- static inline int decode_block_intra(MadContext * t, DCTELEM * block)
 -static inline void decode_block_intra(MadContext *s, DCTELEM * block)
++static inline int decode_block_intra(MadContext *s, DCTELEM * block)
  {
-     MpegEncContext *s = &t->s;
      int level, i, j, run;
      RLTable *rl = &ff_rl_mpeg1;
-     const uint8_t *scantable = s->intra_scantable.permutated;
-     int16_t *quant_matrix = s->intra_matrix;
+     const uint8_t *scantable = s->scantable.permutated;
+     int16_t *quant_matrix = s->quant_matrix;
  
      block[0] = (128 + get_sbits(&s->gb, 8)) * quant_matrix[0];
  
@@@ -191,9 -186,8 +193,8 @@@ static int decode_motion(GetBitContext 
      return value;
  }
  
- static int decode_mb(MadContext *t, int inter)
 -static void decode_mb(MadContext *s, int inter)
++static int decode_mb(MadContext *s, int inter)
  {
-     MpegEncContext *s = &t->s;
      int mv_map = 0;
      int mv_x, mv_y;
      int j;
      for (j=0; j<6; j++) {
          if (mv_map & (1<<j)) {  // mv_x and mv_y are guarded by mv_map
              int add = 2*decode_motion(&s->gb);
-             if (t->last_frame.data[0])
-                 comp_block(t, s->mb_x, s->mb_y, j, mv_x, mv_y, add);
 -            comp_block(s, s->mb_x, s->mb_y, j, mv_x, mv_y, add);
++            if (s->last_frame.data[0])
++                comp_block(s, s->mb_x, s->mb_y, j, mv_x, mv_y, add);
          } else {
-             s->dsp.clear_block(t->block);
-             if(decode_block_intra(t, t->block) < 0)
+             s->dsp.clear_block(s->block);
 -            decode_block_intra(s, s->block);
++            if(decode_block_intra(s, s->block) < 0)
 +                return -1;
-             idct_put(t, t->block, s->mb_x, s->mb_y, j);
+             idct_put(s, s->block, s->mb_x, s->mb_y, j);
          }
      }
 +    return 0;
  }
  
- static void calc_intra_matrix(MadContext *t, int qscale)
+ static void calc_quant_matrix(MadContext *s, int qscale)
  {
-     MpegEncContext *s = &t->s;
      int i;
  
-     if (s->avctx->idct_algo == FF_IDCT_EA) {
-         s->intra_matrix[0] = (ff_inv_aanscales[0]*ff_mpeg1_default_intra_matrix[0]) >> 11;
-         for (i=1; i<64; i++)
-             s->intra_matrix[i] = (ff_inv_aanscales[i]*ff_mpeg1_default_intra_matrix[i]*qscale + 32) >> 10;
-     } else {
-         s->intra_matrix[0] = ff_mpeg1_default_intra_matrix[0];
-         for (i=1; i<64; i++)
-             s->intra_matrix[i] = (ff_mpeg1_default_intra_matrix[i]*qscale) << 1;
-     }
+     s->quant_matrix[0] = (ff_inv_aanscales[0]*ff_mpeg1_default_intra_matrix[0]) >> 11;
+     for (i=1; i<64; i++)
+         s->quant_matrix[i] = (ff_inv_aanscales[i]*ff_mpeg1_default_intra_matrix[i]*qscale + 32) >> 10;
  }
  
  static int decode_frame(AVCodecContext *avctx,
      av_reduce(&avctx->time_base.num, &avctx->time_base.den,
                AV_RL16(&buf[6]), 1000, 1<<30);
  
-     s->width  = AV_RL16(&buf[8]);
-     s->height = AV_RL16(&buf[10]);
-     calc_intra_matrix(t, buf[13]);
+     width  = AV_RL16(&buf[8]);
+     height = AV_RL16(&buf[10]);
+     calc_quant_matrix(s, buf[13]);
      buf += 16;
  
-     if (avctx->width != s->width || avctx->height != s->height) {
-         if((s->width * s->height)/2048*7 > buf_end-buf)
+     if (avctx->width != width || avctx->height != height) {
++        if((width * height)/2048*7 > buf_end-buf)
 +            return -1;
-         if (av_image_check_size(s->width, s->height, 0, avctx) < 0)
+         if (av_image_check_size(width, height, 0, avctx) < 0)
              return -1;
-         avcodec_set_dimensions(avctx, s->width, s->height);
-         if (t->frame.data[0])
-             avctx->release_buffer(avctx, &t->frame);
-         if (t->last_frame.data[0])
-             avctx->release_buffer(avctx, &t->last_frame);
+         avcodec_set_dimensions(avctx, width, height);
+         if (s->frame.data[0])
+             avctx->release_buffer(avctx, &s->frame);
++        if (s->last_frame.data[0])
++            avctx->release_buffer(avctx, &s->last_frame);
      }
  
-     t->frame.reference = 3;
-     if (!t->frame.data[0]) {
-         if (avctx->get_buffer(avctx, &t->frame) < 0) {
 -    s->frame.reference = 1;
++    s->frame.reference = 3;
+     if (!s->frame.data[0]) {
+         if (avctx->get_buffer(avctx, &s->frame) < 0) {
              av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
              return -1;
          }
      }
  
-     av_fast_malloc(&t->bitstream_buf, &t->bitstream_buf_size, (buf_end-buf) + FF_INPUT_BUFFER_PADDING_SIZE);
-     if (!t->bitstream_buf)
+     av_fast_malloc(&s->bitstream_buf, &s->bitstream_buf_size, (buf_end-buf) + FF_INPUT_BUFFER_PADDING_SIZE);
+     if (!s->bitstream_buf)
          return AVERROR(ENOMEM);
-     bswap16_buf(t->bitstream_buf, (const uint16_t*)buf, (buf_end-buf)/2);
-     memset((uint8_t*)t->bitstream_buf + (buf_end-buf), 0, FF_INPUT_BUFFER_PADDING_SIZE);
-     init_get_bits(&s->gb, t->bitstream_buf, 8*(buf_end-buf));
+     bswap16_buf(s->bitstream_buf, (const uint16_t*)buf, (buf_end-buf)/2);
++    memset((uint8_t*)s->bitstream_buf + (buf_end-buf), 0, FF_INPUT_BUFFER_PADDING_SIZE);
+     init_get_bits(&s->gb, s->bitstream_buf, 8*(buf_end-buf));
  
      for (s->mb_y=0; s->mb_y < (avctx->height+15)/16; s->mb_y++)
          for (s->mb_x=0; s->mb_x < (avctx->width +15)/16; s->mb_x++)
-             if(decode_mb(t, inter) < 0)
 -            decode_mb(s, inter);
++            if(decode_mb(s, inter) < 0)
 +                return -1;
  
      *data_size = sizeof(AVFrame);
-     *(AVFrame*)data = t->frame;
+     *(AVFrame*)data = s->frame;
  
      if (chunk_type != MADe_TAG)
-         FFSWAP(AVFrame, t->frame, t->last_frame);
+         FFSWAP(AVFrame, s->frame, s->last_frame);
  
      return buf_size;
  }
Simple merge
Simple merge
index 28bee2e10551fd0db7b0b4e66a6ce1c7eec12271,7d9d59664f8778f5aa0da7bfe8394dbd9c785f17..2945948c41fbf68ae37e0aebe2ff7b8fd328a3a2
@@@ -491,7 -431,8 +491,8 @@@ int ff_h264_decode_seq_parameter_set(H2
          sps->sar.den= 1;
  
      if(s->avctx->debug&FF_DEBUG_PICT_INFO){
 -        av_log(h->s.avctx, AV_LOG_DEBUG, "sps:%u profile:%d/%d poc:%d ref:%d %dx%d %s %s crop:%d/%d/%d/%d %s %s %d/%d\n",
+         static const char csp[4][5] = { "Gray", "420", "422", "444" };
 +        av_log(h->s.avctx, AV_LOG_DEBUG, "sps:%u profile:%d/%d poc:%d ref:%d %dx%d %s %s crop:%d/%d/%d/%d %s %s %d/%d b%d\n",
                 sps_id, sps->profile_idc, sps->level_idc,
                 sps->poc_type,
                 sps->ref_frame_count,
                 sps->crop_left, sps->crop_right,
                 sps->crop_top, sps->crop_bottom,
                 sps->vui_parameters_present_flag ? "VUI" : "",
-                ((const char*[]){"Gray","420","422","444"})[sps->chroma_format_idc],
+                csp[sps->chroma_format_idc],
                 sps->timing_info_present_flag ? sps->num_units_in_tick : 0,
 -               sps->timing_info_present_flag ? sps->time_scale : 0
 +               sps->timing_info_present_flag ? sps->time_scale : 0,
 +               sps->bit_depth_luma
                 );
      }
  
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index e93a6b29d1ebec0b9172820b638ec7073f956b7e,3b7b739c6ced436d1da26dfab351819d52b04a1a..256fc21873c43466729a6c3e05ababbd7d8532be
@@@ -71,9 -65,8 +71,9 @@@ static int read_packet(AVFormatContext 
  
  AVInputFormat ff_cdg_demuxer = {
      .name           = "cdg",
-     .long_name      = NULL_IF_CONFIG_SMALL("CD Graphics Format"),
+     .long_name      = NULL_IF_CONFIG_SMALL("CD Graphics"),
      .read_header    = read_header,
      .read_packet    = read_packet,
 +    .flags          = AVFMT_GENERIC_INDEX,
      .extensions     = "cdg",
  };
Simple merge
index 1f5854e08028a7f74ca4250daa1637cca93f6646,8c0c91d5a47198c7de76d5feb7467a1d2a29cb82..210ef2c4ddb4cdc5270035fe43ad1ec2f075d781
@@@ -56,7 -56,8 +56,7 @@@ static int crc_write_trailer(struct AVF
  
  AVOutputFormat ff_crc_muxer = {
      .name              = "crc",
-     .long_name         = NULL_IF_CONFIG_SMALL("CRC testing format"),
+     .long_name         = NULL_IF_CONFIG_SMALL("CRC testing"),
 -    .extensions        = "",
      .priv_data_size    = sizeof(CRCState),
      .audio_codec       = CODEC_ID_PCM_S16LE,
      .video_codec       = CODEC_ID_RAWVIDEO,
index 916489fc0ee84213f98fed64bd643d47823db1cc,1fd5c7ae8025e89f5fdf42ca2f4eeca7489fcc6d..a25c0bff4c21e6d89592cf9d1574fb44047a179d
@@@ -72,10 -72,10 +72,10 @@@ static int daud_write_packet(struct AVF
  #if CONFIG_DAUD_DEMUXER
  AVInputFormat ff_daud_demuxer = {
      .name           = "daud",
-     .long_name      = NULL_IF_CONFIG_SMALL("D-Cinema audio format"),
+     .long_name      = NULL_IF_CONFIG_SMALL("D-Cinema audio"),
      .read_header    = daud_header,
      .read_packet    = daud_packet,
 -    .extensions     = "302",
 +    .extensions     = "302,daud",
  };
  #endif
  
Simple merge
Simple merge
Simple merge
Simple merge
index 0c943fbe098b93e7edd1c6d8d47cfe5cdb59ebc6,c4ee22e73a30fd656bf42c3e818e3f566937f56f..df9ac8d9fc126d5284cecfc5f1eaca15a8f1c4c2
@@@ -528,7 -508,7 +528,7 @@@ static int ffm_probe(AVProbeData *p
  
  AVInputFormat ff_ffm_demuxer = {
      .name           = "ffm",
-     .long_name      = NULL_IF_CONFIG_SMALL("FFM (FFserver live feed) format"),
 -    .long_name      = NULL_IF_CONFIG_SMALL("FFM (AVserver live feed)"),
++    .long_name      = NULL_IF_CONFIG_SMALL("FFM (FFserver live feed)"),
      .priv_data_size = sizeof(FFMContext),
      .read_probe     = ffm_probe,
      .read_header    = ffm_read_header,
index 74807d98131f812f97064cd2783ca6ca6c345670,7de6ec8b34fd770267fe7ba8f555ee18c57017ec..a8d038ac6817f6ae5c4de77395fba1b419f649a5
@@@ -240,7 -239,8 +240,7 @@@ static int ffm_write_trailer(AVFormatCo
  
  AVOutputFormat ff_ffm_muxer = {
      .name              = "ffm",
-     .long_name         = NULL_IF_CONFIG_SMALL("FFM (FFserver live feed) format"),
 -    .long_name         = NULL_IF_CONFIG_SMALL("FFM (AVserver live feed)"),
 -    .mime_type         = "",
++    .long_name         = NULL_IF_CONFIG_SMALL("FFM (FFserver live feed)"),
      .extensions        = "ffm",
      .priv_data_size    = sizeof(FFMContext),
      .audio_codec       = CODEC_ID_MP2,
Simple merge
Simple merge
Simple merge
index 72eeba707b7cd2d4c19866c55da635b7b11bbe42,3018b726261fc337f30cf732143480d12bdb0812..78f7131a5d0d56598a97864d79cd03291061d7b7
@@@ -37,7 -37,8 +37,7 @@@ static int framecrc_write_packet(struc
  
  AVOutputFormat ff_framecrc_muxer = {
      .name              = "framecrc",
-     .long_name         = NULL_IF_CONFIG_SMALL("framecrc testing format"),
+     .long_name         = NULL_IF_CONFIG_SMALL("framecrc testing"),
 -    .extensions        = "",
      .audio_codec       = CODEC_ID_PCM_S16LE,
      .video_codec       = CODEC_ID_RAWVIDEO,
      .write_header      = ff_framehash_write_header,
index 388283f80e9be751e1ead31087a2f82c5f896875,e9ae10b0660508c1a283e5e804a4f563d248207e..fa8011cd28309195aa8d35e6935bb610154f3483
@@@ -77,9 -77,9 +77,9 @@@ static int g723_1_read_packet(AVFormatC
  
  AVInputFormat ff_g723_1_demuxer = {
      .name        = "g723_1",
-     .long_name   = NULL_IF_CONFIG_SMALL("G.723.1 format"),
+     .long_name   = NULL_IF_CONFIG_SMALL("G.723.1"),
      .read_header = g723_1_init,
      .read_packet = g723_1_read_packet,
 -    .extensions  = "tco",
 +    .extensions  = "tco,rco,g723_1",
      .flags       = AVFMT_GENERIC_INDEX
  };
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 4ea7924a3404a998af29c3c1a0a3063d5335d9de,aaac5a97b2e68f78090d7c13198adc5cb586918b..9c51cf1d437ec2434a79b020a2e83b55baa46d9f
@@@ -68,7 -68,8 +68,7 @@@ static int write_trailer(struct AVForma
  
  AVOutputFormat ff_md5_muxer = {
      .name              = "md5",
-     .long_name         = NULL_IF_CONFIG_SMALL("MD5 testing format"),
+     .long_name         = NULL_IF_CONFIG_SMALL("MD5 testing"),
 -    .extensions        = "",
      .priv_data_size    = PRIVSIZE,
      .audio_codec       = CODEC_ID_PCM_S16LE,
      .video_codec       = CODEC_ID_RAWVIDEO,
@@@ -98,7 -99,8 +98,7 @@@ static int framemd5_write_packet(struc
  
  AVOutputFormat ff_framemd5_muxer = {
      .name              = "framemd5",
-     .long_name         = NULL_IF_CONFIG_SMALL("Per-frame MD5 testing format"),
+     .long_name         = NULL_IF_CONFIG_SMALL("Per-frame MD5 testing"),
 -    .extensions        = "",
      .priv_data_size    = PRIVSIZE,
      .audio_codec       = CODEC_ID_PCM_S16LE,
      .video_codec       = CODEC_ID_RAWVIDEO,
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index f3da58acfa1ca245d68813043b9a207d45783e14,e78de7fce8a94a112bb2e46cbdddce6b80da3f30..c02545122144e7f494b2d74ef7d143099e2eef0a
@@@ -1014,8 -991,7 +1014,8 @@@ static int nut_read_close(AVFormatConte
  
  AVInputFormat ff_nut_demuxer = {
      .name           = "nut",
-     .long_name      = NULL_IF_CONFIG_SMALL("NUT format"),
+     .long_name      = NULL_IF_CONFIG_SMALL("NUT"),
 +    .flags          = AVFMT_SEEK_TO_PTS,
      .priv_data_size = sizeof(NUTContext),
      .read_probe     = nut_probe,
      .read_header    = nut_read_header,
Simple merge
index 928f856c88eca8bfd71f7c2487a36a9fd17ec1d1,0cf5f72100d8d74cf77915890e5c25684d454507..21df6d285652a5450912328efd149735bee69cdf
@@@ -261,84 -262,9 +261,84 @@@ static int nuv_packet(AVFormatContext *
      return AVERROR(EIO);
  }
  
 +/**
 + * \brief looks for the string RTjjjjjjjjjj in the stream too resync reading
 + * \return 1 if the syncword is found 0 otherwise.
 + */
 +static int nuv_resync(AVFormatContext *s, int64_t pos_limit) {
 +    AVIOContext *pb = s->pb;
 +    uint32_t tag = 0;
 +    while(!url_feof(pb) && avio_tell(pb) < pos_limit) {
 +        tag = (tag << 8) | avio_r8(pb);
 +        if (tag                  == MKBETAG('R','T','j','j') &&
 +           (tag = avio_rb32(pb)) == MKBETAG('j','j','j','j') &&
 +           (tag = avio_rb32(pb)) == MKBETAG('j','j','j','j'))
 +            return 1;
 +    }
 +    return 0;
 +}
 +
 +/**
 + * \brief attempts to read a timestamp from stream at the given stream position
 + * \return timestamp if successful and AV_NOPTS_VALUE if failure
 + */
 +static int64_t nuv_read_dts(AVFormatContext *s, int stream_index,
 +                            int64_t *ppos, int64_t pos_limit)
 +{
 +    NUVContext *ctx = s->priv_data;
 +    AVIOContext *pb = s->pb;
 +    uint8_t hdr[HDRSIZE];
 +    nuv_frametype frametype;
 +    int size, key, idx;
 +    int64_t pos, dts;
 +
 +    if (avio_seek(pb, *ppos, SEEK_SET) < 0)
 +        return AV_NOPTS_VALUE;
 +
 +    if (!nuv_resync(s, pos_limit))
 +        return AV_NOPTS_VALUE;
 +
 +    while (!url_feof(pb) && avio_tell(pb) < pos_limit) {
 +        if (avio_read(pb, hdr, HDRSIZE) < HDRSIZE)
 +            return AV_NOPTS_VALUE;
 +        frametype = hdr[0];
 +        size = PKTSIZE(AV_RL32(&hdr[8]));
 +        switch (frametype) {
 +            case NUV_SEEKP:
 +                break;
 +            case NUV_AUDIO:
 +            case NUV_VIDEO:
 +                if (frametype == NUV_VIDEO) {
 +                    idx = ctx->v_id;
 +                    key = hdr[2] == 0;
 +                } else {
 +                    idx = ctx->a_id;
 +                    key = 1;
 +                }
 +                if (stream_index == idx) {
 +
 +                    pos = avio_tell(s->pb) - HDRSIZE;
 +                    dts = AV_RL32(&hdr[4]);
 +
 +                    // TODO - add general support in av_gen_search, so it adds positions after reading timestamps
 +                    av_add_index_entry(s->streams[stream_index], pos, dts, size + HDRSIZE, 0,
 +                            key ? AVINDEX_KEYFRAME : 0);
 +
 +                    *ppos = pos;
 +                    return dts;
 +                }
 +            default:
 +                avio_skip(pb, size);
 +                break;
 +        }
 +    }
 +    return AV_NOPTS_VALUE;
 +}
 +
 +
  AVInputFormat ff_nuv_demuxer = {
      .name           = "nuv",
-     .long_name      = NULL_IF_CONFIG_SMALL("NuppelVideo format"),
+     .long_name      = NULL_IF_CONFIG_SMALL("NuppelVideo"),
      .priv_data_size = sizeof(NUVContext),
      .read_probe     = nuv_probe,
      .read_header    = nuv_header,
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index b8fc8fac7e12103a8a0318d54168ca17062efab8,0000000000000000000000000000000000000000..171c45b4458c9a684a2557ef3485d89b6bc01fcf
mode 100644,000000..100644
--- /dev/null
@@@ -1,99 -1,0 +1,99 @@@
-     .long_name      = NULL_IF_CONFIG_SMALL("SubRip subtitle format"),
 +/*
 + * SubRip subtitle muxer
 + * Copyright (c) 2012  Nicolas George <nicolas.george@normalesup.org>
 + *
 + * This file is part of FFmpeg.
 + *
 + * FFmpeg is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU Lesser General Public
 + * License as published by the Free Software Foundation; either
 + * version 2.1 of the License, or (at your option) any later version.
 + *
 + * FFmpeg is distributed in the hope that it will be useful,
 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 + * Lesser General Public License for more details.
 + *
 + * You should have received a copy of the GNU Lesser General Public
 + * License along with FFmpeg; if not, write to the Free Software
 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 + */
 +
 +#include "avformat.h"
 +#include "internal.h"
 +#include "libavutil/log.h"
 +
 +/* TODO: add options for:
 +   - character encoding;
 +   - LF / CRLF;
 +   - byte order mark.
 + */
 +
 +typedef struct SRTContext{
 +    unsigned index;
 +} SRTContext;
 +
 +static int srt_write_header(AVFormatContext *avf)
 +{
 +    if (avf->nb_streams != 1 ||
 +        avf->streams[0]->codec->codec_type != AVMEDIA_TYPE_SUBTITLE) {
 +        av_log(avf, AV_LOG_ERROR,
 +               "SRT supports only a single subtitles stream.\n");
 +        return AVERROR(EINVAL);
 +    }
 +    if (avf->streams[0]->codec->codec_id != CODEC_ID_TEXT &&
 +        avf->streams[0]->codec->codec_id != CODEC_ID_SRT) {
 +        av_log(avf, AV_LOG_ERROR,
 +               "Unsupported subtitles codec: %s\n",
 +               avcodec_get_name(avf->streams[0]->codec->codec_id));
 +        return AVERROR(EINVAL);
 +    }
 +    avpriv_set_pts_info(avf->streams[0], 64, 1, 1000);
 +    return 0;
 +}
 +
 +static int srt_write_packet(AVFormatContext *avf, AVPacket *pkt)
 +{
 +    SRTContext *srt = avf->priv_data;
 +    int write_ts = avf->streams[0]->codec->codec_id != CODEC_ID_SRT;
 +
 +    srt->index++;
 +    if (write_ts) {
 +        char buf[64];
 +        int64_t s = pkt->pts, e, d = pkt->duration;
 +        int len;
 +
 +        if (d <= 0)
 +            d = pkt->convergence_duration;
 +        if (s == AV_NOPTS_VALUE || d <= 0) {
 +            av_log(avf, AV_LOG_ERROR, "Insufficient timestamps.\n");
 +            return AVERROR(EINVAL);
 +        }
 +        e = s + d;
 +        len = snprintf(buf, sizeof(buf),
 +                       "%d\n%02d:%02d:%02d,%03d --> %02d:%02d:%02d,%03d\n",
 +                       srt->index,
 +                       (int)(s / 3600000),      (int)(s / 60000) % 60,
 +                       (int)(s /    1000) % 60, (int)(s %  1000),
 +                       (int)(e / 3600000),      (int)(e / 60000) % 60,
 +                       (int)(e /    1000) % 60, (int)(e %  1000));
 +        avio_write(avf->pb, buf, len);
 +    }
 +    avio_write(avf->pb, pkt->data, pkt->size);
 +    if (write_ts)
 +        avio_write(avf->pb, "\n\n", 2);
 +    avio_flush(avf->pb);
 +    return 0;
 +}
 +
 +AVOutputFormat ff_srt_muxer = {
 +    .name           = "srt",
++    .long_name      = NULL_IF_CONFIG_SMALL("SubRip subtitle"),
 +    .mime_type      = "application/x-subrip",
 +    .extensions     = "srt",
 +    .priv_data_size = sizeof(SRTContext),
 +    .write_header   = srt_write_header,
 +    .write_packet   = srt_write_packet,
 +    .flags          = AVFMT_VARIABLE_FPS,
 +    .subtitle_codec = CODEC_ID_TEXT,
 +};
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index a80cad776dadd4f8e7cc5f4b96658fdce985c3e2,3fd1abcb87d80b74a1cf7fd3a4f324aa2871ae39..cc01ff16f435ef27bc3617a0d6e4c92860d6ae6d
@@@ -254,9 -269,9 +269,9 @@@ static int wv_read_packet(AVFormatConte
      int64_t pos;
      uint32_t block_samples;
  
 -    if (s->pb->eof_reached)
 +    if (url_feof(s->pb))
          return AVERROR_EOF;
-     if(wc->block_parsed){
+     if (wc->block_parsed) {
          if ((ret = wv_read_block_header(s, s->pb, 0)) < 0)
              return ret;
      }
Simple merge
Simple merge
index 21967505d95d4380bd0bafea33a8b4a479eb1f87,f4a9c60168ce3d62e779a47aa6199a349a234ba0..547b0dfcc02595956aea45a854a7e2f8f9573ba0
@@@ -266,7 -174,8 +266,7 @@@ static int yuv4_write_header(AVFormatCo
  
  AVOutputFormat ff_yuv4mpegpipe_muxer = {
      .name              = "yuv4mpegpipe",
-     .long_name         = NULL_IF_CONFIG_SMALL("YUV4MPEG pipe format"),
+     .long_name         = NULL_IF_CONFIG_SMALL("YUV4MPEG pipe"),
 -    .mime_type         = "",
      .extensions        = "y4m",
      .priv_data_size    = sizeof(int),
      .audio_codec       = CODEC_ID_NONE,
Simple merge
Simple merge
index 4f307b02b2b8fe126a0ebae44892bc2ada990ee6,5db266247823c72f9d2866031eae99710269cc23..b4d05d300d24567ce9ddf7f1037d73b52ee1edda
@@@ -103,7 -90,24 +105,24 @@@ static uint64_t int_sqrt(uint64_t a
      return ret;
  }
  
 -int main(int argc, char *argv[])
+ static int16_t get_s16l(uint8_t *p)
+ {
+     union {
+         uint16_t u;
+         int16_t  s;
+     } v;
+     v.u = p[0] | p[1] << 8;
+     return v.s;
+ }
+ static float get_f32l(uint8_t *p)
+ {
+     union av_intfloat32 v;
+     v.i = p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24;
+     return v.f;
+ }
 +static int run_psnr(FILE *f[2], int len, int shift, int skip_bytes)
  {
      int i, j;
      uint64_t sse = 0;
             (int)(dev / F), (int)(dev % F),
             (int)(psnr / F), (int)(psnr % F),
             maxdist, size0, size1);
-     int len        = argc < 4 ? 1 : atoi(argv[3]);
 +    return psnr;
 +}
 +
 +int main(int argc, char *argv[])
 +{
 +    FILE *f[2];
++    int len = 1;
 +    int shift_first= argc < 5 ? 0 : atoi(argv[4]);
 +    int skip_bytes = argc < 6 ? 0 : atoi(argv[5]);
 +    int shift_last = shift_first + (argc < 7 ? 0 : atoi(argv[6]));
 +    int shift;
 +    int max_psnr   = -1;
 +    int max_psnr_shift = 0;
 +
++    if (argc > 3) {
++        if (!strcmp(argv[3], "u8")) {
++            len = 1;
++        } else if (!strcmp(argv[3], "s16")) {
++            len = 2;
++        } else if (!strcmp(argv[3], "f32")) {
++            len = 4;
++        } else {
++            char *end;
++            len = strtol(argv[3], &end, 0);
++            if (*end || len > 2) {
++                fprintf(stderr, "Unsupported sample format: %s\n", argv[3]);
++                return 1;
++            }
++        }
++    }
++
 +    if (argc < 3) {
 +        printf("tiny_psnr <file1> <file2> [<elem size> [<shift> [<skip bytes> [<shift search range>]]]]\n");
 +        printf("WAV headers are skipped automatically.\n");
 +        return 1;
 +    }
 +
 +    f[0] = fopen(argv[1], "rb");
 +    f[1] = fopen(argv[2], "rb");
 +    if (!f[0] || !f[1]) {
 +        fprintf(stderr, "Could not open input files.\n");
 +        return 1;
 +    }
 +
 +    for (shift = shift_first; shift <= shift_last; shift++) {
 +        int psnr = run_psnr(f, len, shift, skip_bytes);
 +        if (psnr > max_psnr || (shift < 0 && psnr == max_psnr)) {
 +            max_psnr = psnr;
 +            max_psnr_shift = shift;
 +        }
 +    }
 +    if (shift_last > shift_first)
 +        printf("Best PSNR is %3d.%02d for shift %i\n", (int)(max_psnr / F), (int)(max_psnr % F), max_psnr_shift);
      return 0;
  }