comparison h263dec.c @ 67:cdd89f96cbe1 libavcodec

added draw_horiz_band test
author glantau
date Wed, 15 Aug 2001 13:09:47 +0000
parents 35c1141e23d9
children cb5dabd00ba2
comparison
equal deleted inserted replaced
66:2bb522261514 67:cdd89f96cbe1
28 static int h263_decode_init(AVCodecContext *avctx) 28 static int h263_decode_init(AVCodecContext *avctx)
29 { 29 {
30 MpegEncContext *s = avctx->priv_data; 30 MpegEncContext *s = avctx->priv_data;
31 int i; 31 int i;
32 32
33 s->avctx = avctx;
33 s->out_format = FMT_H263; 34 s->out_format = FMT_H263;
34 35
35 s->width = avctx->width; 36 s->width = avctx->width;
36 s->height = avctx->height; 37 s->height = avctx->height;
37 38
38 /* select sub codec */ 39 /* select sub codec */
39 switch(avctx->codec->id) { 40 switch(avctx->codec->id) {
40 case CODEC_ID_H263: 41 case CODEC_ID_H263:
41 break; 42 break;
42 case CODEC_ID_OPENDIVX: 43 case CODEC_ID_MPEG4:
43 s->time_increment_bits = 4; /* default value for broken headers */ 44 s->time_increment_bits = 4; /* default value for broken headers */
44 s->h263_pred = 1; 45 s->h263_pred = 1;
45 break; 46 break;
46 case CODEC_ID_MSMPEG4: 47 case CODEC_ID_MSMPEG4:
47 s->h263_msmpeg4 = 1; 48 s->h263_msmpeg4 = 1;
146 if (h263_decode_mb(s, s->block) < 0) 147 if (h263_decode_mb(s, s->block) < 0)
147 return -1; 148 return -1;
148 } 149 }
149 MPV_decode_mb(s, s->block); 150 MPV_decode_mb(s, s->block);
150 } 151 }
152 if (avctx->draw_horiz_band) {
153 UINT8 *src_ptr[3];
154 int y, h, offset;
155 y = s->mb_y * 16;
156 h = s->height - y;
157 if (h > 16)
158 h = 16;
159 offset = y * s->linesize;
160 src_ptr[0] = s->current_picture[0] + offset;
161 src_ptr[1] = s->current_picture[1] + (offset >> 2);
162 src_ptr[2] = s->current_picture[2] + (offset >> 2);
163 avctx->draw_horiz_band(avctx, src_ptr, s->linesize,
164 y, s->width, h);
165 }
151 } 166 }
152 167
153 MPV_frame_end(s); 168 MPV_frame_end(s);
154 169
155 pict->data[0] = s->current_picture[0]; 170 pict->data[0] = s->current_picture[0];
162 avctx->quality = s->qscale; 177 avctx->quality = s->qscale;
163 *data_size = sizeof(AVPicture); 178 *data_size = sizeof(AVPicture);
164 return buf_size; 179 return buf_size;
165 } 180 }
166 181
167 AVCodec opendivx_decoder = { 182 AVCodec mpeg4_decoder = {
168 "opendivx", 183 "mpeg4",
169 CODEC_TYPE_VIDEO, 184 CODEC_TYPE_VIDEO,
170 CODEC_ID_OPENDIVX, 185 CODEC_ID_MPEG4,
171 sizeof(MpegEncContext), 186 sizeof(MpegEncContext),
172 h263_decode_init, 187 h263_decode_init,
173 NULL, 188 NULL,
174 h263_decode_end, 189 h263_decode_end,
175 h263_decode_frame, 190 h263_decode_frame,
191 CODEC_CAP_DRAW_HORIZ_BAND,
176 }; 192 };
177 193
178 AVCodec h263_decoder = { 194 AVCodec h263_decoder = {
179 "h263", 195 "h263",
180 CODEC_TYPE_VIDEO, 196 CODEC_TYPE_VIDEO,
182 sizeof(MpegEncContext), 198 sizeof(MpegEncContext),
183 h263_decode_init, 199 h263_decode_init,
184 NULL, 200 NULL,
185 h263_decode_end, 201 h263_decode_end,
186 h263_decode_frame, 202 h263_decode_frame,
203 CODEC_CAP_DRAW_HORIZ_BAND,
187 }; 204 };
188 205
189 AVCodec msmpeg4_decoder = { 206 AVCodec msmpeg4_decoder = {
190 "msmpeg4", 207 "msmpeg4",
191 CODEC_TYPE_VIDEO, 208 CODEC_TYPE_VIDEO,
193 sizeof(MpegEncContext), 210 sizeof(MpegEncContext),
194 h263_decode_init, 211 h263_decode_init,
195 NULL, 212 NULL,
196 h263_decode_end, 213 h263_decode_end,
197 h263_decode_frame, 214 h263_decode_frame,
215 CODEC_CAP_DRAW_HORIZ_BAND,
198 }; 216 };
199 217
200 AVCodec h263i_decoder = { 218 AVCodec h263i_decoder = {
201 "h263i", 219 "h263i",
202 CODEC_TYPE_VIDEO, 220 CODEC_TYPE_VIDEO,
204 sizeof(MpegEncContext), 222 sizeof(MpegEncContext),
205 h263_decode_init, 223 h263_decode_init,
206 NULL, 224 NULL,
207 h263_decode_end, 225 h263_decode_end,
208 h263_decode_frame, 226 h263_decode_frame,
209 }; 227 CODEC_CAP_DRAW_HORIZ_BAND,
210 228 };
229