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
31
32
37
39 { 0x1FD, 9 }, { 0xFD, 8 }, { 0x7D, 7 }, { 0x3D, 6 }, { 0x1D, 5 }, { 0x0D, 4 }, { 0x005, 3 },
40 { 0x000, 1 },
41 { 0x004, 3 }, { 0x0C, 4 }, { 0x1C, 5 }, { 0x3C, 6 }, { 0x7C, 7 }, { 0xFC, 8 }, { 0x1FC, 9 }, { 0xFF, 8 }
42 };
43
44 #define CODE_VLC_BITS 9
46
47 /* returns modified base_value */
49 {
51
52 if (v == 15)
54 else
55 return base_value + ((v - 7) << w->
shift);
56 }
57
59 void *
data,
int *got_frame,
61 {
64 int buf_size = avpkt->
size;
66 unsigned char *
Y,*
U,*
V;
68 int prev_y = 0, prev_u = 0, prev_v = 0;
70
71 if (buf_size <= 8) {
74 }
75
77 if (!rbuf) {
80 }
81
85 }
87
88 for (i = 8; i < buf_size; i++)
91
92 if (buf[2] >> 4 == 6)
94 else {
95 l->
shift = 8 - (buf[2] >> 4);
98 "Unknown WNV1 frame header value %i",
99 buf[2] >> 4);
101 }
104 "Unknown WNV1 frame header value %i",
105 buf[2] >> 4);
107 }
108 }
109
113 for (j = 0; j < avctx->
height; j++) {
114 for (i = 0; i < avctx->
width / 2; i++) {
119 }
123 }
124
125
126 *got_frame = 1;
128
129 return buf_size;
130 }
131
133 {
135
137
138 code_vlc.
table = code_table;
143
144 return 0;
145 }
146
156 };