LCOV - code coverage report
Current view: top level - libavcodec - wmv2dec.c (source / functions) Hit Total Coverage
Test: coverage.info Lines: 236 266 88.7 %
Date: 2017-12-15 11:05:35 Functions: 10 10 100.0 %

          Line data    Source code
       1             : /*
       2             :  * Copyright (c) 2002 The FFmpeg Project
       3             :  *
       4             :  * This file is part of FFmpeg.
       5             :  *
       6             :  * FFmpeg is free software; you can redistribute it and/or
       7             :  * modify it under the terms of the GNU Lesser General Public
       8             :  * License as published by the Free Software Foundation; either
       9             :  * version 2.1 of the License, or (at your option) any later version.
      10             :  *
      11             :  * FFmpeg is distributed in the hope that it will be useful,
      12             :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      13             :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      14             :  * Lesser General Public License for more details.
      15             :  *
      16             :  * You should have received a copy of the GNU Lesser General Public
      17             :  * License along with FFmpeg; if not, write to the Free Software
      18             :  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
      19             :  */
      20             : 
      21             : #include "avcodec.h"
      22             : #include "h263.h"
      23             : #include "internal.h"
      24             : #include "intrax8.h"
      25             : #include "mathops.h"
      26             : #include "mpegutils.h"
      27             : #include "mpegvideo.h"
      28             : #include "msmpeg4.h"
      29             : #include "msmpeg4data.h"
      30             : #include "wmv2.h"
      31             : 
      32             : 
      33         645 : static int parse_mb_skip(Wmv2Context *w)
      34             : {
      35             :     int mb_x, mb_y;
      36         645 :     MpegEncContext *const s = &w->s;
      37         645 :     uint32_t *const mb_type = s->current_picture_ptr->mb_type;
      38             : 
      39         645 :     w->skip_type = get_bits(&s->gb, 2);
      40         645 :     switch (w->skip_type) {
      41         230 :     case SKIP_TYPE_NONE:
      42        3545 :         for (mb_y = 0; mb_y < s->mb_height; mb_y++)
      43       72180 :             for (mb_x = 0; mb_x < s->mb_width; mb_x++)
      44       68865 :                 mb_type[mb_y * s->mb_stride + mb_x] =
      45             :                     MB_TYPE_16x16 | MB_TYPE_L0;
      46         230 :         break;
      47          28 :     case SKIP_TYPE_MPEG:
      48          28 :         if (get_bits_left(&s->gb) < s->mb_height * s->mb_width)
      49           0 :             return AVERROR_INVALIDDATA;
      50         448 :         for (mb_y = 0; mb_y < s->mb_height; mb_y++)
      51        8820 :             for (mb_x = 0; mb_x < s->mb_width; mb_x++)
      52        8400 :                 mb_type[mb_y * s->mb_stride + mb_x] =
      53        8400 :                     (get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0;
      54          28 :         break;
      55         354 :     case SKIP_TYPE_ROW:
      56        5664 :         for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
      57        5310 :             if (get_bits_left(&s->gb) < 1)
      58           0 :                 return AVERROR_INVALIDDATA;
      59        5310 :             if (get_bits1(&s->gb)) {
      60       17220 :                 for (mb_x = 0; mb_x < s->mb_width; mb_x++)
      61       16400 :                     mb_type[mb_y * s->mb_stride + mb_x] =
      62             :                         MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
      63             :             } else {
      64       94290 :                 for (mb_x = 0; mb_x < s->mb_width; mb_x++)
      65       89800 :                     mb_type[mb_y * s->mb_stride + mb_x] =
      66       89800 :                         (get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0;
      67             :             }
      68             :         }
      69         354 :         break;
      70          33 :     case SKIP_TYPE_COL:
      71         693 :         for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
      72         660 :             if (get_bits_left(&s->gb) < 1)
      73           0 :                 return AVERROR_INVALIDDATA;
      74         660 :             if (get_bits1(&s->gb)) {
      75        2736 :                 for (mb_y = 0; mb_y < s->mb_height; mb_y++)
      76        2565 :                     mb_type[mb_y * s->mb_stride + mb_x] =
      77             :                         MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0;
      78             :             } else {
      79        7824 :                 for (mb_y = 0; mb_y < s->mb_height; mb_y++)
      80        7335 :                     mb_type[mb_y * s->mb_stride + mb_x] =
      81        7335 :                         (get_bits1(&s->gb) ? MB_TYPE_SKIP : 0) | MB_TYPE_16x16 | MB_TYPE_L0;
      82             :             }
      83             :         }
      84          33 :         break;
      85             :     }
      86         645 :     return 0;
      87             : }
      88             : 
      89           5 : static int decode_ext_header(Wmv2Context *w)
      90             : {
      91           5 :     MpegEncContext *const s = &w->s;
      92             :     GetBitContext gb;
      93             :     int fps;
      94             :     int code;
      95             : 
      96           5 :     if (s->avctx->extradata_size < 4)
      97           0 :         return AVERROR_INVALIDDATA;
      98             : 
      99           5 :     init_get_bits(&gb, s->avctx->extradata, 32);
     100             : 
     101           5 :     fps                 = get_bits(&gb, 5);
     102           5 :     s->bit_rate         = get_bits(&gb, 11) * 1024;
     103           5 :     w->mspel_bit        = get_bits1(&gb);
     104           5 :     s->loop_filter      = get_bits1(&gb);
     105           5 :     w->abt_flag         = get_bits1(&gb);
     106           5 :     w->j_type_bit       = get_bits1(&gb);
     107           5 :     w->top_left_mv_flag = get_bits1(&gb);
     108           5 :     w->per_mb_rl_bit    = get_bits1(&gb);
     109           5 :     code                = get_bits(&gb, 3);
     110             : 
     111           5 :     if (code == 0)
     112           0 :         return AVERROR_INVALIDDATA;
     113             : 
     114           5 :     s->slice_height = s->mb_height / code;
     115             : 
     116           5 :     if (s->avctx->debug & FF_DEBUG_PICT_INFO)
     117           0 :         av_log(s->avctx, AV_LOG_DEBUG,
     118             :                "fps:%d, br:%"PRId64", qpbit:%d, abt_flag:%d, j_type_bit:%d, "
     119             :                "tl_mv_flag:%d, mbrl_bit:%d, code:%d, loop_filter:%d, "
     120             :                "slices:%d\n",
     121             :                fps, s->bit_rate, w->mspel_bit, w->abt_flag, w->j_type_bit,
     122             :                w->top_left_mv_flag, w->per_mb_rl_bit, code, s->loop_filter,
     123             :                code);
     124           5 :     return 0;
     125             : }
     126             : 
     127         674 : int ff_wmv2_decode_picture_header(MpegEncContext *s)
     128             : {
     129         674 :     Wmv2Context *const w = (Wmv2Context *) s;
     130             :     int code;
     131             : 
     132         674 :     if (s->picture_number == 0)
     133           5 :         decode_ext_header(w);
     134             : 
     135         674 :     s->pict_type = get_bits1(&s->gb) + 1;
     136         674 :     if (s->pict_type == AV_PICTURE_TYPE_I) {
     137          29 :         code = get_bits(&s->gb, 7);
     138          29 :         av_log(s->avctx, AV_LOG_DEBUG, "I7:%X/\n", code);
     139             :     }
     140         674 :     s->chroma_qscale = s->qscale = get_bits(&s->gb, 5);
     141         674 :     if (s->qscale <= 0)
     142           0 :         return AVERROR_INVALIDDATA;
     143             : 
     144         674 :     return 0;
     145             : }
     146             : 
     147         674 : int ff_wmv2_decode_secondary_picture_header(MpegEncContext *s)
     148             : {
     149         674 :     Wmv2Context *const w = (Wmv2Context *) s;
     150             : 
     151         674 :     if (s->pict_type == AV_PICTURE_TYPE_I) {
     152          29 :         if (w->j_type_bit)
     153          29 :             w->j_type = get_bits1(&s->gb);
     154             :         else
     155           0 :             w->j_type = 0; // FIXME check
     156             : 
     157          29 :         if (!w->j_type) {
     158          26 :             if (w->per_mb_rl_bit)
     159          26 :                 s->per_mb_rl_table = get_bits1(&s->gb);
     160             :             else
     161           0 :                 s->per_mb_rl_table = 0;
     162             : 
     163          26 :             if (!s->per_mb_rl_table) {
     164          26 :                 s->rl_chroma_table_index = decode012(&s->gb);
     165          26 :                 s->rl_table_index        = decode012(&s->gb);
     166             :             }
     167             : 
     168          26 :             s->dc_table_index = get_bits1(&s->gb);
     169             :         }
     170          29 :         s->inter_intra_pred = 0;
     171          29 :         s->no_rounding      = 1;
     172          29 :         if (s->avctx->debug & FF_DEBUG_PICT_INFO) {
     173           0 :             av_log(s->avctx, AV_LOG_DEBUG,
     174             :                    "qscale:%d rlc:%d rl:%d dc:%d mbrl:%d j_type:%d \n",
     175             :                    s->qscale, s->rl_chroma_table_index, s->rl_table_index,
     176             :                    s->dc_table_index, s->per_mb_rl_table, w->j_type);
     177             :         }
     178             :     } else {
     179             :         int cbp_index;
     180             :         int ret;
     181         645 :         w->j_type = 0;
     182             : 
     183         645 :         ret = parse_mb_skip(w);
     184         645 :         if (ret < 0)
     185           0 :             return ret;
     186         645 :         cbp_index = decode012(&s->gb);
     187         645 :         w->cbp_table_index = wmv2_get_cbp_table_index(s, cbp_index);
     188             : 
     189         645 :         if (w->mspel_bit)
     190         645 :             s->mspel = get_bits1(&s->gb);
     191             :         else
     192           0 :             s->mspel = 0; // FIXME check
     193             : 
     194         645 :         if (w->abt_flag) {
     195         645 :             w->per_mb_abt = get_bits1(&s->gb) ^ 1;
     196         645 :             if (!w->per_mb_abt)
     197         187 :                 w->abt_type = decode012(&s->gb);
     198             :         }
     199             : 
     200         645 :         if (w->per_mb_rl_bit)
     201         645 :             s->per_mb_rl_table = get_bits1(&s->gb);
     202             :         else
     203           0 :             s->per_mb_rl_table = 0;
     204             : 
     205         645 :         if (!s->per_mb_rl_table) {
     206         617 :             s->rl_table_index        = decode012(&s->gb);
     207         617 :             s->rl_chroma_table_index = s->rl_table_index;
     208             :         }
     209             : 
     210         645 :         s->dc_table_index   = get_bits1(&s->gb);
     211         645 :         s->mv_table_index   = get_bits1(&s->gb);
     212             : 
     213         645 :         s->inter_intra_pred = 0; // (s->width * s->height < 320 * 240 && s->bit_rate <= II_BITRATE);
     214         645 :         s->no_rounding     ^= 1;
     215             : 
     216         645 :         if (s->avctx->debug & FF_DEBUG_PICT_INFO) {
     217           0 :             av_log(s->avctx, AV_LOG_DEBUG,
     218             :                    "rl:%d rlc:%d dc:%d mv:%d mbrl:%d qp:%d mspel:%d "
     219             :                    "per_mb_abt:%d abt_type:%d cbp:%d ii:%d\n",
     220             :                    s->rl_table_index, s->rl_chroma_table_index,
     221             :                    s->dc_table_index, s->mv_table_index,
     222             :                    s->per_mb_rl_table, s->qscale, s->mspel,
     223             :                    w->per_mb_abt, w->abt_type, w->cbp_table_index,
     224             :                    s->inter_intra_pred);
     225             :         }
     226             :     }
     227         674 :     s->esc3_level_length = 0;
     228         674 :     s->esc3_run_length   = 0;
     229         674 :     s->picture_number++; // FIXME ?
     230             : 
     231         674 :     if (w->j_type) {
     232           9 :         ff_intrax8_decode_picture(&w->x8, &s->current_picture,
     233             :                                   &s->gb, &s->mb_x, &s->mb_y,
     234           6 :                                   2 * s->qscale, (s->qscale - 1) | 1,
     235             :                                   s->loop_filter, s->low_delay);
     236             : 
     237           6 :         ff_er_add_slice(&w->s.er, 0, 0,
     238           6 :                         (w->s.mb_x >> 1) - 1, (w->s.mb_y >> 1) - 1,
     239             :                         ER_MB_END);
     240           3 :         return 1;
     241             :     }
     242             : 
     243         671 :     return 0;
     244             : }
     245             : 
     246      118424 : static inline int wmv2_decode_motion(Wmv2Context *w, int *mx_ptr, int *my_ptr)
     247             : {
     248      118424 :     MpegEncContext *const s = &w->s;
     249             :     int ret;
     250             : 
     251      118424 :     ret = ff_msmpeg4_decode_motion(s, mx_ptr, my_ptr);
     252             : 
     253      118424 :     if (ret < 0)
     254           0 :         return ret;
     255             : 
     256      118424 :     if ((((*mx_ptr) | (*my_ptr)) & 1) && s->mspel)
     257       19528 :         w->hshift = get_bits1(&s->gb);
     258             :     else
     259       98896 :         w->hshift = 0;
     260             : 
     261      118424 :     return 0;
     262             : }
     263             : 
     264      118424 : static int16_t *wmv2_pred_motion(Wmv2Context *w, int *px, int *py)
     265             : {
     266      118424 :     MpegEncContext *const s = &w->s;
     267             :     int xy, wrap, diff, type;
     268             :     int16_t *A, *B, *C, *mot_val;
     269             : 
     270      118424 :     wrap    = s->b8_stride;
     271      118424 :     xy      = s->block_index[0];
     272             : 
     273      118424 :     mot_val = s->current_picture.motion_val[0][xy];
     274             : 
     275      118424 :     A       = s->current_picture.motion_val[0][xy     - 1];
     276      118424 :     B       = s->current_picture.motion_val[0][xy     - wrap];
     277      118424 :     C       = s->current_picture.motion_val[0][xy + 2 - wrap];
     278             : 
     279      118424 :     if (s->mb_x && !s->first_slice_line && !s->mspel && w->top_left_mv_flag)
     280       22431 :         diff = FFMAX(FFABS(A[0] - B[0]), FFABS(A[1] - B[1]));
     281             :     else
     282       95993 :         diff = 0;
     283             : 
     284      118424 :     if (diff >= 8)
     285        3203 :         type = get_bits1(&s->gb);
     286             :     else
     287      115221 :         type = 2;
     288             : 
     289      118424 :     if (type == 0) {
     290        1698 :         *px = A[0];
     291        1698 :         *py = A[1];
     292      116726 :     } else if (type == 1) {
     293        1505 :         *px = B[0];
     294        1505 :         *py = B[1];
     295             :     } else {
     296             :         /* special case for first (slice) line */
     297      115221 :         if (s->first_slice_line) {
     298        4281 :             *px = A[0];
     299        4281 :             *py = A[1];
     300             :         } else {
     301      110940 :             *px = mid_pred(A[0], B[0], C[0]);
     302      110940 :             *py = mid_pred(A[1], B[1], C[1]);
     303             :         }
     304             :     }
     305             : 
     306      118424 :     return mot_val;
     307             : }
     308             : 
     309      710544 : static inline int wmv2_decode_inter_block(Wmv2Context *w, int16_t *block,
     310             :                                           int n, int cbp)
     311             : {
     312      710544 :     MpegEncContext *const s = &w->s;
     313             :     static const int sub_cbp_table[3] = { 2, 3, 1 };
     314             :     int sub_cbp, ret;
     315             : 
     316      710544 :     if (!cbp) {
     317      529955 :         s->block_last_index[n] = -1;
     318      529955 :         return 0;
     319             :     }
     320             : 
     321      180589 :     if (w->per_block_abt)
     322       20828 :         w->abt_type = decode012(&s->gb);
     323      180589 :     w->abt_type_table[n] = w->abt_type;
     324             : 
     325      180589 :     if (w->abt_type) {
     326             : //        const uint8_t *scantable = w->abt_scantable[w->abt_type - 1].permutated;
     327       31447 :         const uint8_t *scantable = w->abt_scantable[w->abt_type - 1].scantable;
     328             : //        const uint8_t *scantable = w->abt_type - 1 ? w->abt_scantable[1].permutated : w->abt_scantable[0].scantable;
     329             : 
     330       31447 :         sub_cbp = sub_cbp_table[decode012(&s->gb)];
     331             : 
     332       31447 :         if (sub_cbp & 1)
     333       18950 :             if ((ret = ff_msmpeg4_decode_block(s, block, n, 1, scantable)) < 0)
     334           0 :                 return ret;
     335             : 
     336       31447 :         if (sub_cbp & 2)
     337       19090 :             if ((ret = ff_msmpeg4_decode_block(s, w->abt_block2[n], n, 1, scantable)) < 0)
     338           0 :                 return ret;
     339             : 
     340       31447 :         s->block_last_index[n] = 63;
     341             : 
     342       31447 :         return 0;
     343             :     } else {
     344      149142 :         return ff_msmpeg4_decode_block(s, block, n, 1,
     345      149142 :                                        s->inter_scantable.permutated);
     346             :     }
     347             : }
     348             : 
     349      201150 : int ff_wmv2_decode_mb(MpegEncContext *s, int16_t block[6][64])
     350             : {
     351      201150 :     Wmv2Context *const w = (Wmv2Context *) s;
     352             :     int cbp, code, i, ret;
     353             :     uint8_t *coded_val;
     354             : 
     355      201150 :     if (w->j_type)
     356           0 :         return 0;
     357             : 
     358      201150 :     if (s->pict_type == AV_PICTURE_TYPE_P) {
     359      193365 :         if (IS_SKIP(s->current_picture.mb_type[s->mb_y * s->mb_stride + s->mb_x])) {
     360             :             /* skip mb */
     361       71725 :             s->mb_intra = 0;
     362      502075 :             for (i = 0; i < 6; i++)
     363      430350 :                 s->block_last_index[i] = -1;
     364       71725 :             s->mv_dir      = MV_DIR_FORWARD;
     365       71725 :             s->mv_type     = MV_TYPE_16X16;
     366       71725 :             s->mv[0][0][0] = 0;
     367       71725 :             s->mv[0][0][1] = 0;
     368       71725 :             s->mb_skipped  = 1;
     369       71725 :             w->hshift      = 0;
     370       71725 :             return 0;
     371             :         }
     372      121640 :         if (get_bits_left(&s->gb) <= 0)
     373           0 :             return AVERROR_INVALIDDATA;
     374             : 
     375      121640 :         code = get_vlc2(&s->gb, ff_mb_non_intra_vlc[w->cbp_table_index].table,
     376             :                         MB_NON_INTRA_VLC_BITS, 3);
     377      121640 :         if (code < 0)
     378           0 :             return AVERROR_INVALIDDATA;
     379      121640 :         s->mb_intra = (~code & 0x40) >> 6;
     380             : 
     381      121640 :         cbp = code & 0x3f;
     382             :     } else {
     383        7785 :         s->mb_intra = 1;
     384        7785 :         if (get_bits_left(&s->gb) <= 0)
     385           0 :             return AVERROR_INVALIDDATA;
     386        7785 :         code = get_vlc2(&s->gb, ff_msmp4_mb_i_vlc.table, MB_INTRA_VLC_BITS, 2);
     387        7785 :         if (code < 0) {
     388           0 :             av_log(s->avctx, AV_LOG_ERROR,
     389             :                    "II-cbp illegal at %d %d\n", s->mb_x, s->mb_y);
     390           0 :             return AVERROR_INVALIDDATA;
     391             :         }
     392             :         /* predict coded block pattern */
     393        7785 :         cbp = 0;
     394       54495 :         for (i = 0; i < 6; i++) {
     395       46710 :             int val = ((code >> (5 - i)) & 1);
     396       46710 :             if (i < 4) {
     397       31140 :                 int pred   = ff_msmpeg4_coded_block_pred(s, i, &coded_val);
     398       31140 :                 val        = val ^ pred;
     399       31140 :                 *coded_val = val;
     400             :             }
     401       46710 :             cbp |= val << (5 - i);
     402             :         }
     403             :     }
     404             : 
     405      129425 :     if (!s->mb_intra) {
     406             :         int mx, my;
     407      118424 :         wmv2_pred_motion(w, &mx, &my);
     408             : 
     409      118424 :         if (cbp) {
     410       76773 :             s->bdsp.clear_blocks(s->block[0]);
     411       76773 :             if (s->per_mb_rl_table) {
     412        1656 :                 s->rl_table_index        = decode012(&s->gb);
     413        1656 :                 s->rl_chroma_table_index = s->rl_table_index;
     414             :             }
     415             : 
     416       76773 :             if (w->abt_flag && w->per_mb_abt) {
     417       37493 :                 w->per_block_abt = get_bits1(&s->gb);
     418       74986 :                 if (!w->per_block_abt)
     419       30618 :                     w->abt_type = decode012(&s->gb);
     420             :             } else
     421       39280 :                 w->per_block_abt = 0;
     422             :         }
     423             : 
     424      118424 :         if ((ret = wmv2_decode_motion(w, &mx, &my)) < 0)
     425           0 :             return ret;
     426             : 
     427      118424 :         s->mv_dir      = MV_DIR_FORWARD;
     428      118424 :         s->mv_type     = MV_TYPE_16X16;
     429      118424 :         s->mv[0][0][0] = mx;
     430      118424 :         s->mv[0][0][1] = my;
     431             : 
     432      828968 :         for (i = 0; i < 6; i++) {
     433      710544 :             if ((ret = wmv2_decode_inter_block(w, block[i], i, (cbp >> (5 - i)) & 1)) < 0) {
     434           0 :                 av_log(s->avctx, AV_LOG_ERROR,
     435             :                        "\nerror while decoding inter block: %d x %d (%d)\n",
     436             :                        s->mb_x, s->mb_y, i);
     437           0 :                 return ret;
     438             :             }
     439             :         }
     440             :     } else {
     441       11001 :         if (s->pict_type == AV_PICTURE_TYPE_P)
     442             :             ff_dlog(s->avctx, "%d%d ", s->inter_intra_pred, cbp);
     443             :         ff_dlog(s->avctx, "I at %d %d %d %06X\n", s->mb_x, s->mb_y,
     444             :                 ((cbp & 3) ? 1 : 0) + ((cbp & 0x3C) ? 2 : 0),
     445             :                 show_bits(&s->gb, 24));
     446       11001 :         s->ac_pred = get_bits1(&s->gb);
     447       11001 :         if (s->inter_intra_pred) {
     448           0 :             s->h263_aic_dir = get_vlc2(&s->gb, ff_inter_intra_vlc.table,
     449             :                                        INTER_INTRA_VLC_BITS, 1);
     450             :             ff_dlog(s->avctx, "%d%d %d %d/",
     451             :                     s->ac_pred, s->h263_aic_dir, s->mb_x, s->mb_y);
     452             :         }
     453       11001 :         if (s->per_mb_rl_table && cbp) {
     454         128 :             s->rl_table_index        = decode012(&s->gb);
     455         128 :             s->rl_chroma_table_index = s->rl_table_index;
     456             :         }
     457             : 
     458       11001 :         s->bdsp.clear_blocks(s->block[0]);
     459       77007 :         for (i = 0; i < 6; i++) {
     460       66006 :             if ((ret = ff_msmpeg4_decode_block(s, block[i], i, (cbp >> (5 - i)) & 1, NULL)) < 0) {
     461           0 :                 av_log(s->avctx, AV_LOG_ERROR,
     462             :                        "\nerror while decoding intra block: %d x %d (%d)\n",
     463             :                        s->mb_x, s->mb_y, i);
     464           0 :                 return ret;
     465             :             }
     466             :         }
     467             :     }
     468             : 
     469      129425 :     return 0;
     470             : }
     471             : 
     472          12 : static av_cold int wmv2_decode_init(AVCodecContext *avctx)
     473             : {
     474          12 :     Wmv2Context *const w = avctx->priv_data;
     475             :     int ret;
     476             : 
     477          12 :     if ((ret = ff_msmpeg4_decode_init(avctx)) < 0)
     478           0 :         return ret;
     479             : 
     480          12 :     ff_wmv2_common_init(w);
     481             : 
     482          24 :     return ff_intrax8_common_init(avctx, &w->x8, &w->s.idsp,
     483          12 :                                   w->s.block, w->s.block_last_index,
     484             :                                   w->s.mb_width, w->s.mb_height);
     485             : }
     486             : 
     487          12 : static av_cold int wmv2_decode_end(AVCodecContext *avctx)
     488             : {
     489          12 :     Wmv2Context *w = avctx->priv_data;
     490             : 
     491          12 :     ff_intrax8_common_end(&w->x8);
     492          12 :     return ff_h263_decode_end(avctx);
     493             : }
     494             : 
     495             : AVCodec ff_wmv2_decoder = {
     496             :     .name           = "wmv2",
     497             :     .long_name      = NULL_IF_CONFIG_SMALL("Windows Media Video 8"),
     498             :     .type           = AVMEDIA_TYPE_VIDEO,
     499             :     .id             = AV_CODEC_ID_WMV2,
     500             :     .priv_data_size = sizeof(Wmv2Context),
     501             :     .init           = wmv2_decode_init,
     502             :     .close          = wmv2_decode_end,
     503             :     .decode         = ff_h263_decode_frame,
     504             :     .capabilities   = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1,
     505             :     .pix_fmts       = (const enum AVPixelFormat[]) { AV_PIX_FMT_YUV420P,
     506             :                                                      AV_PIX_FMT_NONE },
     507             : };

Generated by: LCOV version 1.13