Revision ffb9a8b1

View differences:

libavcodec/vc1.c
880 880
    int ys, us, vs;
881 881
    DSPContext *dsp = &v->s.dsp;
882 882

  
883
    if(v->rangeredfrm) {
884
        int i, j, k;
885
        for(k = 0; k < 6; k++)
886
            for(j = 0; j < 8; j++)
887
                for(i = 0; i < 8; i++)
888
                    block[k][i + j*8] = ((block[k][i + j*8] - 128) << 1) + 128;
889

  
890
    }
883 891
    ys = v->s.current_picture.linesize[0];
884 892
    us = v->s.current_picture.linesize[1];
885 893
    vs = v->s.current_picture.linesize[2];
......
943 951
        srcV = s->edge_emu_buffer + 18 * s->linesize;
944 952
    }
945 953

  
946
    if((v->mv_mode == MV_PMODE_INTENSITY_COMP)
954
    if(v->rangeredfrm || (v->mv_mode == MV_PMODE_INTENSITY_COMP)
947 955
       || (unsigned)src_x > s->h_edge_pos - (mx&3) - 16
948 956
       || (unsigned)src_y > s->v_edge_pos - (my&3) - 16){
949 957
        uint8_t *uvbuf= s->edge_emu_buffer + 18 * s->linesize;
......
957 965
                            uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1);
958 966
        srcU = uvbuf;
959 967
        srcV = uvbuf + 16;
968
        /* if we deal with range reduction we need to scale source blocks */
969
        if(v->rangeredfrm) {
970
            int i, j;
971
            uint8_t *src, *src2;
972

  
973
            src = srcY;
974
            for(j = 0; j < 17; j++) {
975
                for(i = 0; i < 17; i++) src[i] = ((src[i] - 128) >> 1) + 128;
976
                src += s->linesize;
977
            }
978
            src = srcU; src2 = srcV;
979
            for(j = 0; j < 9; j++) {
980
                for(i = 0; i < 9; i++) {
981
                    src[i] = ((src[i] - 128) >> 1) + 128;
982
                    src2[i] = ((src2[i] - 128) >> 1) + 128;
983
                }
984
                src += s->uvlinesize;
985
                src2 += s->uvlinesize;
986
            }
987
        }
960 988
        /* if we deal with intensity compensation we need to scale source blocks */
961 989
        if(v->mv_mode == MV_PMODE_INTENSITY_COMP) {
962 990
            int i, j;
......
1039 1067

  
1040 1068
    srcY += src_y * s->linesize + src_x;
1041 1069

  
1042
    if((unsigned)src_x > s->h_edge_pos - (mx&3) - 16
1070
    if(v->rangeredfrm || (unsigned)src_x > s->h_edge_pos - (mx&3) - 16
1043 1071
       || (unsigned)src_y > s->v_edge_pos - (my&3) - 16){
1044 1072
        ff_emulated_edge_mc(s->edge_emu_buffer, srcY, s->linesize, 16+1, 16+1,
1045 1073
                            src_x, src_y, s->h_edge_pos, s->v_edge_pos);
1046 1074
        srcY = s->edge_emu_buffer;
1075
        /* if we deal with range reduction we need to scale source blocks */
1076
        if(v->rangeredfrm) {
1077
            int i, j;
1078
            uint8_t *src;
1079

  
1080
            src = srcY;
1081
            for(j = 0; j < 17; j++) {
1082
                for(i = 0; i < 17; i++) src[i] = ((src[i] - 128) >> 1) + 128;
1083
                src += s->linesize;
1084
            }
1085
        }
1047 1086
    }
1048 1087

  
1049 1088
    if(!s->quarter_sample) { // hpel mc
......
1141 1180
    uvsrc_y = clip(uvsrc_y,  -8, s->mb_height *  8);
1142 1181
    srcU = s->last_picture.data[1] + uvsrc_y * s->uvlinesize + uvsrc_x;
1143 1182
    srcV = s->last_picture.data[2] + uvsrc_y * s->uvlinesize + uvsrc_x;
1144
    if((unsigned)uvsrc_x > (s->h_edge_pos >> 1) - 9
1183
    if(v->rangeredfrm || (unsigned)uvsrc_x > (s->h_edge_pos >> 1) - 9
1145 1184
       || (unsigned)uvsrc_y > (s->v_edge_pos >> 1) - 9){
1146 1185
        ff_emulated_edge_mc(s->edge_emu_buffer     , srcU, s->uvlinesize, 8+1, 8+1,
1147 1186
                            uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1);
......
1149 1188
                            uvsrc_x, uvsrc_y, s->h_edge_pos >> 1, s->v_edge_pos >> 1);
1150 1189
        srcU = s->edge_emu_buffer;
1151 1190
        srcV = s->edge_emu_buffer + 16;
1191

  
1192
        /* if we deal with range reduction we need to scale source blocks */
1193
        if(v->rangeredfrm) {
1194
            int i, j;
1195
            uint8_t *src, *src2;
1196

  
1197
            src = srcU; src2 = srcV;
1198
            for(j = 0; j < 9; j++) {
1199
                for(i = 0; i < 9; i++) {
1200
                    src[i] = ((src[i] - 128) >> 1) + 128;
1201
                    src2[i] = ((src2[i] - 128) >> 1) + 128;
1202
                }
1203
                src += s->uvlinesize;
1204
                src2 += s->uvlinesize;
1205
            }
1206
        }
1152 1207
    }
1153 1208

  
1154 1209
    if(v->fastuvmc) {
......
2578 2633
                    vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset);
2579 2634
                    if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue;
2580 2635
                    vc1_inv_trans(s->block[i], 8, 8);
2636
                    if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1;
2581 2637
                    for(j = 0; j < 64; j++) s->block[i][j] += 128;
2582 2638
                    s->dsp.put_pixels_clamped(s->block[i], s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2));
2583 2639
                    /* TODO: proper loop filtering */
......
2681 2737
                    vc1_decode_intra_block(v, s->block[i], i, is_coded[i], mquant, (i&4)?v->codingset2:v->codingset);
2682 2738
                    if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue;
2683 2739
                    vc1_inv_trans(s->block[i], 8, 8);
2740
                    if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1;
2684 2741
                    for(j = 0; j < 64; j++) s->block[i][j] += 128;
2685 2742
                    s->dsp.put_pixels_clamped(s->block[i], s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize);
2686 2743
                    /* TODO: proper loop filtering */
......
2846 2903
            vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset);
2847 2904
            if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue;
2848 2905
            vc1_inv_trans(s->block[i], 8, 8);
2906
            if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1;
2849 2907
            for(j = 0; j < 64; j++) s->block[i][j] += 128;
2850 2908
            s->dsp.put_pixels_clamped(s->block[i], s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2));
2851 2909
            /* TODO: proper loop filtering */

Also available in: Unified diff