OSDN Git Service

Merge commit '95baf701db719ecad6b31000429e20eca2526ed6'
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 13 Dec 2012 10:38:52 +0000 (11:38 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 13 Dec 2012 10:49:12 +0000 (11:49 +0100)
* commit '95baf701db719ecad6b31000429e20eca2526ed6':
  svq1: deMpegEncContextize

Conflicts:
libavcodec/svq1dec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/svq1dec.c

@@@ -502,11 -521,11 +515,13 @@@ static void svq1_parse_string(GetBitCon
      }
  }
  
- static int svq1_decode_frame_header(GetBitContext *bitbuf, MpegEncContext *s)
+ static int svq1_decode_frame_header(AVCodecContext *avctx, AVFrame *frame)
  {
+     SVQ1Context *s = avctx->priv_data;
+     GetBitContext *bitbuf = &s->gb;
      int frame_size_code;
 +    int width  = s->width;
 +    int height = s->height;
  
      skip_bits(bitbuf, 8); /* temporal_reference */
  
@@@ -597,25 -628,23 +626,25 @@@ static int svq1_decode_frame(AVCodecCon
      init_get_bits(&s->gb, buf, buf_size * 8);
  
      /* decode frame header */
-     s->f_code = get_bits(&s->gb, 22);
+     s->frame_code = get_bits(&s->gb, 22);
  
-     if ((s->f_code & ~0x70) || !(s->f_code & 0x60))
+     if ((s->frame_code & ~0x70) || !(s->frame_code & 0x60))
 -        return -1;
 +        return AVERROR_INVALIDDATA;
  
      /* swap some header bytes (why?) */
-     if (s->f_code != 0x20) {
+     if (s->frame_code != 0x20) {
          uint32_t *src = (uint32_t *)(buf + 4);
  
 +        if (buf_size < 36)
 +            return AVERROR_INVALIDDATA;
 +
          for (i = 0; i < 4; i++)
              src[i] = ((src[i] << 16) | (src[i] >> 16)) ^ src[7 - i];
      }
  
-     result = svq1_decode_frame_header(&s->gb, s);
-     if (result) {
-         av_dlog(s->avctx, "Error in svq1_decode_frame_header %i\n", result);
+     result = svq1_decode_frame_header(avctx, cur);
 -
+     if (result != 0) {
 -        av_dlog(s->avctx, "Error in svq1_decode_frame_header %i\n", result);
++        av_dlog(avctx, "Error in svq1_decode_frame_header %i\n", result);
          return result;
      }
      avcodec_set_dimensions(avctx, s->width, s->height);
                  for (x = 0; x < width; x += 16) {
                      result = svq1_decode_block_intra(&s->gb, &current[x],
                                                       linesize);
 -                    if (result != 0) {
 -                        av_log(avctx, AV_LOG_INFO,
 +                    if (result) {
-                         av_log(s->avctx, AV_LOG_ERROR,
++                        av_log(avctx, AV_LOG_ERROR,
                                 "Error in svq1_decode_block %i (keyframe)\n",
                                 result);
                          goto err;
  
              for (y = 0; y < height; y += 16) {
                  for (x = 0; x < width; x += 16) {
-                     result = svq1_decode_delta_block(s, &s->gb, &current[x],
+                     result = svq1_decode_delta_block(avctx, &s->dsp,
+                                                      &s->gb, &current[x],
                                                       previous, linesize,
                                                       pmv, x, y);
 -                    if (result != 0) {
 -                        av_dlog(s->avctx,
 +                    if (result) {
-                         av_dlog(s->avctx,
++                        av_dlog(avctx,
                                  "Error in svq1_decode_delta_block %i\n",
                                  result);
                          goto err;
          }
      }
  
-     *pict = s->current_picture.f;
-     pict->qscale_table = NULL;
-     ff_MPV_frame_end(s);
+     *(AVFrame*)data = *cur;
++    cur->qscale_table = NULL;
+     if (!s->nonref)
+         FFSWAP(AVFrame*, s->cur, s->prev);
  
      *got_frame = 1;
      result     = buf_size;