1 /*
2 * Copyright (C) 2009 Michael Niedermayer <michaelni@gmx.at>
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
26
28 {
29 if (avctx->
width & 1) {
32 }
35
36 return 0;
37 }
38
41 {
42 const uint32_t *
src = (
const uint32_t *)avpkt->
data;
46 uint16_t *ydst, *udst, *vdst, *yend;
48
52 }
53
56 }
57
60
61 ydst = (uint16_t *)pic->data[0];
62 udst = (uint16_t *)pic->data[1];
63 vdst = (uint16_t *)pic->data[2];
66 pic->key_frame = 1;
67
70 *udst++ = (v >> 16) & 0xFFC0;
71 *ydst++ = (v >> 6 ) & 0xFFC0;
72 *vdst++ = (v << 4 ) & 0xFFC0;
73
75 *ydst++ = (v >> 16) & 0xFFC0;
76
77 if (ydst >= yend) {
78 ydst += pic->linesize[0] / 2 -
width;
79 udst += pic->linesize[1] / 2 -
width / 2;
80 vdst += pic->linesize[2] / 2 -
width / 2;
83 break;
84 }
85
86 *udst++ = (v >> 6 ) & 0xFFC0;
87 *ydst++ = (v << 4 ) & 0xFFC0;
88
90 *vdst++ = (v >> 16) & 0xFFC0;
91 *ydst++ = (v >> 6 ) & 0xFFC0;
92
93 if (ydst >= yend) {
94 ydst += pic->linesize[0] / 2 -
width;
95 udst += pic->linesize[1] / 2 -
width / 2;
96 vdst += pic->linesize[2] / 2 -
width / 2;
99 break;
100 }
101
102 *udst++ = (v << 4 ) & 0xFFC0;
103
105 *ydst++ = (v >> 16) & 0xFFC0;
106 *vdst++ = (v >> 6 ) & 0xFFC0;
107 *ydst++ = (v << 4 ) & 0xFFC0;
108 if (ydst >= yend) {
109 ydst += pic->linesize[0] / 2 -
width;
110 udst += pic->linesize[1] / 2 -
width / 2;
111 vdst += pic->linesize[2] / 2 -
width / 2;
114 break;
115 }
116 }
117
118 *got_frame = 1;
119
121 }
122
131 };