comparison vc1.c @ 3548:f7b09917c680 libavcodec

100l: intensity compensation must be also done in 4-MV mode
author kostya
date Fri, 04 Aug 2006 03:31:01 +0000
parents f26bf13bbb69
children 4a0f82c8dc43
comparison
equal deleted inserted replaced
3547:e542c9978077 3548:f7b09917c680
920 src_x = clip( src_x, -16, s->mb_width * 16); 920 src_x = clip( src_x, -16, s->mb_width * 16);
921 src_y = clip( src_y, -16, s->mb_height * 16); 921 src_y = clip( src_y, -16, s->mb_height * 16);
922 922
923 srcY += src_y * s->linesize + src_x; 923 srcY += src_y * s->linesize + src_x;
924 924
925 if(v->rangeredfrm || (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx&3) - 8 - s->mspel 925 if(v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP)
926 || (unsigned)(src_x - s->mspel) > s->h_edge_pos - (mx&3) - 8 - s->mspel
926 || (unsigned)(src_y - s->mspel) > s->v_edge_pos - (my&3) - 8 - s->mspel){ 927 || (unsigned)(src_y - s->mspel) > s->v_edge_pos - (my&3) - 8 - s->mspel){
927 srcY -= s->mspel * (1 + s->linesize); 928 srcY -= s->mspel * (1 + s->linesize);
928 ff_emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 9+s->mspel*2, 9+s->mspel*2, 929 ff_emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 9+s->mspel*2, 9+s->mspel*2,
929 src_x - s->mspel, src_y - s->mspel, s->h_edge_pos, s->v_edge_pos); 930 src_x - s->mspel, src_y - s->mspel, s->h_edge_pos, s->v_edge_pos);
930 srcY = s->edge_emu_buffer; 931 srcY = s->edge_emu_buffer;
934 uint8_t *src; 935 uint8_t *src;
935 936
936 src = srcY; 937 src = srcY;
937 for(j = 0; j < 9 + s->mspel*2; j++) { 938 for(j = 0; j < 9 + s->mspel*2; j++) {
938 for(i = 0; i < 9 + s->mspel*2; i++) src[i] = ((src[i] - 128) >> 1) + 128; 939 for(i = 0; i < 9 + s->mspel*2; i++) src[i] = ((src[i] - 128) >> 1) + 128;
940 src += s->linesize;
941 }
942 }
943 /* if we deal with intensity compensation we need to scale source blocks */
944 if(v->mv_mode == MV_PMODE_INTENSITY_COMP) {
945 int i, j;
946 uint8_t *src;
947
948 src = srcY;
949 for(j = 0; j < 9 + s->mspel*2; j++) {
950 for(i = 0; i < 9 + s->mspel*2; i++) src[i] = v->luty[src[i]];
939 src += s->linesize; 951 src += s->linesize;
940 } 952 }
941 } 953 }
942 srcY += s->mspel * (1 + s->linesize); 954 srcY += s->mspel * (1 + s->linesize);
943 } 955 }
1038 1050
1039 uvsrc_x = clip(uvsrc_x, -8, s->mb_width * 8); 1051 uvsrc_x = clip(uvsrc_x, -8, s->mb_width * 8);
1040 uvsrc_y = clip(uvsrc_y, -8, s->mb_height * 8); 1052 uvsrc_y = clip(uvsrc_y, -8, s->mb_height * 8);
1041 srcU = s->last_picture.data[1] + uvsrc_y * s->uvlinesize + uvsrc_x; 1053 srcU = s->last_picture.data[1] + uvsrc_y * s->uvlinesize + uvsrc_x;
1042 srcV = s->last_picture.data[2] + uvsrc_y * s->uvlinesize + uvsrc_x; 1054 srcV = s->last_picture.data[2] + uvsrc_y * s->uvlinesize + uvsrc_x;
1043 if(v->rangeredfrm || (unsigned)uvsrc_x > (s->h_edge_pos >> 1) - 9 1055 if(v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP)
1056 || (unsigned)uvsrc_x > (s->h_edge_pos >> 1) - 9
1044 || (unsigned)uvsrc_y > (s->v_edge_pos >> 1) - 9){ 1057 || (unsigned)uvsrc_y > (s->v_edge_pos >> 1) - 9){
1045 ff_emulated_edge_mc(s->edge_emu_buffer , srcU, s->uvlinesize, 8+1, 8+1, 1058 ff_emulated_edge_mc(s->edge_emu_buffer , srcU, s->uvlinesize, 8+1, 8+1,
1046 uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1); 1059 uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1);
1047 ff_emulated_edge_mc(s->edge_emu_buffer + 16, srcV, s->uvlinesize, 8+1, 8+1, 1060 ff_emulated_edge_mc(s->edge_emu_buffer + 16, srcV, s->uvlinesize, 8+1, 8+1,
1048 uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1); 1061 uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1);
1057 src = srcU; src2 = srcV; 1070 src = srcU; src2 = srcV;
1058 for(j = 0; j < 9; j++) { 1071 for(j = 0; j < 9; j++) {
1059 for(i = 0; i < 9; i++) { 1072 for(i = 0; i < 9; i++) {
1060 src[i] = ((src[i] - 128) >> 1) + 128; 1073 src[i] = ((src[i] - 128) >> 1) + 128;
1061 src2[i] = ((src2[i] - 128) >> 1) + 128; 1074 src2[i] = ((src2[i] - 128) >> 1) + 128;
1075 }
1076 src += s->uvlinesize;
1077 src2 += s->uvlinesize;
1078 }
1079 }
1080 /* if we deal with intensity compensation we need to scale source blocks */
1081 if(v->mv_mode == MV_PMODE_INTENSITY_COMP) {
1082 int i, j;
1083 uint8_t *src, *src2;
1084
1085 src = srcU; src2 = srcV;
1086 for(j = 0; j < 9; j++) {
1087 for(i = 0; i < 9; i++) {
1088 src[i] = v->lutuv[src[i]];
1089 src2[i] = v->lutuv[src2[i]];
1062 } 1090 }
1063 src += s->uvlinesize; 1091 src += s->uvlinesize;
1064 src2 += s->uvlinesize; 1092 src2 += s->uvlinesize;
1065 } 1093 }
1066 } 1094 }