Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 1 | /* |
Diego Biurrun | 02c1592 | 2006-09-15 13:53:26 | [diff] [blame] | 2 | * Intel Indeo 2 codec |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 3 | * Copyright (c) 2005 Konstantin Shishkov |
| 4 | * |
Mans Rullgard | 2912e87 | 2011-03-18 17:35:10 | [diff] [blame] | 5 | * This file is part of Libav. |
Diego Biurrun | b78e719 | 2006-10-07 15:30:46 | [diff] [blame] | 6 | * |
Mans Rullgard | 2912e87 | 2011-03-18 17:35:10 | [diff] [blame] | 7 | * Libav is free software; you can redistribute it and/or |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 8 | * modify it under the terms of the GNU Lesser General Public |
| 9 | * License as published by the Free Software Foundation; either |
Diego Biurrun | b78e719 | 2006-10-07 15:30:46 | [diff] [blame] | 10 | * version 2.1 of the License, or (at your option) any later version. |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 11 | * |
Mans Rullgard | 2912e87 | 2011-03-18 17:35:10 | [diff] [blame] | 12 | * Libav is distributed in the hope that it will be useful, |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * Lesser General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU Lesser General Public |
Mans Rullgard | 2912e87 | 2011-03-18 17:35:10 | [diff] [blame] | 18 | * License along with Libav; if not, write to the Free Software |
Diego Biurrun | 5509bff | 2006-01-12 22:43:26 | [diff] [blame] | 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 20 | */ |
Diego Biurrun | 115329f | 2005-12-17 18:14:38 | [diff] [blame] | 21 | |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 22 | /** |
Diego Biurrun | ba87f08 | 2010-04-20 14:45:34 | [diff] [blame] | 23 | * @file |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 24 | * Intel Indeo 2 decoder. |
| 25 | */ |
Diego Biurrun | d5c6212 | 2012-10-11 16:50:30 | [diff] [blame] | 26 | |
Diego Biurrun | aaf47bc | 2011-12-22 15:33:31 | [diff] [blame] | 27 | #define BITSTREAM_READER_LE |
Diego Biurrun | d5c6212 | 2012-10-11 16:50:30 | [diff] [blame] | 28 | #include "libavutil/attributes.h" |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 29 | #include "avcodec.h" |
Stefano Sabatini | 9106a69 | 2009-04-13 16:20:26 | [diff] [blame] | 30 | #include "get_bits.h" |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 31 | #include "indeo2data.h" |
Anton Khirnov | 759001c | 2012-11-21 20:34:46 | [diff] [blame] | 32 | #include "internal.h" |
Diego Biurrun | d5c6212 | 2012-10-11 16:50:30 | [diff] [blame] | 33 | #include "mathops.h" |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 34 | |
| 35 | typedef struct Ir2Context{ |
| 36 | AVCodecContext *avctx; |
Anton Khirnov | 79d501a | 2013-11-09 09:14:46 | [diff] [blame^] | 37 | AVFrame *picture; |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 38 | GetBitContext gb; |
| 39 | int decode_delta; |
| 40 | } Ir2Context; |
| 41 | |
| 42 | #define CODE_VLC_BITS 14 |
| 43 | static VLC ir2_vlc; |
| 44 | |
| 45 | /* Indeo 2 codes are in range 0x01..0x7F and 0x81..0x90 */ |
| 46 | static inline int ir2_get_code(GetBitContext *gb) |
| 47 | { |
Michael Niedermayer | 8b39f75 | 2005-04-20 10:16:19 | [diff] [blame] | 48 | return get_vlc2(gb, ir2_vlc.table, CODE_VLC_BITS, 1) + 1; |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 49 | } |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 50 | |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 51 | static int ir2_decode_plane(Ir2Context *ctx, int width, int height, uint8_t *dst, |
| 52 | int stride, const uint8_t *table) |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 53 | { |
| 54 | int i; |
| 55 | int j; |
| 56 | int out = 0; |
| 57 | int c; |
| 58 | int t; |
Diego Biurrun | 115329f | 2005-12-17 18:14:38 | [diff] [blame] | 59 | |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 60 | if (width & 1) |
Anton Khirnov | 6ea2c9a | 2012-11-17 07:06:19 | [diff] [blame] | 61 | return AVERROR_INVALIDDATA; |
Michael Niedermayer | f707a5e | 2005-04-20 09:52:04 | [diff] [blame] | 62 | |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 63 | /* first line contain absolute values, other lines contain deltas */ |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 64 | while (out < width) { |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 65 | c = ir2_get_code(&ctx->gb); |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 66 | if (c >= 0x80) { /* we have a run */ |
Michael Niedermayer | 8b39f75 | 2005-04-20 10:16:19 | [diff] [blame] | 67 | c -= 0x7F; |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 68 | if (out + c*2 > width) |
Anton Khirnov | 6ea2c9a | 2012-11-17 07:06:19 | [diff] [blame] | 69 | return AVERROR_INVALIDDATA; |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 70 | for (i = 0; i < c * 2; i++) |
| 71 | dst[out++] = 0x80; |
| 72 | } else { /* copy two values from table */ |
| 73 | dst[out++] = table[c * 2]; |
| 74 | dst[out++] = table[(c * 2) + 1]; |
| 75 | } |
| 76 | } |
| 77 | dst += stride; |
Diego Biurrun | 115329f | 2005-12-17 18:14:38 | [diff] [blame] | 78 | |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 79 | for (j = 1; j < height; j++) { |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 80 | out = 0; |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 81 | while (out < width) { |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 82 | c = ir2_get_code(&ctx->gb); |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 83 | if (c >= 0x80) { /* we have a skip */ |
Michael Niedermayer | 8b39f75 | 2005-04-20 10:16:19 | [diff] [blame] | 84 | c -= 0x7F; |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 85 | if (out + c*2 > width) |
Anton Khirnov | 6ea2c9a | 2012-11-17 07:06:19 | [diff] [blame] | 86 | return AVERROR_INVALIDDATA; |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 87 | for (i = 0; i < c * 2; i++) { |
| 88 | dst[out] = dst[out - stride]; |
| 89 | out++; |
| 90 | } |
| 91 | } else { /* add two deltas from table */ |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 92 | t = dst[out - stride] + (table[c * 2] - 128); |
| 93 | t = av_clip_uint8(t); |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 94 | dst[out] = t; |
| 95 | out++; |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 96 | t = dst[out - stride] + (table[(c * 2) + 1] - 128); |
| 97 | t = av_clip_uint8(t); |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 98 | dst[out] = t; |
| 99 | out++; |
| 100 | } |
| 101 | } |
| 102 | dst += stride; |
| 103 | } |
Michael Niedermayer | f707a5e | 2005-04-20 09:52:04 | [diff] [blame] | 104 | return 0; |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 105 | } |
| 106 | |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 107 | static int ir2_decode_plane_inter(Ir2Context *ctx, int width, int height, uint8_t *dst, |
| 108 | int stride, const uint8_t *table) |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 109 | { |
| 110 | int j; |
| 111 | int out = 0; |
| 112 | int c; |
| 113 | int t; |
Michael Niedermayer | f707a5e | 2005-04-20 09:52:04 | [diff] [blame] | 114 | |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 115 | if (width & 1) |
Anton Khirnov | 6ea2c9a | 2012-11-17 07:06:19 | [diff] [blame] | 116 | return AVERROR_INVALIDDATA; |
Michael Niedermayer | f707a5e | 2005-04-20 09:52:04 | [diff] [blame] | 117 | |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 118 | for (j = 0; j < height; j++) { |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 119 | out = 0; |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 120 | while (out < width) { |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 121 | c = ir2_get_code(&ctx->gb); |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 122 | if (c >= 0x80) { /* we have a skip */ |
| 123 | c -= 0x7F; |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 124 | out += c * 2; |
| 125 | } else { /* add two deltas from table */ |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 126 | t = dst[out] + (((table[c * 2] - 128)*3) >> 2); |
| 127 | t = av_clip_uint8(t); |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 128 | dst[out] = t; |
| 129 | out++; |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 130 | t = dst[out] + (((table[(c * 2) + 1] - 128)*3) >> 2); |
| 131 | t = av_clip_uint8(t); |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 132 | dst[out] = t; |
| 133 | out++; |
| 134 | } |
| 135 | } |
| 136 | dst += stride; |
| 137 | } |
Michael Niedermayer | f707a5e | 2005-04-20 09:52:04 | [diff] [blame] | 138 | return 0; |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 139 | } |
| 140 | |
Diego Biurrun | 115329f | 2005-12-17 18:14:38 | [diff] [blame] | 141 | static int ir2_decode_frame(AVCodecContext *avctx, |
Anton Khirnov | df9b956 | 2012-11-13 18:35:22 | [diff] [blame] | 142 | void *data, int *got_frame, |
Thilo Borgmann | 7a00bba | 2009-04-07 15:59:50 | [diff] [blame] | 143 | AVPacket *avpkt) |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 144 | { |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 145 | Ir2Context * const s = avctx->priv_data; |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 146 | const uint8_t *buf = avpkt->data; |
| 147 | int buf_size = avpkt->size; |
| 148 | AVFrame *picture = data; |
Anton Khirnov | 79d501a | 2013-11-09 09:14:46 | [diff] [blame^] | 149 | AVFrame * const p = s->picture; |
Anton Khirnov | 6ea2c9a | 2012-11-17 07:06:19 | [diff] [blame] | 150 | int start, ret; |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 151 | |
Anton Khirnov | 759001c | 2012-11-21 20:34:46 | [diff] [blame] | 152 | if ((ret = ff_reget_buffer(avctx, p)) < 0) { |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 153 | av_log(s->avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); |
Anton Khirnov | 6ea2c9a | 2012-11-17 07:06:19 | [diff] [blame] | 154 | return ret; |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 155 | } |
| 156 | |
Alex Converse | b7ce4f1 | 2011-09-09 20:26:49 | [diff] [blame] | 157 | start = 48; /* hardcoded for now */ |
| 158 | |
| 159 | if (start >= buf_size) { |
| 160 | av_log(s->avctx, AV_LOG_ERROR, "input buffer size too small (%d)\n", buf_size); |
| 161 | return AVERROR_INVALIDDATA; |
| 162 | } |
| 163 | |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 164 | s->decode_delta = buf[18]; |
Diego Biurrun | 115329f | 2005-12-17 18:14:38 | [diff] [blame] | 165 | |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 166 | /* decide whether frame uses deltas or not */ |
Diego Biurrun | aaf47bc | 2011-12-22 15:33:31 | [diff] [blame] | 167 | #ifndef BITSTREAM_READER_LE |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 168 | for (i = 0; i < buf_size; i++) |
Diego Biurrun | d5c6212 | 2012-10-11 16:50:30 | [diff] [blame] | 169 | buf[i] = ff_reverse[buf[i]]; |
Michael Niedermayer | ef56de3 | 2005-05-11 01:50:46 | [diff] [blame] | 170 | #endif |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 171 | |
Alex Converse | 68ca330 | 2011-09-09 20:24:19 | [diff] [blame] | 172 | init_get_bits(&s->gb, buf + start, (buf_size - start) * 8); |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 173 | |
| 174 | if (s->decode_delta) { /* intraframe */ |
Anton Khirnov | 7b1fbd4 | 2012-11-17 07:08:40 | [diff] [blame] | 175 | if ((ret = ir2_decode_plane(s, avctx->width, avctx->height, |
Anton Khirnov | 79d501a | 2013-11-09 09:14:46 | [diff] [blame^] | 176 | p->data[0], p->linesize[0], |
Anton Khirnov | 7b1fbd4 | 2012-11-17 07:08:40 | [diff] [blame] | 177 | ir2_luma_table)) < 0) |
| 178 | return ret; |
| 179 | |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 180 | /* swapped U and V */ |
Anton Khirnov | 7b1fbd4 | 2012-11-17 07:08:40 | [diff] [blame] | 181 | if ((ret = ir2_decode_plane(s, avctx->width >> 2, avctx->height >> 2, |
Anton Khirnov | 79d501a | 2013-11-09 09:14:46 | [diff] [blame^] | 182 | p->data[2], p->linesize[2], |
Anton Khirnov | 7b1fbd4 | 2012-11-17 07:08:40 | [diff] [blame] | 183 | ir2_luma_table)) < 0) |
| 184 | return ret; |
| 185 | if ((ret = ir2_decode_plane(s, avctx->width >> 2, avctx->height >> 2, |
Anton Khirnov | 79d501a | 2013-11-09 09:14:46 | [diff] [blame^] | 186 | p->data[1], p->linesize[1], |
Anton Khirnov | 7b1fbd4 | 2012-11-17 07:08:40 | [diff] [blame] | 187 | ir2_luma_table)) < 0) |
| 188 | return ret; |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 189 | } else { /* interframe */ |
Anton Khirnov | 7b1fbd4 | 2012-11-17 07:08:40 | [diff] [blame] | 190 | if ((ret = ir2_decode_plane_inter(s, avctx->width, avctx->height, |
Anton Khirnov | 79d501a | 2013-11-09 09:14:46 | [diff] [blame^] | 191 | p->data[0], p->linesize[0], |
Anton Khirnov | 7b1fbd4 | 2012-11-17 07:08:40 | [diff] [blame] | 192 | ir2_luma_table)) < 0) |
| 193 | return ret; |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 194 | /* swapped U and V */ |
Anton Khirnov | 7b1fbd4 | 2012-11-17 07:08:40 | [diff] [blame] | 195 | if ((ret = ir2_decode_plane_inter(s, avctx->width >> 2, avctx->height >> 2, |
Anton Khirnov | 79d501a | 2013-11-09 09:14:46 | [diff] [blame^] | 196 | p->data[2], p->linesize[2], |
Anton Khirnov | 7b1fbd4 | 2012-11-17 07:08:40 | [diff] [blame] | 197 | ir2_luma_table)) < 0) |
| 198 | return ret; |
| 199 | if ((ret = ir2_decode_plane_inter(s, avctx->width >> 2, avctx->height >> 2, |
Anton Khirnov | 79d501a | 2013-11-09 09:14:46 | [diff] [blame^] | 200 | p->data[1], p->linesize[1], |
Anton Khirnov | 7b1fbd4 | 2012-11-17 07:08:40 | [diff] [blame] | 201 | ir2_luma_table)) < 0) |
| 202 | return ret; |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 203 | } |
| 204 | |
Anton Khirnov | 79d501a | 2013-11-09 09:14:46 | [diff] [blame^] | 205 | if ((ret = av_frame_ref(picture, p)) < 0) |
Anton Khirnov | 759001c | 2012-11-21 20:34:46 | [diff] [blame] | 206 | return ret; |
| 207 | |
Anton Khirnov | df9b956 | 2012-11-13 18:35:22 | [diff] [blame] | 208 | *got_frame = 1; |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 209 | |
| 210 | return buf_size; |
| 211 | } |
| 212 | |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 213 | static av_cold int ir2_decode_init(AVCodecContext *avctx) |
| 214 | { |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 215 | Ir2Context * const ic = avctx->priv_data; |
Kostya Shishkov | bd4110f | 2009-04-17 14:09:56 | [diff] [blame] | 216 | static VLC_TYPE vlc_tables[1 << CODE_VLC_BITS][2]; |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 217 | |
| 218 | ic->avctx = avctx; |
| 219 | |
Anton Khirnov | 716d413 | 2012-10-06 10:10:34 | [diff] [blame] | 220 | avctx->pix_fmt= AV_PIX_FMT_YUV410P; |
Diego Biurrun | 115329f | 2005-12-17 18:14:38 | [diff] [blame] | 221 | |
Anton Khirnov | 79d501a | 2013-11-09 09:14:46 | [diff] [blame^] | 222 | ic->picture = av_frame_alloc(); |
| 223 | if (!ic->picture) |
| 224 | return AVERROR(ENOMEM); |
Anton Khirnov | 3b199d2 | 2013-02-13 07:50:04 | [diff] [blame] | 225 | |
Kostya Shishkov | bd4110f | 2009-04-17 14:09:56 | [diff] [blame] | 226 | ir2_vlc.table = vlc_tables; |
| 227 | ir2_vlc.table_allocated = 1 << CODE_VLC_BITS; |
Diego Biurrun | aaf47bc | 2011-12-22 15:33:31 | [diff] [blame] | 228 | #ifdef BITSTREAM_READER_LE |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 229 | init_vlc(&ir2_vlc, CODE_VLC_BITS, IR2_CODES, |
| 230 | &ir2_codes[0][1], 4, 2, |
Kostya Shishkov | bd4110f | 2009-04-17 14:09:56 | [diff] [blame] | 231 | &ir2_codes[0][0], 4, 2, INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE); |
Michael Niedermayer | ef56de3 | 2005-05-11 01:50:46 | [diff] [blame] | 232 | #else |
Christian Lohmaier | c11aac6 | 2007-06-04 11:03:24 | [diff] [blame] | 233 | init_vlc(&ir2_vlc, CODE_VLC_BITS, IR2_CODES, |
| 234 | &ir2_codes[0][1], 4, 2, |
Kostya Shishkov | bd4110f | 2009-04-17 14:09:56 | [diff] [blame] | 235 | &ir2_codes[0][0], 4, 2, INIT_VLC_USE_NEW_STATIC); |
Michael Niedermayer | ef56de3 | 2005-05-11 01:50:46 | [diff] [blame] | 236 | #endif |
Diego Biurrun | 115329f | 2005-12-17 18:14:38 | [diff] [blame] | 237 | |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 238 | return 0; |
| 239 | } |
| 240 | |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 241 | static av_cold int ir2_decode_end(AVCodecContext *avctx) |
| 242 | { |
Kostya Shishkov | 6d924b5 | 2009-10-14 05:28:24 | [diff] [blame] | 243 | Ir2Context * const ic = avctx->priv_data; |
Kostya Shishkov | 6d924b5 | 2009-10-14 05:28:24 | [diff] [blame] | 244 | |
Anton Khirnov | 79d501a | 2013-11-09 09:14:46 | [diff] [blame^] | 245 | av_frame_free(&ic->picture); |
Kostya Shishkov | 6d924b5 | 2009-10-14 05:28:24 | [diff] [blame] | 246 | |
| 247 | return 0; |
| 248 | } |
| 249 | |
Diego Elio Pettenò | d36beb3 | 2011-01-25 21:40:11 | [diff] [blame] | 250 | AVCodec ff_indeo2_decoder = { |
Anton Khirnov | ec6402b | 2011-07-17 10:54:31 | [diff] [blame] | 251 | .name = "indeo2", |
Diego Biurrun | b2bed93 | 2013-10-03 20:57:53 | [diff] [blame] | 252 | .long_name = NULL_IF_CONFIG_SMALL("Intel Indeo 2"), |
Anton Khirnov | ec6402b | 2011-07-17 10:54:31 | [diff] [blame] | 253 | .type = AVMEDIA_TYPE_VIDEO, |
Anton Khirnov | 36ef536 | 2012-08-05 09:11:04 | [diff] [blame] | 254 | .id = AV_CODEC_ID_INDEO2, |
Anton Khirnov | ec6402b | 2011-07-17 10:54:31 | [diff] [blame] | 255 | .priv_data_size = sizeof(Ir2Context), |
| 256 | .init = ir2_decode_init, |
| 257 | .close = ir2_decode_end, |
| 258 | .decode = ir2_decode_frame, |
| 259 | .capabilities = CODEC_CAP_DR1, |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 260 | }; |