diff svq1.c @ 903:22ee74da2cd3 libavcodec

cleanup adding AVVideoFrame moving quality, pict_type, key_frame, qscale_table, ... to AVVideoFrame removing obsolete variables in AVCodecContext skiping of MBs in b frames correctly initalizing AVCodecContext picture buffer cleanup
author michaelni
date Wed, 04 Dec 2002 10:04:03 +0000
parents 058194d7ade6
children 3814e9115672
line wrap: on
line diff
--- a/svq1.c	Tue Dec 03 19:40:35 2002 +0000
+++ b/svq1.c	Wed Dec 04 10:04:03 2002 +0000
@@ -1063,7 +1063,7 @@
   MpegEncContext *s=avctx->priv_data;
   uint8_t      *current, *previous;
   int		result, i, x, y, width, height;
-  AVPicture *pict = data; 
+  AVVideoFrame *pict = data; 
 
   /* initialize bit buffer */
   init_get_bits(&s->gb,buf,buf_size);
@@ -1084,9 +1084,6 @@
   }
 
   result = svq1_decode_frame_header (&s->gb, s);
-  
-  if(MPV_frame_start(s, avctx) < 0)
-      return -1;
 
   if (result != 0)
   {
@@ -1098,6 +1095,9 @@
   
   if(avctx->hurry_up && s->pict_type==B_TYPE) return buf_size;
 
+  if(MPV_frame_start(s, avctx) < 0)
+      return -1;
+
   /* decode y, u and v components */
   for (i=0; i < 3; i++) {
     int linesize;
@@ -1112,12 +1112,12 @@
       linesize= s->uvlinesize;
     }
 
-    current  = s->current_picture[i];
+    current  = s->current_picture.data[i];
 
     if(s->pict_type==B_TYPE){
-        previous = s->next_picture[i];
+        previous = s->next_picture.data[i];
     }else{
-        previous = s->last_picture[i];
+        previous = s->last_picture.data[i];
     }
 
     if (s->pict_type == I_TYPE) {
@@ -1159,12 +1159,14 @@
 	current += 16*linesize;
       }
     }
+  }
+  
+  *pict = *(AVVideoFrame*)&s->current_picture;
 
-    pict->data[i] = s->current_picture[i];
-    pict->linesize[i] = linesize;
-  }
 
-  *data_size=sizeof(AVPicture);
+  MPV_frame_end(s);
+  
+  *data_size=sizeof(AVVideoFrame);
   return buf_size;
 }
 
@@ -1176,7 +1178,6 @@
     s->width = (avctx->width+3)&~3;
     s->height = (avctx->height+3)&~3;
     s->codec_id= avctx->codec->id;
-    avctx->mbskip_table= s->mbskip_table;
     avctx->pix_fmt = PIX_FMT_YUV410P;
     avctx->has_b_frames= s->has_b_frames=1; // not true, but DP frames and these behave like unidirectional b frames
     s->flags= avctx->flags;