comparison h264.c @ 2861:3b920e274b26 libavcodec

fix emulated edge motion compensation when resolution%16!=0
author lorenm
date Mon, 05 Sep 2005 17:07:52 +0000
parents 40765c51a7a9
children 7c7edddaa835
comparison
equal deleted inserted replaced
2860:1c7921282a28 2861:3b920e274b26
2576 int extra_width= (s->flags&CODEC_FLAG_EMU_EDGE) ? 0 : 16; //FIXME increase edge?, IMHO not worth it 2576 int extra_width= (s->flags&CODEC_FLAG_EMU_EDGE) ? 0 : 16; //FIXME increase edge?, IMHO not worth it
2577 int extra_height= extra_width; 2577 int extra_height= extra_width;
2578 int emu=0; 2578 int emu=0;
2579 const int full_mx= mx>>2; 2579 const int full_mx= mx>>2;
2580 const int full_my= my>>2; 2580 const int full_my= my>>2;
2581 const int pic_width = 16*s->mb_width;
2582 const int pic_height = 16*s->mb_height;
2581 2583
2582 assert(pic->data[0]); 2584 assert(pic->data[0]);
2583 2585
2584 if(mx&7) extra_width -= 3; 2586 if(mx&7) extra_width -= 3;
2585 if(my&7) extra_height -= 3; 2587 if(my&7) extra_height -= 3;
2586 2588
2587 if( full_mx < 0-extra_width 2589 if( full_mx < 0-extra_width
2588 || full_my < 0-extra_height 2590 || full_my < 0-extra_height
2589 || full_mx + 16/*FIXME*/ > s->width + extra_width 2591 || full_mx + 16/*FIXME*/ > pic_width + extra_width
2590 || full_my + 16/*FIXME*/ > s->height + extra_height){ 2592 || full_my + 16/*FIXME*/ > pic_height + extra_height){
2591 ff_emulated_edge_mc(s->edge_emu_buffer, src_y - 2 - 2*s->linesize, s->linesize, 16+5, 16+5/*FIXME*/, full_mx-2, full_my-2, s->width, s->height); 2593 ff_emulated_edge_mc(s->edge_emu_buffer, src_y - 2 - 2*s->linesize, s->linesize, 16+5, 16+5/*FIXME*/, full_mx-2, full_my-2, pic_width, pic_height);
2592 src_y= s->edge_emu_buffer + 2 + 2*s->linesize; 2594 src_y= s->edge_emu_buffer + 2 + 2*s->linesize;
2593 emu=1; 2595 emu=1;
2594 } 2596 }
2595 2597
2596 qpix_op[luma_xy](dest_y, src_y, s->linesize); //FIXME try variable height perhaps? 2598 qpix_op[luma_xy](dest_y, src_y, s->linesize); //FIXME try variable height perhaps?
2599 } 2601 }
2600 2602
2601 if(s->flags&CODEC_FLAG_GRAY) return; 2603 if(s->flags&CODEC_FLAG_GRAY) return;
2602 2604
2603 if(emu){ 2605 if(emu){
2604 ff_emulated_edge_mc(s->edge_emu_buffer, src_cb, s->uvlinesize, 9, 9/*FIXME*/, (mx>>3), (my>>3), s->width>>1, s->height>>1); 2606 ff_emulated_edge_mc(s->edge_emu_buffer, src_cb, s->uvlinesize, 9, 9/*FIXME*/, (mx>>3), (my>>3), pic_width>>1, pic_height>>1);
2605 src_cb= s->edge_emu_buffer; 2607 src_cb= s->edge_emu_buffer;
2606 } 2608 }
2607 chroma_op(dest_cb, src_cb, s->uvlinesize, chroma_height, mx&7, my&7); 2609 chroma_op(dest_cb, src_cb, s->uvlinesize, chroma_height, mx&7, my&7);
2608 2610
2609 if(emu){ 2611 if(emu){
2610 ff_emulated_edge_mc(s->edge_emu_buffer, src_cr, s->uvlinesize, 9, 9/*FIXME*/, (mx>>3), (my>>3), s->width>>1, s->height>>1); 2612 ff_emulated_edge_mc(s->edge_emu_buffer, src_cr, s->uvlinesize, 9, 9/*FIXME*/, (mx>>3), (my>>3), pic_width>>1, pic_height>>1);
2611 src_cr= s->edge_emu_buffer; 2613 src_cr= s->edge_emu_buffer;
2612 } 2614 }
2613 chroma_op(dest_cr, src_cr, s->uvlinesize, chroma_height, mx&7, my&7); 2615 chroma_op(dest_cr, src_cr, s->uvlinesize, chroma_height, mx&7, my&7);
2614 } 2616 }
2615 2617