1 /*
2 * V210 decoder
3 *
4 * Copyright (C) 2009 Michael Niedermayer <michaelni@gmx.at>
5 * Copyright (c) 2009 Baptiste Coudurier <baptiste dot coudurier at gmail dot com>
6 *
7 * This file is part of FFmpeg.
8 *
9 * FFmpeg is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * FFmpeg is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with FFmpeg; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
30
31 #define READ_PIXELS(a, b, c) \
32 do { \
33 val = av_le2ne32(*src++); \
34 *a++ = val & 0x3FF; \
35 *b++ = (val >> 10) & 0x3FF; \
36 *c++ = (val >> 20) & 0x3FF; \
37 } while (0)
38
40 {
42 int i;
43
44 for( i = 0; i < width-5; i += 6 ){
49 }
50 }
51
53 {
55
56 if (avctx->
width & 1) {
59 }
62
64
65 if (HAVE_MMX)
67
68 return 0;
69 }
70
73 {
75
80
83 else {
84 int aligned_width = ((avctx->
width + 47) / 48) * 48;
85 stride = aligned_width * 8 / 3;
86 }
87
89 if ((((avctx->
width + 23) / 24) * 24 * 8) / 3 * avctx->
height == avpkt->
size) {
94 } else {
97 }
98 }
99
100 aligned_input = !((uintptr_t)psrc & 0xf) && !(stride & 0xf);
103 if (HAVE_MMX)
105 }
106
109
110 y = (uint16_t*)pic->
data[0];
111 u = (uint16_t*)pic->
data[1];
112 v = (uint16_t*)pic->
data[2];
115
117 const uint32_t *
src = (
const uint32_t*)psrc;
119
120 w = (avctx->
width / 6) * 6;
122
123 y += w;
124 u += w >> 1;
125 v += w >> 1;
126 src += (w << 1) / 3;
127
128 if (w < avctx->
width - 1) {
130
132 *y++ = val & 0x3FF;
133 if (w < avctx->
width - 3) {
134 *u++ = (val >> 10) & 0x3FF;
135 *y++ = (val >> 20) & 0x3FF;
136
138 *v++ = val & 0x3FF;
139 *y++ = (val >> 10) & 0x3FF;
140 }
141 }
142
147 }
148
149 *got_frame = 1;
150
152 }
153
154 #define V210DEC_FLAGS AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_VIDEO_PARAM
158 {NULL}
159 };
160
162 "V210 Decoder",
166 };
167
178 };