Mercurial > libavcodec.hg
comparison svq3.c @ 1268:fb865ca0c251 libavcodec
CODEC_CAP_DRAW_HORIZ_BAND
author | michaelni |
---|---|
date | Fri, 16 May 2003 10:14:25 +0000 |
parents | 85b71f9f7450 |
children | 2498a7045b37 |
comparison
equal
deleted
inserted
replaced
1267:85b71f9f7450 | 1268:fb865ca0c251 |
---|---|
269 int blocksize= 2 - (width>>3); //16->0, 8->1, 4->2 | 269 int blocksize= 2 - (width>>3); //16->0, 8->1, 4->2 |
270 | 270 |
271 mx += x; | 271 mx += x; |
272 my += y; | 272 my += y; |
273 | 273 |
274 if (mx < 0 || mx >= (s->width - width - 1) || | 274 if (mx < 0 || mx >= (s->h_edge_pos - width - 1) || |
275 my < 0 || my >= (s->height - height - 1)) { | 275 my < 0 || my >= (s->v_edge_pos - height - 1)) { |
276 | 276 |
277 if ((s->flags & CODEC_FLAG_EMU_EDGE)) { | 277 if ((s->flags & CODEC_FLAG_EMU_EDGE)) { |
278 emu = 1; | 278 emu = 1; |
279 } | 279 } |
280 | 280 |
281 mx = clip (mx, -16, (s->width - width + 15)); | 281 mx = clip (mx, -16, (s->h_edge_pos - width + 15)); |
282 my = clip (my, -16, (s->height - height + 15)); | 282 my = clip (my, -16, (s->v_edge_pos - height + 15)); |
283 } | 283 } |
284 | 284 |
285 /* form component predictions */ | 285 /* form component predictions */ |
286 dest = s->current_picture.data[0] + x + y*s->linesize; | 286 dest = s->current_picture.data[0] + x + y*s->linesize; |
287 src = s->last_picture.data[0] + mx + my*s->linesize; | 287 src = s->last_picture.data[0] + mx + my*s->linesize; |
288 | 288 |
289 if (emu) { | 289 if (emu) { |
290 ff_emulated_edge_mc (s, src, s->linesize, (width + 1), (height + 1), | 290 ff_emulated_edge_mc (s, src, s->linesize, (width + 1), (height + 1), |
291 mx, my, s->width, s->height); | 291 mx, my, s->h_edge_pos, s->v_edge_pos); |
292 src = s->edge_emu_buffer; | 292 src = s->edge_emu_buffer; |
293 } | 293 } |
294 if(thirdpel) | 294 if(thirdpel) |
295 s->dsp.put_tpel_pixels_tab[dxy](dest, src, s->linesize, width, height); | 295 s->dsp.put_tpel_pixels_tab[dxy](dest, src, s->linesize, width, height); |
296 else | 296 else |
307 dest = s->current_picture.data[i] + (x >> 1) + (y >> 1)*s->uvlinesize; | 307 dest = s->current_picture.data[i] + (x >> 1) + (y >> 1)*s->uvlinesize; |
308 src = s->last_picture.data[i] + mx + my*s->uvlinesize; | 308 src = s->last_picture.data[i] + mx + my*s->uvlinesize; |
309 | 309 |
310 if (emu) { | 310 if (emu) { |
311 ff_emulated_edge_mc (s, src, s->uvlinesize, (width + 1), (height + 1), | 311 ff_emulated_edge_mc (s, src, s->uvlinesize, (width + 1), (height + 1), |
312 mx, my, (s->width >> 1), (s->height >> 1)); | 312 mx, my, (s->h_edge_pos >> 1), (s->v_edge_pos >> 1)); |
313 src = s->edge_emu_buffer; | 313 src = s->edge_emu_buffer; |
314 } | 314 } |
315 if(thirdpel) | 315 if(thirdpel) |
316 s->dsp.put_tpel_pixels_tab[dxy](dest, src, s->uvlinesize, width, height); | 316 s->dsp.put_tpel_pixels_tab[dxy](dest, src, s->uvlinesize, width, height); |
317 else | 317 else |
395 k = ((j>>2)&1) + ((i>>1)&2) + ((j>>1)&4) + (i&8); | 395 k = ((j>>2)&1) + ((i>>1)&2) + ((j>>1)&4) + (i&8); |
396 | 396 |
397 pred_motion (h, k, (part_width >> 2), 0, 1, &mx, &my); | 397 pred_motion (h, k, (part_width >> 2), 0, 1, &mx, &my); |
398 | 398 |
399 /* clip motion vector prediction to frame border */ | 399 /* clip motion vector prediction to frame border */ |
400 mx = clip (mx, -6*x, 6*(s->width - part_width - x)); | 400 mx = clip (mx, -6*x, 6*(s->h_edge_pos - part_width - x)); |
401 my = clip (my, -6*y, 6*(s->height - part_height - y)); | 401 my = clip (my, -6*y, 6*(s->v_edge_pos - part_height - y)); |
402 | 402 |
403 /* get motion vector differential */ | 403 /* get motion vector differential */ |
404 dy = svq3_get_se_golomb (&s->gb); | 404 dy = svq3_get_se_golomb (&s->gb); |
405 dx = svq3_get_se_golomb (&s->gb); | 405 dx = svq3_get_se_golomb (&s->gb); |
406 | 406 |
574 MpegEncContext *const s = avctx->priv_data; | 574 MpegEncContext *const s = avctx->priv_data; |
575 H264Context *const h = avctx->priv_data; | 575 H264Context *const h = avctx->priv_data; |
576 int i; | 576 int i; |
577 | 577 |
578 s->flags = avctx->flags; | 578 s->flags = avctx->flags; |
579 | 579 |
580 if (!s->context_initialized) { | 580 if (!s->context_initialized) { |
581 s->width = (avctx->width + 15) & ~15; | 581 s->width = avctx->width; |
582 s->height = (avctx->height + 15) & ~15; | 582 s->height = avctx->height; |
583 h->b_stride = (s->width >> 2); | |
584 h->pred4x4[DIAG_DOWN_LEFT_PRED] = pred4x4_down_left_svq3_c; | 583 h->pred4x4[DIAG_DOWN_LEFT_PRED] = pred4x4_down_left_svq3_c; |
585 h->pred16x16[PLANE_PRED8x8] = pred16x16_plane_svq3_c; | 584 h->pred16x16[PLANE_PRED8x8] = pred16x16_plane_svq3_c; |
586 h->halfpel_flag = 1; | 585 h->halfpel_flag = 1; |
587 h->thirdpel_flag = 1; | 586 h->thirdpel_flag = 1; |
588 h->chroma_qp = 4; | 587 h->chroma_qp = 4; |
589 | 588 |
590 if (MPV_common_init (s) < 0) | 589 if (MPV_common_init (s) < 0) |
591 return -1; | 590 return -1; |
592 | 591 |
592 h->b_stride = 4*s->mb_width; | |
593 | |
593 alloc_tables (h); | 594 alloc_tables (h); |
594 } | 595 } |
596 | |
597 s->low_delay= 1; | |
598 | |
595 if (avctx->extradata && avctx->extradata_size >= 0x63 | 599 if (avctx->extradata && avctx->extradata_size >= 0x63 |
596 && !memcmp (avctx->extradata, "SVQ3", 4)) { | 600 && !memcmp (avctx->extradata, "SVQ3", 4)) { |
597 | 601 |
598 uint8_t *stsd = (uint8_t *) avctx->extradata + 0x62; | 602 uint8_t *stsd = (uint8_t *) avctx->extradata + 0x62; |
599 | 603 |
683 | 687 |
684 if (mb_type != 0) { | 688 if (mb_type != 0) { |
685 hl_decode_mb (h); | 689 hl_decode_mb (h); |
686 } | 690 } |
687 } | 691 } |
692 | |
693 ff_draw_horiz_band(s, 16*s->mb_y, 16); | |
688 } | 694 } |
689 | 695 |
690 *(AVFrame *) data = *(AVFrame *) &s->current_picture; | 696 *(AVFrame *) data = *(AVFrame *) &s->current_picture; |
691 *data_size = sizeof(AVFrame); | 697 *data_size = sizeof(AVFrame); |
692 | 698 |
703 sizeof(H264Context), | 709 sizeof(H264Context), |
704 decode_init, | 710 decode_init, |
705 NULL, | 711 NULL, |
706 decode_end, | 712 decode_end, |
707 svq3_decode_frame, | 713 svq3_decode_frame, |
708 CODEC_CAP_DR1, | 714 CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, |
709 }; | 715 }; |