Mercurial > libavcodec.hg
comparison vcr1.c @ 2967:ef2149182f1c libavcodec
COSMETICS: Remove all trailing whitespace.
author | diego |
---|---|
date | Sat, 17 Dec 2005 18:14:38 +0000 |
parents | e25782262d7d |
children | 0b546eab515d |
comparison
equal
deleted
inserted
replaced
2966:564788471dd4 | 2967:ef2149182f1c |
---|---|
14 * | 14 * |
15 * You should have received a copy of the GNU Lesser General Public | 15 * You should have received a copy of the GNU Lesser General Public |
16 * License along with this library; if not, write to the Free Software | 16 * License along with this library; if not, write to the Free Software |
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 */ | 18 */ |
19 | 19 |
20 /** | 20 /** |
21 * @file vcr1.c | 21 * @file vcr1.c |
22 * ati vcr1 codec. | 22 * ati vcr1 codec. |
23 */ | 23 */ |
24 | 24 |
25 #include "avcodec.h" | 25 #include "avcodec.h" |
26 #include "mpegvideo.h" | 26 #include "mpegvideo.h" |
27 | 27 |
28 //#undef NDEBUG | 28 //#undef NDEBUG |
29 //#include <assert.h> | 29 //#include <assert.h> |
33 AVFrame picture; | 33 AVFrame picture; |
34 int delta[16]; | 34 int delta[16]; |
35 int offset[4]; | 35 int offset[4]; |
36 } VCR1Context; | 36 } VCR1Context; |
37 | 37 |
38 static int decode_frame(AVCodecContext *avctx, | 38 static int decode_frame(AVCodecContext *avctx, |
39 void *data, int *data_size, | 39 void *data, int *data_size, |
40 uint8_t *buf, int buf_size) | 40 uint8_t *buf, int buf_size) |
41 { | 41 { |
42 VCR1Context * const a = avctx->priv_data; | 42 VCR1Context * const a = avctx->priv_data; |
43 AVFrame *picture = data; | 43 AVFrame *picture = data; |
58 | 58 |
59 for(i=0; i<16; i++){ | 59 for(i=0; i<16; i++){ |
60 a->delta[i]= *(bytestream++); | 60 a->delta[i]= *(bytestream++); |
61 bytestream++; | 61 bytestream++; |
62 } | 62 } |
63 | 63 |
64 for(y=0; y<avctx->height; y++){ | 64 for(y=0; y<avctx->height; y++){ |
65 int offset; | 65 int offset; |
66 uint8_t *luma= &a->picture.data[0][ y*a->picture.linesize[0] ]; | 66 uint8_t *luma= &a->picture.data[0][ y*a->picture.linesize[0] ]; |
67 | 67 |
68 if((y&3) == 0){ | 68 if((y&3) == 0){ |
77 luma[0]=( offset += a->delta[ bytestream[2]&0xF ]); | 77 luma[0]=( offset += a->delta[ bytestream[2]&0xF ]); |
78 luma[1]=( offset += a->delta[ bytestream[2]>>4 ]); | 78 luma[1]=( offset += a->delta[ bytestream[2]>>4 ]); |
79 luma[2]=( offset += a->delta[ bytestream[0]&0xF ]); | 79 luma[2]=( offset += a->delta[ bytestream[0]&0xF ]); |
80 luma[3]=( offset += a->delta[ bytestream[0]>>4 ]); | 80 luma[3]=( offset += a->delta[ bytestream[0]>>4 ]); |
81 luma += 4; | 81 luma += 4; |
82 | 82 |
83 *(cb++) = bytestream[3]; | 83 *(cb++) = bytestream[3]; |
84 *(cr++) = bytestream[1]; | 84 *(cr++) = bytestream[1]; |
85 | 85 |
86 bytestream+= 4; | 86 bytestream+= 4; |
87 } | 87 } |
88 }else{ | 88 }else{ |
89 offset= a->offset[y&3] - a->delta[ bytestream[2]&0xF ]; | 89 offset= a->offset[y&3] - a->delta[ bytestream[2]&0xF ]; |
90 | 90 |
105 | 105 |
106 *picture= *(AVFrame*)&a->picture; | 106 *picture= *(AVFrame*)&a->picture; |
107 *data_size = sizeof(AVPicture); | 107 *data_size = sizeof(AVPicture); |
108 | 108 |
109 emms_c(); | 109 emms_c(); |
110 | 110 |
111 return buf_size; | 111 return buf_size; |
112 } | 112 } |
113 | 113 |
114 #if 0 | 114 #if 0 |
115 static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){ | 115 static int encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_size, void *data){ |
122 *p = *pict; | 122 *p = *pict; |
123 p->pict_type= I_TYPE; | 123 p->pict_type= I_TYPE; |
124 p->key_frame= 1; | 124 p->key_frame= 1; |
125 | 125 |
126 emms_c(); | 126 emms_c(); |
127 | 127 |
128 align_put_bits(&a->pb); | 128 align_put_bits(&a->pb); |
129 while(get_bit_count(&a->pb)&31) | 129 while(get_bit_count(&a->pb)&31) |
130 put_bits(&a->pb, 8, 0); | 130 put_bits(&a->pb, 8, 0); |
131 | 131 |
132 size= get_bit_count(&a->pb)/32; | 132 size= get_bit_count(&a->pb)/32; |
133 | 133 |
134 return size*4; | 134 return size*4; |
135 } | 135 } |
136 #endif | 136 #endif |
137 | 137 |
138 static void common_init(AVCodecContext *avctx){ | 138 static void common_init(AVCodecContext *avctx){ |
141 avctx->coded_frame= (AVFrame*)&a->picture; | 141 avctx->coded_frame= (AVFrame*)&a->picture; |
142 a->avctx= avctx; | 142 a->avctx= avctx; |
143 } | 143 } |
144 | 144 |
145 static int decode_init(AVCodecContext *avctx){ | 145 static int decode_init(AVCodecContext *avctx){ |
146 | 146 |
147 common_init(avctx); | 147 common_init(avctx); |
148 | 148 |
149 avctx->pix_fmt= PIX_FMT_YUV410P; | 149 avctx->pix_fmt= PIX_FMT_YUV410P; |
150 | 150 |
151 return 0; | 151 return 0; |
152 } | 152 } |
153 | 153 |
154 #if 0 | 154 #if 0 |
155 static int encode_init(AVCodecContext *avctx){ | 155 static int encode_init(AVCodecContext *avctx){ |
156 | 156 |
157 common_init(avctx); | 157 common_init(avctx); |
158 | 158 |
159 return 0; | 159 return 0; |
160 } | 160 } |
161 #endif | 161 #endif |
162 | 162 |
163 AVCodec vcr1_decoder = { | 163 AVCodec vcr1_decoder = { |