1 /*
2 * Winnov WNV1 codec
3 * Copyright (c) 2005 Konstantin Shishkov
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
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
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 /**
23 * @file
24 * Winnov WNV1 codec.
25 */
26
28
29 #define BITSTREAM_READER_LE
33
35 { 7, 1 }, { 8, 3 }, { 6, 3 }, { 9, 4 }, { 5, 4 }, { 10, 5 }, { 4, 5 },
36 { 11, 6 }, { 3, 6 }, { 12, 7 }, { 2, 7 }, { 13, 8 }, { 1, 8 }, { 14, 9 },
37 { 0, 9 }, { 15, 8 }
38 };
39
40 #define CODE_VLC_BITS 9
42
43 /* returns modified base_value */
45 {
47
48 if (v == 8)
50 else
51 return base_value + v * (1 <<
shift);
52 }
53
55 void *
data,
int *got_frame,
57 {
58 const uint8_t *buf = avpkt->
data;
59 int buf_size = avpkt->
size;
62 unsigned char *
Y,*
U,*
V;
64 int prev_y = 0, prev_u = 0, prev_v = 0;
65
66 if (buf_size < 8 + avctx->
height * (avctx->
width/2)/8) {
69 }
70
74
77
78 if (buf[2] >> 4 == 6)
80 else {
81 shift = 8 - (buf[2] >> 4);
84 "Unknown WNV1 frame header value %i",
85 buf[2] >> 4);
87 }
90 "Unknown WNV1 frame header value %i",
91 buf[2] >> 4);
93 }
94 }
95
99 for (j = 0; j < avctx->
height; j++) {
100 for (
i = 0;
i < avctx->
width / 2;
i++) {
105 }
109 }
110
111
112 *got_frame = 1;
113
114 return buf_size;
115 }
116
118 {
123 }
124
126 {
128
130
132
133 return 0;
134 }
135
145 };