Merge commit '4a2b26fc1b1ad123eba473a20e270f2b0ba92bca'
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 13 Feb 2013 11:35:37 +0000 (12:35 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 13 Feb 2013 11:35:37 +0000 (12:35 +0100)
* commit '4a2b26fc1b1ad123eba473a20e270f2b0ba92bca':
  tak: decode directly to the user-provided AVFrame
  smackaud: decode directly to the user-provided AVFrame
  sipr: decode directly to the user-provided AVFrame
  shorten: decode directly to the user-provided AVFrame

Conflicts:
libavcodec/shorten.c
libavcodec/takdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/shorten.c
libavcodec/sipr.c
libavcodec/sipr.h
libavcodec/smacker.c
libavcodec/takdec.c

@@@ -117,10 -112,8 +116,7 @@@ static av_cold int shorten_decode_init(
  {
      ShortenContext *s = avctx->priv_data;
      s->avctx = avctx;
 -    avctx->sample_fmt = AV_SAMPLE_FMT_S16P;
  
-     avcodec_get_frame_defaults(&s->frame);
-     avctx->coded_frame = &s->frame;
      return 0;
  }
  
@@@ -580,36 -578,17 +577,34 @@@ static int shorten_decode_frame(AVCodec
              /* if this is the last channel in the block, output the samples */
              s->cur_chan++;
              if (s->cur_chan == s->channels) {
 +                uint8_t *samples_u8;
 +                int16_t *samples_s16;
 +                int chan;
 +
                  /* get output buffer */
-                 s->frame.nb_samples = s->blocksize;
-                 if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
+                 frame->nb_samples = s->blocksize;
+                 if ((ret = ff_get_buffer(avctx, frame)) < 0) {
                      av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
                      return ret;
                  }
 -                /* interleave output */
 -                output_buffer((int16_t **)frame->extended_data, s->channels,
 -                              s->blocksize, s->decoded);
 +
 +                for (chan = 0; chan < s->channels; chan++) {
-                     samples_u8  = ((uint8_t **)s->frame.extended_data)[chan];
-                     samples_s16 = ((int16_t **)s->frame.extended_data)[chan];
++                    samples_u8  = ((uint8_t **)frame->extended_data)[chan];
++                    samples_s16 = ((int16_t **)frame->extended_data)[chan];
 +                    for (i = 0; i < s->blocksize; i++) {
 +                        switch (s->internal_ftype) {
 +                        case TYPE_U8:
 +                            *samples_u8++ = av_clip_uint8(s->decoded[chan][i]);
 +                            break;
 +                        case TYPE_S16HL:
 +                        case TYPE_S16LH:
 +                            *samples_s16++ = av_clip_int16(s->decoded[chan][i]);
 +                            break;
 +                        }
 +                    }
 +                }
  
-                 *got_frame_ptr   = 1;
-                 *(AVFrame *)data = s->frame;
+                 *got_frame_ptr = 1;
              }
          }
      }
Simple merge
Simple merge
Simple merge
@@@ -44,32 -44,27 +44,31 @@@ typedef struct MCDParam 
  } MCDParam;
  
  typedef struct TAKDecContext {
 -    AVCodecContext *avctx;                          // parent AVCodecContext
 +    AVCodecContext *avctx;                          ///< parent AVCodecContext
-     AVFrame         frame;                          ///< AVFrame for decoded output
      DSPContext      dsp;
      TAKStreamInfo   ti;
 -    GetBitContext   gb;                             // bitstream reader initialized to start at the current frame
 +    GetBitContext   gb;                             ///< bitstream reader initialized to start at the current frame
  
      int             uval;
 -    int             nb_samples;                     // number of samples in the current frame
 +    int             nb_samples;                     ///< number of samples in the current frame
      uint8_t        *decode_buffer;
      unsigned int    decode_buffer_size;
 -    int32_t        *decoded[TAK_MAX_CHANNELS];      // decoded samples for each channel
 +    int32_t        *decoded[TAK_MAX_CHANNELS];      ///< decoded samples for each channel
  
      int8_t          lpc_mode[TAK_MAX_CHANNELS];
 -    int8_t          sample_shift[TAK_MAX_CHANNELS]; // shift applied to every sample in the channel
 +    int8_t          sample_shift[TAK_MAX_CHANNELS]; ///< shift applied to every sample in the channel
 +    int16_t         predictors[MAX_PREDICTORS];
 +    int             nb_subframes;                   ///< number of subframes in the current frame
 +    int16_t         subframe_len[MAX_SUBFRAMES];    ///< subframe length in samples
      int             subframe_scale;
  
 -    int8_t          dmode;                          // channel decorrelation type in the current frame
 +    int8_t          dmode;                          ///< channel decorrelation type in the current frame
  
 -    MCDParam        mcdparams[TAK_MAX_CHANNELS];    // multichannel decorrelation parameters
 +    MCDParam        mcdparams[TAK_MAX_CHANNELS];    ///< multichannel decorrelation parameters
  
 -    int16_t        *residues;
 -    unsigned int    residues_buf_size;
 +    int8_t          coding_mode[128];
 +    DECLARE_ALIGNED(16, int16_t, filter)[MAX_PREDICTORS];
 +    DECLARE_ALIGNED(16, int16_t, residues)[544];
  } TAKDecContext;
  
  static const int8_t mc_dmodes[] = { 1, 3, 4, 6, };
@@@ -175,9 -175,6 +174,7 @@@ static av_cold int tak_decode_init(AVCo
      ff_dsputil_init(&s->dsp, avctx);
  
      s->avctx = avctx;
-     avcodec_get_frame_defaults(&s->frame);
-     avctx->coded_frame = &s->frame;
 +    avctx->bits_per_raw_sample = avctx->bits_per_coded_sample;
  
      set_sample_rate_params(avctx);
  
@@@ -750,11 -739,11 +748,11 @@@ static int tak_decode_frame(AVCodecCont
      s->nb_samples = s->ti.last_frame_samples ? s->ti.last_frame_samples
                                               : s->ti.frame_samples;
  
-     s->frame.nb_samples = s->nb_samples;
-     if ((ret = ff_get_buffer(avctx, &s->frame)) < 0)
+     frame->nb_samples = s->nb_samples;
+     if ((ret = ff_get_buffer(avctx, frame)) < 0)
          return ret;
  
 -    if (avctx->bits_per_coded_sample <= 16) {
 +    if (avctx->bits_per_raw_sample <= 16) {
          int buf_size = av_samples_get_buffer_size(NULL, avctx->channels,
                                                    s->nb_samples,
                                                    AV_SAMPLE_FMT_S32P, 0);