]> git.sesse.net Git - ffmpeg/commitdiff
Merge remote-tracking branch 'qatar/master'
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 10 Nov 2011 02:09:46 +0000 (03:09 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 10 Nov 2011 02:45:23 +0000 (03:45 +0100)
* qatar/master:
  avcodec: add support for planar signed 8-bit PCM.
  ra144enc: add sample_fmts list to ff_ra_144_encoder
  smackaud: use uint8_t* for 8-bit output buffer type
  smackaud: clip output samples
  smackaud: use sign_extend() for difference value instead of casting
  sipr: use a function pointer to select the decode_frame function
  sipr: set mode based on block_align instead of bit_rate
  sipr: do not needlessly set *data_size to 0 when returning an error
  ra288: fix formatting of LOCAL_ALIGNED_16
  udp: Allow specifying the local IP address
  VC1: Add bottom field offset to block_index[] to avoid rewriting (+10L)
  vc1dec: move an if() block.
  vc1dec: use correct hybrid prediction threshold.
  vc1dec: Partial rewrite of vc1_pred_mv()
  vc1dec: take ME precision into account while scaling MV predictors.
  lavf: don't leak corrupted packets

Conflicts:
libavcodec/8svx.c
libavcodec/ra288.c
libavcodec/version.h
libavformat/iff.c
libavformat/udp.c
libavformat/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
14 files changed:
1  2 
doc/protocols.texi
libavcodec/8svx.c
libavcodec/Makefile
libavcodec/allcodecs.c
libavcodec/avcodec.h
libavcodec/ra144enc.c
libavcodec/ra288.c
libavcodec/sipr.c
libavcodec/sipr.h
libavcodec/smacker.c
libavcodec/vc1dec.c
libavcodec/version.h
libavformat/iff.c
libavformat/udp.c

Simple merge
index 5c68d347e24bf680739c48514bd9bca43e406345,3e3eae6c870112a1ae15e2fa82ed9c1032c43c7d..efe554adc298b4aa131c2003354f111af4d26975
@@@ -103,86 -87,105 +103,87 @@@ static int eightsvx_decode_frame(AVCode
                                   AVPacket *avpkt)
  {
      EightSvxContext *esc = avctx->priv_data;
 -    int buf_size;
 -    uint8_t *out_data = data;
 -    int out_data_size;
 -    int is_compr = (avctx->codec_id != CODEC_ID_PCM_S8_PLANAR);
 -
 -    /* for the first packet, copy data to buffer */
 -    if (avpkt->data) {
 -        int hdr_size  = is_compr ? 2 : 0;
 -        int chan_size = (avpkt->size - hdr_size * avctx->channels) / avctx->channels;
 -
 -        if (avpkt->size < hdr_size * avctx->channels) {
 -            av_log(avctx, AV_LOG_ERROR, "packet size is too small\n");
 -            return AVERROR(EINVAL);
 -        }
 -        if (esc->data[0]) {
 -            av_log(avctx, AV_LOG_ERROR, "unexpected data after first packet\n");
 -            return AVERROR(EINVAL);
 -        }
 +    int out_data_size, n;
 +    uint8_t *src, *dst;
  
 -        if (is_compr) {
 -        esc->fib_acc[0] = avpkt->data[1] + 128;
 -        if (avctx->channels == 2)
 -            esc->fib_acc[1] = avpkt->data[2+chan_size+1] + 128;
 -        }
 +    /* decode and interleave the first packet */
 +    if (!esc->samples && avpkt) {
 +        uint8_t *deinterleaved_samples;
  
-         esc->samples_size = avctx->codec->id == CODEC_ID_8SVX_RAW ?
 -        esc->data_idx  = 0;
 -        esc->data_size = chan_size;
 -        if (!(esc->data[0] = av_malloc(chan_size)))
++        esc->samples_size = avctx->codec->id == CODEC_ID_8SVX_RAW || avctx->codec->id ==CODEC_ID_PCM_S8_PLANAR?
 +            avpkt->size : avctx->channels + (avpkt->size-avctx->channels) * 2;
 +        if (!(esc->samples = av_malloc(esc->samples_size)))
              return AVERROR(ENOMEM);
 -        if (avctx->channels == 2) {
 -            if (!(esc->data[1] = av_malloc(chan_size))) {
 -                av_freep(&esc->data[0]);
 -                return AVERROR(ENOMEM);
 +
 +        /* decompress */
 +        if (avctx->codec->id == CODEC_ID_8SVX_FIB || avctx->codec->id == CODEC_ID_8SVX_EXP) {
 +            const uint8_t *buf = avpkt->data;
 +            int buf_size = avpkt->size;
 +            int n = esc->samples_size;
 +
 +            if (buf_size < 2) {
 +                av_log(avctx, AV_LOG_ERROR, "packet size is too small\n");
 +                return AVERROR(EINVAL);
              }
 +            if (!(deinterleaved_samples = av_mallocz(n)))
 +                return AVERROR(ENOMEM);
 +
 +            /* the uncompressed starting value is contained in the first byte */
 +            if (avctx->channels == 2) {
 +                delta_decode(deinterleaved_samples      , buf+1, buf_size/2-1, buf[0], esc->table);
 +                buf += buf_size/2;
 +                delta_decode(deinterleaved_samples+n/2-1, buf+1, buf_size/2-1, buf[0], esc->table);
 +            } else
 +                delta_decode(deinterleaved_samples      , buf+1, buf_size-1  , buf[0], esc->table);
 +        } else {
 +            deinterleaved_samples = avpkt->data;
          }
 -        memcpy(esc->data[0], &avpkt->data[hdr_size], chan_size);
 +
          if (avctx->channels == 2)
 -            memcpy(esc->data[1], &avpkt->data[2*hdr_size+chan_size], chan_size);
 -    }
 -    if (!esc->data[0]) {
 -        av_log(avctx, AV_LOG_ERROR, "unexpected empty packet\n");
 -        return AVERROR(EINVAL);
 +            interleave_stereo(esc->samples, deinterleaved_samples, esc->samples_size);
 +        else
 +            memcpy(esc->samples, deinterleaved_samples, esc->samples_size);
      }
  
 -    /* decode next piece of data from the buffer */
 -    buf_size = FFMIN(MAX_FRAME_SIZE, esc->data_size - esc->data_idx);
 -    if (buf_size <= 0) {
 -        *data_size = 0;
 -        return avpkt->size;
 -    }
 -    out_data_size = buf_size * (is_compr + 1) * avctx->channels;
 +    /* return single packed with fixed size */
 +    out_data_size = FFMIN(MAX_FRAME_SIZE, esc->samples_size - esc->samples_idx);
      if (*data_size < out_data_size) {
 -        av_log(avctx, AV_LOG_ERROR, "Provided buffer with size %d is too small.\n",
 -               *data_size);
 +        av_log(avctx, AV_LOG_ERROR, "Provided buffer with size %d is too small.\n", *data_size);
          return AVERROR(EINVAL);
      }
 -    if (is_compr) {
 -    delta_decode(out_data, &esc->data[0][esc->data_idx], buf_size,
 -                 &esc->fib_acc[0], esc->table, avctx->channels);
 -    if (avctx->channels == 2) {
 -        delta_decode(&out_data[1], &esc->data[1][esc->data_idx], buf_size,
 -                    &esc->fib_acc[1], esc->table, avctx->channels);
 -    }
 -    } else {
 -        int ch;
 -        for (ch = 0; ch < avctx->channels; ch++) {
 -            raw_decode((int8_t *)&out_data[ch], &esc->data[ch][esc->data_idx],
 -                       buf_size, avctx->channels);
 -        }
 -    }
 -    esc->data_idx += buf_size;
 -    *data_size = out_data_size;
  
 -    return avpkt->size;
 +    *data_size = out_data_size;
 +    dst = data;
 +    src = esc->samples + esc->samples_idx;
 +    for (n = out_data_size; n > 0; n--)
 +        *dst++ = *src++ + 128;
 +    esc->samples_idx += *data_size;
 +
 +    return avctx->codec->id == CODEC_ID_8SVX_FIB || avctx->codec->id == CODEC_ID_8SVX_EXP ?
 +        (avctx->frame_number == 0)*2 + out_data_size / 2 :
 +        out_data_size;
  }
  
 -/** initialize 8svx decoder */
  static av_cold int eightsvx_decode_init(AVCodecContext *avctx)
  {
      EightSvxContext *esc = avctx->priv_data;
  
-     if (avctx->channels > 2) {
+     if (avctx->channels < 1 || avctx->channels > 2) {
          av_log(avctx, AV_LOG_ERROR, "8SVX does not support more than 2 channels\n");
 -        return AVERROR(EINVAL);
 +        return AVERROR_INVALIDDATA;
      }
  
 -    switch(avctx->codec->id) {
 -        case CODEC_ID_8SVX_FIB:
 -          esc->table = fibonacci;
 -          break;
 -        case CODEC_ID_8SVX_EXP:
 -          esc->table = exponential;
 -          break;
 -        case CODEC_ID_PCM_S8_PLANAR:
 -            break;
 -        default:
 -          return -1;
 +    switch (avctx->codec->id) {
 +    case CODEC_ID_8SVX_FIB: esc->table = fibonacci;    break;
 +    case CODEC_ID_8SVX_EXP: esc->table = exponential;  break;
++    case CODEC_ID_PCM_S8_PLANAR:
 +    case CODEC_ID_8SVX_RAW: esc->table = NULL;         break;
 +    default:
 +        av_log(avctx, AV_LOG_ERROR, "Invalid codec id %d.\n", avctx->codec->id);
 +        return AVERROR_INVALIDDATA;
      }
      avctx->sample_fmt = AV_SAMPLE_FMT_U8;
 +
      return 0;
  }
  
@@@ -219,13 -223,14 +220,13 @@@ AVCodec ff_eightsvx_exp_decoder = 
    .long_name      = NULL_IF_CONFIG_SMALL("8SVX exponential"),
  };
  
- AVCodec ff_eightsvx_raw_decoder = {
-   .name           = "8svx_raw",
-   .type           = AVMEDIA_TYPE_AUDIO,
-   .id             = CODEC_ID_8SVX_RAW,
-   .priv_data_size = sizeof(EightSvxContext),
-   .init           = eightsvx_decode_init,
-   .decode         = eightsvx_decode_frame,
-   .close          = eightsvx_decode_close,
-   .long_name      = NULL_IF_CONFIG_SMALL("8SVX rawaudio"),
+ AVCodec ff_pcm_s8_planar_decoder = {
+     .name           = "pcm_s8_planar",
+     .type           = AVMEDIA_TYPE_AUDIO,
+     .id             = CODEC_ID_PCM_S8_PLANAR,
+     .priv_data_size = sizeof(EightSvxContext),
+     .init           = eightsvx_decode_init,
+     .close          = eightsvx_decode_close,
+     .decode         = eightsvx_decode_frame,
 -    .capabilities   = CODEC_CAP_DELAY,
+     .long_name      = NULL_IF_CONFIG_SMALL("PCM signed 8-bit planar"),
  };
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index b09a9c5314f0d4e14dc9f15b4580c92d63e327e4,c11f09c9d42fe15e813eefee4999814fc311ee45..9e827319a0eb9efdc0be91d9ad57ff4e849e0f5d
@@@ -21,7 -21,7 +21,7 @@@
  #define AVCODEC_VERSION_H
  
  #define LIBAVCODEC_VERSION_MAJOR 53
- #define LIBAVCODEC_VERSION_MINOR 29
 -#define LIBAVCODEC_VERSION_MINOR 18
++#define LIBAVCODEC_VERSION_MINOR 30
  #define LIBAVCODEC_VERSION_MICRO  0
  
  #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
index 2283ed505acc2877e09c2457041dfe64f1d7ba6a,e6213738628e3ef506c778567d77f4581b08b737..7601d6d73b19defef209e5f8fc93c91658ecc31a
@@@ -237,9 -218,9 +237,9 @@@ static int iff_read_header(AVFormatCont
      case AVMEDIA_TYPE_AUDIO:
          av_set_pts_info(st, 32, 1, st->codec->sample_rate);
  
 -        switch(compression) {
 +        switch (iff->svx8_compression) {
          case COMP_NONE:
-             st->codec->codec_id = CODEC_ID_8SVX_RAW;
+             st->codec->codec_id = CODEC_ID_PCM_S8_PLANAR;
              break;
          case COMP_FIB:
              st->codec->codec_id = CODEC_ID_8SVX_FIB;
index dd80bb0e89adb360b212e241f3434be5138d3b10,178cef477afba85c133ea570f5167dd017703ba6..170f132190e025deb1d58b974ead558d98af11e4
@@@ -29,8 -29,7 +29,9 @@@
  #include "avformat.h"
  #include "avio_internal.h"
  #include "libavutil/parseutils.h"
 +#include "libavutil/fifo.h"
 +#include "libavutil/intreadwrite.h"
+ #include "libavutil/avstring.h"
  #include <unistd.h>
  #include "internal.h"
  #include "network.h"
@@@ -427,9 -352,9 +429,12 @@@ static int udp_open(URLContext *h, cons
          if (av_find_info_tag(buf, sizeof(buf), "connect", p)) {
              s->is_connected = strtol(buf, NULL, 10);
          }
 +        if (av_find_info_tag(buf, sizeof(buf), "fifo_size", p)) {
 +            s->circular_buffer_size = strtol(buf, NULL, 10)*188;
 +        }
+         if (av_find_info_tag(buf, sizeof(buf), "localaddr", p)) {
+             av_strlcpy(localaddr, buf, sizeof(localaddr));
+         }
      }
  
      /* fill the dest addr */