]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/svq1enc.c
vp6: Reset the internal state when aborting key frames header parsing
[ffmpeg] / libavcodec / svq1enc.c
index cf10d85c396ddc6c840fe6f1e5faefc33fdbe84a..36787cfdce639bee97ef8aa4d73ac9b4fcfcc7a5 100644 (file)
@@ -86,7 +86,7 @@ static void svq1_write_header(SVQ1Context *s, int frame_type)
     /* frame type */
     put_bits(&s->pb, 2, frame_type - 1);
 
-    if (frame_type == FF_I_TYPE) {
+    if (frame_type == AV_PICTURE_TYPE_I) {
 
         /* no checksum since frame code is 0x20 */
 
@@ -280,15 +280,15 @@ static int svq1_encode_plane(SVQ1Context *s, int plane, unsigned char *src_plane
     block_width = (width + 15) / 16;
     block_height = (height + 15) / 16;
 
-    if(s->picture.pict_type == FF_P_TYPE){
+    if(s->picture.pict_type == AV_PICTURE_TYPE_P){
         s->m.avctx= s->avctx;
         s->m.current_picture_ptr= &s->m.current_picture;
         s->m.last_picture_ptr   = &s->m.last_picture;
-        s->m.last_picture.data[0]= ref_plane;
+        s->m.last_picture.f.data[0] = ref_plane;
         s->m.linesize=
-        s->m.last_picture.linesize[0]=
-        s->m.new_picture.linesize[0]=
-        s->m.current_picture.linesize[0]= stride;
+        s->m.last_picture.f.linesize[0] =
+        s->m.new_picture.f.linesize[0] =
+        s->m.current_picture.f.linesize[0] = stride;
         s->m.width= width;
         s->m.height= height;
         s->m.mb_width= block_width;
@@ -318,9 +318,9 @@ static int svq1_encode_plane(SVQ1Context *s, int plane, unsigned char *src_plane
         s->m.current_picture.mb_mean=   (uint8_t *)s->dummy;
         s->m.current_picture.mb_var=    (uint16_t*)s->dummy;
         s->m.current_picture.mc_mb_var= (uint16_t*)s->dummy;
-        s->m.current_picture.mb_type= s->dummy;
+        s->m.current_picture.f.mb_type = s->dummy;
 
-        s->m.current_picture.motion_val[0]= s->motion_val8[plane] + 2;
+        s->m.current_picture.f.motion_val[0] = s->motion_val8[plane] + 2;
         s->m.p_mv_table= s->motion_val16[plane] + s->m.mb_stride + 1;
         s->m.dsp= s->dsp; //move
         ff_init_me(&s->m);
@@ -328,7 +328,7 @@ static int svq1_encode_plane(SVQ1Context *s, int plane, unsigned char *src_plane
         s->m.me.dia_size= s->avctx->dia_size;
         s->m.first_slice_line=1;
         for (y = 0; y < block_height; y++) {
-            s->m.new_picture.data[0]= src - y*16*stride; //ugly
+            s->m.new_picture.f.data[0] = src - y*16*stride; //ugly
             s->m.mb_y= y;
 
             for(i=0; i<16 && i + 16*y<height; i++){
@@ -382,11 +382,11 @@ static int svq1_encode_plane(SVQ1Context *s, int plane, unsigned char *src_plane
             ff_init_block_index(&s->m);
             ff_update_block_index(&s->m);
 
-            if(s->picture.pict_type == FF_I_TYPE || (s->m.mb_type[x + y*s->m.mb_stride]&CANDIDATE_MB_TYPE_INTRA)){
+            if(s->picture.pict_type == AV_PICTURE_TYPE_I || (s->m.mb_type[x + y*s->m.mb_stride]&CANDIDATE_MB_TYPE_INTRA)){
                 for(i=0; i<6; i++){
                     init_put_bits(&s->reorder_pb[i], reorder_buffer[0][i], 7*32);
                 }
-                if(s->picture.pict_type == FF_P_TYPE){
+                if(s->picture.pict_type == AV_PICTURE_TYPE_P){
                     const uint8_t *vlc= ff_svq1_block_type_vlc[SVQ1_BLOCK_INTRA];
                     put_bits(&s->reorder_pb[5], vlc[1], vlc[0]);
                     score[0]= vlc[1]*lambda;
@@ -401,7 +401,7 @@ static int svq1_encode_plane(SVQ1Context *s, int plane, unsigned char *src_plane
 
             best=0;
 
-            if(s->picture.pict_type == FF_P_TYPE){
+            if(s->picture.pict_type == AV_PICTURE_TYPE_P){
                 const uint8_t *vlc= ff_svq1_block_type_vlc[SVQ1_BLOCK_INTER];
                 int mx, my, pred_x, pred_y, dxy;
                 int16_t *motion_ptr;
@@ -528,8 +528,8 @@ static int svq1_encode_frame(AVCodecContext *avctx, unsigned char *buf,
     init_put_bits(&s->pb, buf, buf_size);
 
     *p = *pict;
-    p->pict_type = avctx->gop_size && avctx->frame_number % avctx->gop_size ? FF_P_TYPE : FF_I_TYPE;
-    p->key_frame = p->pict_type == FF_I_TYPE;
+    p->pict_type = avctx->gop_size && avctx->frame_number % avctx->gop_size ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I;
+    p->key_frame = p->pict_type == AV_PICTURE_TYPE_I;
 
     svq1_write_header(s, p->pict_type);
     for(i=0; i<3; i++){
@@ -573,13 +573,13 @@ static av_cold int svq1_encode_end(AVCodecContext *avctx)
 
 
 AVCodec ff_svq1_encoder = {
-    "svq1",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_SVQ1,
-    sizeof(SVQ1Context),
-    svq1_encode_init,
-    svq1_encode_frame,
-    svq1_encode_end,
+    .name           = "svq1",
+    .type           = AVMEDIA_TYPE_VIDEO,
+    .id             = CODEC_ID_SVQ1,
+    .priv_data_size = sizeof(SVQ1Context),
+    .init           = svq1_encode_init,
+    .encode         = svq1_encode_frame,
+    .close          = svq1_encode_end,
     .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUV410P, PIX_FMT_NONE},
     .long_name= NULL_IF_CONFIG_SMALL("Sorenson Vector Quantizer 1 / Sorenson Video 1 / SVQ1"),
 };