Mercurial > libavcodec.hg
annotate wnv1.c @ 2577:7d9997a69158 libavcodec
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
author | melanson |
---|---|
date | Sat, 26 Mar 2005 20:32:55 +0000 |
parents | |
children | e027765cf410 |
rev | line source |
---|---|
2577
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
1 /* |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
2 * Winnov WNV1 codec |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
3 * Copyright (c) 2005 Konstantin Shishkov |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
4 * |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
5 * This library is free software; you can redistribute it and/or |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
6 * modify it under the terms of the GNU Lesser General Public |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
7 * License as published by the Free Software Foundation; either |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
8 * version 2 of the License, or (at your option) any later version. |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
9 * |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
10 * This library is distributed in the hope that it will be useful, |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
13 * Lesser General Public License for more details. |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
14 * |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
15 * You should have received a copy of the GNU Lesser General Public |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
16 * License along with this library; if not, write to the Free Software |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
18 * |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
19 */ |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
20 |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
21 /** |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
22 * @file wnv1.c |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
23 * Winnov WNV1 codec. |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
24 */ |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
25 |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
26 #include "avcodec.h" |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
27 #include "common.h" |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
28 |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
29 |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
30 typedef struct WNV1Context{ |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
31 AVCodecContext *avctx; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
32 AVFrame pic; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
33 |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
34 int shift; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
35 /* bit buffer */ |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
36 unsigned long bitbuf; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
37 int bits; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
38 uint8_t *buf; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
39 } WNV1Context; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
40 |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
41 /* returns modified base_value */ |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
42 static inline int wnv1_get_code(WNV1Context *w, int base_value) |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
43 { |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
44 int v = 0; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
45 |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
46 if (w->bits < 16) { /* need to fill bit buffer */ |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
47 w->bitbuf |= LE_16(w->buf) << w->bits; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
48 w->buf += 2; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
49 w->bits += 16; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
50 } |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
51 |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
52 /* escape code */ |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
53 if ((w->bitbuf & 0xFF) == 0xFF) { |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
54 w->bitbuf >>= 8; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
55 w->bits -= 8; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
56 if (w->bits < 16) { /* need to fill bit buffer */ |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
57 w->bitbuf |= LE_16(w->buf) << w->bits; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
58 w->buf += 2; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
59 w->bits += 16; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
60 } |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
61 v = w->bitbuf & (0xFF >> w->shift); |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
62 w->bitbuf >>= 8 - w->shift; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
63 w->bits -= 8 - w->shift; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
64 return v << w->shift; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
65 } |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
66 |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
67 /* zero code */ |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
68 if (!(w->bitbuf & 1)) { |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
69 w->bitbuf >>= 1; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
70 w->bits--; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
71 return base_value; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
72 } |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
73 |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
74 /* reversed unary code and sign */ |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
75 while (w->bits && w->bitbuf & 1) { |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
76 w->bitbuf >>= 1; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
77 w->bits--; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
78 v++; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
79 } |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
80 w->bitbuf >>= 1; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
81 w->bits--; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
82 if(w->bitbuf & 1) |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
83 v = -v; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
84 w->bitbuf >>= 1; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
85 w->bits--; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
86 v <<= w->shift; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
87 return base_value + v; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
88 } |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
89 |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
90 static int decode_frame(AVCodecContext *avctx, |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
91 void *data, int *data_size, |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
92 uint8_t *buf, int buf_size) |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
93 { |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
94 WNV1Context * const l = avctx->priv_data; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
95 AVFrame * const p= (AVFrame*)&l->pic; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
96 unsigned char *Y,*U,*V; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
97 int i, j; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
98 int prev_y = 0, prev_u = 0, prev_v = 0; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
99 |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
100 if(p->data[0]) |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
101 avctx->release_buffer(avctx, p); |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
102 |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
103 p->reference = 0; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
104 if(avctx->get_buffer(avctx, p) < 0){ |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
105 av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
106 return -1; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
107 } |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
108 p->key_frame = 1; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
109 |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
110 l->bitbuf = 0; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
111 l->bits = 0; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
112 l->buf = buf + 8; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
113 |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
114 if (buf[2] >> 4 == 6) |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
115 l->shift = 2; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
116 else { |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
117 l->shift = 8 - (buf[2] >> 4); |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
118 if (l->shift > 4) { |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
119 av_log(avctx, AV_LOG_ERROR, "Unknown WNV1 frame header value %i, please upload file for study\n", buf[2] >> 4); |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
120 l->shift = 4; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
121 } |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
122 if (l->shift < 1) { |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
123 av_log(avctx, AV_LOG_ERROR, "Unknown WNV1 frame header value %i, please upload file for study\n", buf[2] >> 4); |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
124 l->shift = 1; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
125 } |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
126 } |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
127 |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
128 Y = p->data[0]; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
129 U = p->data[1]; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
130 V = p->data[2]; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
131 for (j = 0; j < avctx->height; j++) { |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
132 for (i = 0; i < avctx->width / 2; i++) { |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
133 Y[i * 2] = wnv1_get_code(l, prev_y); |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
134 prev_u = U[i] = wnv1_get_code(l, prev_u); |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
135 prev_y = Y[(i * 2) + 1] = wnv1_get_code(l, Y[i * 2]); |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
136 prev_v = V[i] = wnv1_get_code(l, prev_v); |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
137 } |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
138 Y += p->linesize[0]; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
139 U += p->linesize[1]; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
140 V += p->linesize[2]; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
141 } |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
142 |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
143 |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
144 *data_size = sizeof(AVFrame); |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
145 *(AVFrame*)data = l->pic; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
146 |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
147 return buf_size; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
148 } |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
149 |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
150 static int decode_init(AVCodecContext *avctx){ |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
151 WNV1Context * const l = avctx->priv_data; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
152 |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
153 l->avctx = avctx; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
154 avctx->pix_fmt = PIX_FMT_YUV422P; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
155 |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
156 return 0; |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
157 } |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
158 |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
159 AVCodec wnv1_decoder = { |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
160 "wnv1", |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
161 CODEC_TYPE_VIDEO, |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
162 CODEC_ID_WNV1, |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
163 sizeof(WNV1Context), |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
164 decode_init, |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
165 NULL, |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
166 NULL, |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
167 decode_frame, |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
168 CODEC_CAP_DR1, |
7d9997a69158
Winnov WNV1 video decoder, courtesy of Konstantin Shishkov
melanson
parents:
diff
changeset
|
169 }; |