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 | * |
Diego Biurrun | b78e719 | 2006-10-07 15:30:46 | [diff] [blame] | 5 | * This file is part of FFmpeg. |
| 6 | * |
| 7 | * FFmpeg 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 | * |
Diego Biurrun | b78e719 | 2006-10-07 15:30:46 | [diff] [blame] | 12 | * FFmpeg 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 |
Diego Biurrun | b78e719 | 2006-10-07 15:30:46 | [diff] [blame] | 18 | * License along with FFmpeg; 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; |
Paul B Mahol | 451b2ca | 2013-07-26 14:58:44 | [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, |
Kostya Shishkov | 422e14f | 2014-06-25 18:28:22 | [diff] [blame] | 52 | int pitch, 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; |
Diego Biurrun | 115329f | 2005-12-17 18:14:38 | [diff] [blame] | 57 | |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 58 | if (width & 1) |
Anton Khirnov | 6ea2c9a | 2012-11-17 07:06:19 | [diff] [blame] | 59 | return AVERROR_INVALIDDATA; |
Michael Niedermayer | f707a5e | 2005-04-20 09:52:04 | [diff] [blame] | 60 | |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 61 | /* first line contain absolute values, other lines contain deltas */ |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 62 | while (out < width) { |
Reimar Döffinger | c2c27e9 | 2014-10-18 13:28:03 | [diff] [blame^] | 63 | int c = ir2_get_code(&ctx->gb); |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 64 | if (c >= 0x80) { /* we have a run */ |
Michael Niedermayer | 8b39f75 | 2005-04-20 10:16:19 | [diff] [blame] | 65 | c -= 0x7F; |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 66 | if (out + c*2 > width) |
Anton Khirnov | 6ea2c9a | 2012-11-17 07:06:19 | [diff] [blame] | 67 | return AVERROR_INVALIDDATA; |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 68 | for (i = 0; i < c * 2; i++) |
| 69 | dst[out++] = 0x80; |
| 70 | } else { /* copy two values from table */ |
| 71 | dst[out++] = table[c * 2]; |
| 72 | dst[out++] = table[(c * 2) + 1]; |
| 73 | } |
| 74 | } |
Kostya Shishkov | 422e14f | 2014-06-25 18:28:22 | [diff] [blame] | 75 | dst += pitch; |
Diego Biurrun | 115329f | 2005-12-17 18:14:38 | [diff] [blame] | 76 | |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 77 | for (j = 1; j < height; j++) { |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 78 | out = 0; |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 79 | while (out < width) { |
Reimar Döffinger | c2c27e9 | 2014-10-18 13:28:03 | [diff] [blame^] | 80 | int c = ir2_get_code(&ctx->gb); |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 81 | if (c >= 0x80) { /* we have a skip */ |
Michael Niedermayer | 8b39f75 | 2005-04-20 10:16:19 | [diff] [blame] | 82 | c -= 0x7F; |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 83 | if (out + c*2 > width) |
Anton Khirnov | 6ea2c9a | 2012-11-17 07:06:19 | [diff] [blame] | 84 | return AVERROR_INVALIDDATA; |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 85 | for (i = 0; i < c * 2; i++) { |
Kostya Shishkov | 422e14f | 2014-06-25 18:28:22 | [diff] [blame] | 86 | dst[out] = dst[out - pitch]; |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 87 | out++; |
| 88 | } |
| 89 | } else { /* add two deltas from table */ |
Reimar Döffinger | c2c27e9 | 2014-10-18 13:28:03 | [diff] [blame^] | 90 | int t = dst[out - pitch] + (table[c * 2] - 128); |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 91 | t = av_clip_uint8(t); |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 92 | dst[out] = t; |
| 93 | out++; |
Kostya Shishkov | 422e14f | 2014-06-25 18:28:22 | [diff] [blame] | 94 | t = dst[out - pitch] + (table[(c * 2) + 1] - 128); |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 95 | t = av_clip_uint8(t); |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 96 | dst[out] = t; |
| 97 | out++; |
| 98 | } |
| 99 | } |
Kostya Shishkov | 422e14f | 2014-06-25 18:28:22 | [diff] [blame] | 100 | dst += pitch; |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 101 | } |
Michael Niedermayer | f707a5e | 2005-04-20 09:52:04 | [diff] [blame] | 102 | return 0; |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 103 | } |
| 104 | |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 105 | static int ir2_decode_plane_inter(Ir2Context *ctx, int width, int height, uint8_t *dst, |
Kostya Shishkov | 422e14f | 2014-06-25 18:28:22 | [diff] [blame] | 106 | int pitch, const uint8_t *table) |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 107 | { |
| 108 | int j; |
| 109 | int out = 0; |
| 110 | int c; |
| 111 | int t; |
Michael Niedermayer | f707a5e | 2005-04-20 09:52:04 | [diff] [blame] | 112 | |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 113 | if (width & 1) |
Anton Khirnov | 6ea2c9a | 2012-11-17 07:06:19 | [diff] [blame] | 114 | return AVERROR_INVALIDDATA; |
Michael Niedermayer | f707a5e | 2005-04-20 09:52:04 | [diff] [blame] | 115 | |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 116 | for (j = 0; j < height; j++) { |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 117 | out = 0; |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 118 | while (out < width) { |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 119 | c = ir2_get_code(&ctx->gb); |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 120 | if (c >= 0x80) { /* we have a skip */ |
| 121 | c -= 0x7F; |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 122 | out += c * 2; |
| 123 | } else { /* add two deltas from table */ |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 124 | t = dst[out] + (((table[c * 2] - 128)*3) >> 2); |
| 125 | t = av_clip_uint8(t); |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 126 | dst[out] = t; |
| 127 | out++; |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 128 | t = dst[out] + (((table[(c * 2) + 1] - 128)*3) >> 2); |
| 129 | t = av_clip_uint8(t); |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 130 | dst[out] = t; |
| 131 | out++; |
| 132 | } |
| 133 | } |
Kostya Shishkov | 422e14f | 2014-06-25 18:28:22 | [diff] [blame] | 134 | dst += pitch; |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 135 | } |
Michael Niedermayer | f707a5e | 2005-04-20 09:52:04 | [diff] [blame] | 136 | return 0; |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 137 | } |
| 138 | |
Diego Biurrun | 115329f | 2005-12-17 18:14:38 | [diff] [blame] | 139 | static int ir2_decode_frame(AVCodecContext *avctx, |
Anton Khirnov | df9b956 | 2012-11-13 18:35:22 | [diff] [blame] | 140 | void *data, int *got_frame, |
Thilo Borgmann | 7a00bba | 2009-04-07 15:59:50 | [diff] [blame] | 141 | AVPacket *avpkt) |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 142 | { |
| 143 | Ir2Context * const s = avctx->priv_data; |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 144 | const uint8_t *buf = avpkt->data; |
| 145 | int buf_size = avpkt->size; |
| 146 | AVFrame *picture = data; |
Paul B Mahol | 451b2ca | 2013-07-26 14:58:44 | [diff] [blame] | 147 | AVFrame * const p = s->picture; |
Anton Khirnov | 6ea2c9a | 2012-11-17 07:06:19 | [diff] [blame] | 148 | int start, ret; |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 149 | |
Clément Bœsch | 1ec94b0 | 2013-03-12 07:41:53 | [diff] [blame] | 150 | if ((ret = ff_reget_buffer(avctx, p)) < 0) |
Anton Khirnov | 6ea2c9a | 2012-11-17 07:06:19 | [diff] [blame] | 151 | return ret; |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 152 | |
Alex Converse | b7ce4f1 | 2011-09-09 20:26:49 | [diff] [blame] | 153 | start = 48; /* hardcoded for now */ |
| 154 | |
| 155 | if (start >= buf_size) { |
| 156 | av_log(s->avctx, AV_LOG_ERROR, "input buffer size too small (%d)\n", buf_size); |
| 157 | return AVERROR_INVALIDDATA; |
| 158 | } |
| 159 | |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 160 | s->decode_delta = buf[18]; |
Diego Biurrun | 115329f | 2005-12-17 18:14:38 | [diff] [blame] | 161 | |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 162 | /* decide whether frame uses deltas or not */ |
Diego Biurrun | aaf47bc | 2011-12-22 15:33:31 | [diff] [blame] | 163 | #ifndef BITSTREAM_READER_LE |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 164 | for (i = 0; i < buf_size; i++) |
Diego Biurrun | d5c6212 | 2012-10-11 16:50:30 | [diff] [blame] | 165 | buf[i] = ff_reverse[buf[i]]; |
Michael Niedermayer | ef56de3 | 2005-05-11 01:50:46 | [diff] [blame] | 166 | #endif |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 167 | |
Alex Converse | 68ca330 | 2011-09-09 20:24:19 | [diff] [blame] | 168 | init_get_bits(&s->gb, buf + start, (buf_size - start) * 8); |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 169 | |
| 170 | if (s->decode_delta) { /* intraframe */ |
Anton Khirnov | 7b1fbd4 | 2012-11-17 07:08:40 | [diff] [blame] | 171 | if ((ret = ir2_decode_plane(s, avctx->width, avctx->height, |
Anton Khirnov | 79d501a | 2013-11-09 09:14:46 | [diff] [blame] | 172 | p->data[0], p->linesize[0], |
Anton Khirnov | 7b1fbd4 | 2012-11-17 07:08:40 | [diff] [blame] | 173 | ir2_luma_table)) < 0) |
| 174 | return ret; |
| 175 | |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 176 | /* swapped U and V */ |
Anton Khirnov | 7b1fbd4 | 2012-11-17 07:08:40 | [diff] [blame] | 177 | if ((ret = ir2_decode_plane(s, avctx->width >> 2, avctx->height >> 2, |
Anton Khirnov | 79d501a | 2013-11-09 09:14:46 | [diff] [blame] | 178 | p->data[2], p->linesize[2], |
Anton Khirnov | 7b1fbd4 | 2012-11-17 07:08:40 | [diff] [blame] | 179 | ir2_luma_table)) < 0) |
| 180 | return ret; |
| 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[1], p->linesize[1], |
Anton Khirnov | 7b1fbd4 | 2012-11-17 07:08:40 | [diff] [blame] | 183 | ir2_luma_table)) < 0) |
| 184 | return ret; |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 185 | } else { /* interframe */ |
Anton Khirnov | 7b1fbd4 | 2012-11-17 07:08:40 | [diff] [blame] | 186 | if ((ret = ir2_decode_plane_inter(s, avctx->width, avctx->height, |
Anton Khirnov | 79d501a | 2013-11-09 09:14:46 | [diff] [blame] | 187 | p->data[0], p->linesize[0], |
Anton Khirnov | 7b1fbd4 | 2012-11-17 07:08:40 | [diff] [blame] | 188 | ir2_luma_table)) < 0) |
| 189 | return ret; |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 190 | /* swapped U and V */ |
Anton Khirnov | 7b1fbd4 | 2012-11-17 07:08:40 | [diff] [blame] | 191 | if ((ret = ir2_decode_plane_inter(s, avctx->width >> 2, avctx->height >> 2, |
Anton Khirnov | 79d501a | 2013-11-09 09:14:46 | [diff] [blame] | 192 | p->data[2], p->linesize[2], |
Anton Khirnov | 7b1fbd4 | 2012-11-17 07:08:40 | [diff] [blame] | 193 | ir2_luma_table)) < 0) |
| 194 | return ret; |
| 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[1], p->linesize[1], |
Anton Khirnov | 7b1fbd4 | 2012-11-17 07:08:40 | [diff] [blame] | 197 | ir2_luma_table)) < 0) |
| 198 | return ret; |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 199 | } |
| 200 | |
Anton Khirnov | 79d501a | 2013-11-09 09:14:46 | [diff] [blame] | 201 | if ((ret = av_frame_ref(picture, p)) < 0) |
Anton Khirnov | 759001c | 2012-11-21 20:34:46 | [diff] [blame] | 202 | return ret; |
| 203 | |
Anton Khirnov | df9b956 | 2012-11-13 18:35:22 | [diff] [blame] | 204 | *got_frame = 1; |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 205 | |
| 206 | return buf_size; |
| 207 | } |
| 208 | |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 209 | static av_cold int ir2_decode_init(AVCodecContext *avctx) |
| 210 | { |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 211 | Ir2Context * const ic = avctx->priv_data; |
Kostya Shishkov | bd4110f | 2009-04-17 14:09:56 | [diff] [blame] | 212 | static VLC_TYPE vlc_tables[1 << CODE_VLC_BITS][2]; |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 213 | |
| 214 | ic->avctx = avctx; |
| 215 | |
Anton Khirnov | 716d413 | 2012-10-06 10:10:34 | [diff] [blame] | 216 | avctx->pix_fmt= AV_PIX_FMT_YUV410P; |
Diego Biurrun | 115329f | 2005-12-17 18:14:38 | [diff] [blame] | 217 | |
Paul B Mahol | 451b2ca | 2013-07-26 14:58:44 | [diff] [blame] | 218 | ic->picture = av_frame_alloc(); |
| 219 | if (!ic->picture) |
| 220 | return AVERROR(ENOMEM); |
Anton Khirnov | 3b199d2 | 2013-02-13 07:50:04 | [diff] [blame] | 221 | |
Kostya Shishkov | bd4110f | 2009-04-17 14:09:56 | [diff] [blame] | 222 | ir2_vlc.table = vlc_tables; |
| 223 | ir2_vlc.table_allocated = 1 << CODE_VLC_BITS; |
Diego Biurrun | aaf47bc | 2011-12-22 15:33:31 | [diff] [blame] | 224 | #ifdef BITSTREAM_READER_LE |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 225 | init_vlc(&ir2_vlc, CODE_VLC_BITS, IR2_CODES, |
| 226 | &ir2_codes[0][1], 4, 2, |
Kostya Shishkov | bd4110f | 2009-04-17 14:09:56 | [diff] [blame] | 227 | &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] | 228 | #else |
Christian Lohmaier | c11aac6 | 2007-06-04 11:03:24 | [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); |
Michael Niedermayer | ef56de3 | 2005-05-11 01:50:46 | [diff] [blame] | 232 | #endif |
Diego Biurrun | 115329f | 2005-12-17 18:14:38 | [diff] [blame] | 233 | |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 234 | return 0; |
| 235 | } |
| 236 | |
Anton Khirnov | c04c64c | 2012-11-17 07:11:30 | [diff] [blame] | 237 | static av_cold int ir2_decode_end(AVCodecContext *avctx) |
| 238 | { |
Kostya Shishkov | 6d924b5 | 2009-10-14 05:28:24 | [diff] [blame] | 239 | Ir2Context * const ic = avctx->priv_data; |
Kostya Shishkov | 6d924b5 | 2009-10-14 05:28:24 | [diff] [blame] | 240 | |
Paul B Mahol | 451b2ca | 2013-07-26 14:58:44 | [diff] [blame] | 241 | av_frame_free(&ic->picture); |
Kostya Shishkov | 6d924b5 | 2009-10-14 05:28:24 | [diff] [blame] | 242 | |
| 243 | return 0; |
| 244 | } |
| 245 | |
Diego Elio Pettenò | e7e2df2 | 2011-01-25 21:40:11 | [diff] [blame] | 246 | AVCodec ff_indeo2_decoder = { |
Anton Khirnov | ec6402b | 2011-07-17 10:54:31 | [diff] [blame] | 247 | .name = "indeo2", |
Diego Biurrun | b2bed93 | 2013-10-03 20:57:53 | [diff] [blame] | 248 | .long_name = NULL_IF_CONFIG_SMALL("Intel Indeo 2"), |
Anton Khirnov | ec6402b | 2011-07-17 10:54:31 | [diff] [blame] | 249 | .type = AVMEDIA_TYPE_VIDEO, |
Anton Khirnov | 36ef536 | 2012-08-05 09:11:04 | [diff] [blame] | 250 | .id = AV_CODEC_ID_INDEO2, |
Anton Khirnov | ec6402b | 2011-07-17 10:54:31 | [diff] [blame] | 251 | .priv_data_size = sizeof(Ir2Context), |
| 252 | .init = ir2_decode_init, |
| 253 | .close = ir2_decode_end, |
| 254 | .decode = ir2_decode_frame, |
| 255 | .capabilities = CODEC_CAP_DR1, |
Michael Niedermayer | 856dbbf | 2005-04-20 09:42:47 | [diff] [blame] | 256 | }; |