Revision 650cec0c

View differences:

libavcodec/h264.c
203 203
    
204 204
    uint16_t *mb2b_xy; //FIXME are these 4 a good idea?
205 205
    uint16_t *mb2b8_xy;
206
    int b_stride;
206
    int b_stride; //FIXME use s->b4_stride
207 207
    int b8_stride;
208 208

  
209 209
    int halfpel_flag;
......
3035 3035
    s->mb_width= h->sps.mb_width;
3036 3036
    s->mb_height= h->sps.mb_height;
3037 3037
    
3038
    h->b_stride=  s->mb_width*4;
3039
    h->b8_stride= s->mb_width*2;
3038
    h->b_stride=  s->mb_width*4 + 1;
3039
    h->b8_stride= s->mb_width*2 + 1;
3040 3040

  
3041 3041
    s->resync_mb_x = s->mb_x = first_mb_in_slice % s->mb_width;
3042 3042
    s->resync_mb_y = s->mb_y = first_mb_in_slice / s->mb_width; //FIXME AFFW
libavcodec/mpegvideo.c
1762 1762
        int h_chroma_shift, v_chroma_shift;
1763 1763
        const int width = s->avctx->width;
1764 1764
        const int height= s->avctx->height;
1765
        const int mv_sample_log2= 4 - pict->motion_subsample_log2;
1766
        const int mv_stride= (s->mb_width << mv_sample_log2) + 1;
1765 1767
        s->low_delay=0; //needed to see the vectors without trashing the buffers
1766 1768

  
1767 1769
        avcodec_get_chroma_sub_sample(s->avctx->pix_fmt, &h_chroma_shift, &v_chroma_shift);
......
1797 1799
                    if(!USES_LIST(pict->mb_type[mb_index], direction))
1798 1800
                        continue;
1799 1801

  
1800
                    //FIXME for h264
1801 1802
                    if(IS_8X8(pict->mb_type[mb_index])){
1802 1803
                      int i;
1803 1804
                      for(i=0; i<4; i++){
1804 1805
                        int sx= mb_x*16 + 4 + 8*(i&1);
1805 1806
                        int sy= mb_y*16 + 4 + 8*(i>>1);
1806
                        int xy= mb_x*2 + (i&1) + (mb_y*2 + (i>>1))*s->b8_stride;
1807
                        int xy= (mb_x*2 + (i&1) + (mb_y*2 + (i>>1))*mv_stride) << mv_sample_log2-1;
1807 1808
                        int mx= (pict->motion_val[direction][xy][0]>>shift) + sx;
1808 1809
                        int my= (pict->motion_val[direction][xy][1]>>shift) + sy;
1809 1810
                        draw_arrow(ptr, sx, sy, mx, my, width, height, s->linesize, 100);
......
1813 1814
                      for(i=0; i<2; i++){
1814 1815
                        int sx=mb_x*16 + 8;
1815 1816
                        int sy=mb_y*16 + 4 + 8*i;
1816
                        int xy= mb_x*2 + (mb_y*2 + i)*s->b8_stride;
1817
                        int xy= (mb_x*2 + (mb_y*2 + i)*mv_stride) << mv_sample_log2-1;
1818
                        int mx=(pict->motion_val[direction][xy][0]>>shift);
1819
                        int my=(pict->motion_val[direction][xy][1]>>shift);
1820
                        
1821
                        if(IS_INTERLACED(pict->mb_type[mb_index]))
1822
                            my*=2;
1823
                        
1824
                        draw_arrow(ptr, sx, sy, mx+sx, my+sy, width, height, s->linesize, 100);
1825
                      }
1826
                    }else if(IS_8X16(pict->mb_type[mb_index])){
1827
                      int i;
1828
                      for(i=0; i<2; i++){
1829
                        int sx=mb_x*16 + 4 + 8*i;
1830
                        int sy=mb_y*16 + 8;
1831
                        int xy= (mb_x*2 + i + mb_y*2*mv_stride) << mv_sample_log2-1;
1817 1832
                        int mx=(pict->motion_val[direction][xy][0]>>shift);
1818 1833
                        int my=(pict->motion_val[direction][xy][1]>>shift);
1819 1834
                        
......
1825 1840
                    }else{
1826 1841
                      int sx= mb_x*16 + 8;
1827 1842
                      int sy= mb_y*16 + 8;
1828
                      int xy= mb_x*2 + mb_y*2*s->b8_stride;
1843
                      int xy= (mb_x + mb_y*mv_stride) << mv_sample_log2;
1829 1844
                      int mx= (pict->motion_val[direction][xy][0]>>shift) + sx;
1830 1845
                      int my= (pict->motion_val[direction][xy][1]>>shift) + sy;
1831 1846
                      draw_arrow(ptr, sx, sy, mx, my, width, height, s->linesize, 100);

Also available in: Unified diff