Mercurial > libavcodec.hg
comparison svq1.c @ 1049:6fadc19937b9 libavcodec
cliping MVs, i dunno if its correct but it looks better then without it
author | michaelni |
---|---|
date | Tue, 04 Feb 2003 01:32:25 +0000 |
parents | 1f9afd8b9131 |
children | b32afefe7d33 |
comparison
equal
deleted
inserted
replaced
1048:75a659fae7e0 | 1049:6fadc19937b9 |
---|---|
833 motion[(x / 8) + 2].x = | 833 motion[(x / 8) + 2].x = |
834 motion[(x / 8) + 3].x = mv.x; | 834 motion[(x / 8) + 3].x = mv.x; |
835 motion[0].y = | 835 motion[0].y = |
836 motion[(x / 8) + 2].y = | 836 motion[(x / 8) + 2].y = |
837 motion[(x / 8) + 3].y = mv.y; | 837 motion[(x / 8) + 3].y = mv.y; |
838 | 838 |
839 if(y + (mv.y >> 1)<0) | |
840 mv.y= 0; | |
841 if(x + (mv.x >> 1)<0) | |
842 mv.x= 0; | |
843 | |
844 #if 0 | |
845 int w= (s->width+15)&~15; | |
846 int h= (s->height+15)&~15; | |
847 if(x + (mv.x >> 1)<0 || y + (mv.y >> 1)<0 || x + (mv.x >> 1) + 16 > w || y + (mv.y >> 1) + 16> h) | |
848 printf("%d %d %d %d\n", x, y, x + (mv.x >> 1), y + (mv.y >> 1)); | |
849 #endif | |
850 | |
839 src = &previous[(x + (mv.x >> 1)) + (y + (mv.y >> 1))*pitch]; | 851 src = &previous[(x + (mv.x >> 1)) + (y + (mv.y >> 1))*pitch]; |
840 dst = current; | 852 dst = current; |
841 | 853 |
842 s->dsp.put_pixels_tab[0][((mv.y & 1) << 1) | (mv.x & 1)](dst,src,pitch,16); | 854 s->dsp.put_pixels_tab[0][((mv.y & 1) << 1) | (mv.x & 1)](dst,src,pitch,16); |
843 | 855 |
901 if (result != 0) | 913 if (result != 0) |
902 return result; | 914 return result; |
903 | 915 |
904 /* form predictions */ | 916 /* form predictions */ |
905 for (i=0; i < 4; i++) { | 917 for (i=0; i < 4; i++) { |
906 src = &previous[(x + (pmv[i]->x >> 1)) + (y + (pmv[i]->y >> 1))*pitch]; | 918 int mvx= pmv[i]->x + (i&1)*16; |
919 int mvy= pmv[i]->y + (i>>1)*16; | |
920 | |
921 ///XXX /FIXME cliping or padding? | |
922 if(y + (mvy >> 1)<0) | |
923 mvy= 0; | |
924 if(x + (mvx >> 1)<0) | |
925 mvx= 0; | |
926 | |
927 #if 0 | |
928 int w= (s->width+15)&~15; | |
929 int h= (s->height+15)&~15; | |
930 if(x + (mvx >> 1)<0 || y + (mvy >> 1)<0 || x + (mvx >> 1) + 8 > w || y + (mvy >> 1) + 8> h) | |
931 printf("%d %d %d %d\n", x, y, x + (mvx >> 1), y + (mvy >> 1)); | |
932 #endif | |
933 src = &previous[(x + (mvx >> 1)) + (y + (mvy >> 1))*pitch]; | |
907 dst = current; | 934 dst = current; |
908 | 935 |
909 s->dsp.put_pixels_tab[1][((pmv[i]->y & 1) << 1) | (pmv[i]->x & 1)](dst,src,pitch,8); | 936 s->dsp.put_pixels_tab[1][((mvy & 1) << 1) | (mvx & 1)](dst,src,pitch,8); |
910 | 937 |
911 /* select next block */ | 938 /* select next block */ |
912 if (i & 1) { | 939 if (i & 1) { |
913 current += 8*(pitch - 1); | 940 current += 8*(pitch - 1); |
914 previous += 8*(pitch - 1); | |
915 } else { | 941 } else { |
916 current += 8; | 942 current += 8; |
917 previous += 8; | |
918 } | 943 } |
919 } | 944 } |
920 | 945 |
921 return 0; | 946 return 0; |
922 } | 947 } |
998 | 1023 |
999 /* frame type */ | 1024 /* frame type */ |
1000 s->pict_type= get_bits (bitbuf, 2)+1; | 1025 s->pict_type= get_bits (bitbuf, 2)+1; |
1001 if(s->pict_type==4) | 1026 if(s->pict_type==4) |
1002 return -1; | 1027 return -1; |
1003 | 1028 |
1004 if (s->pict_type == I_TYPE) { | 1029 if (s->pict_type == I_TYPE) { |
1005 | 1030 |
1006 /* unknown fields */ | 1031 /* unknown fields */ |
1007 if (s->f_code == 0x50 || s->f_code == 0x60) { | 1032 if (s->f_code == 0x50 || s->f_code == 0x60) { |
1008 get_bits (bitbuf, 16); | 1033 get_bits (bitbuf, 16); |