--- image.c 2002/12/14 06:07:03 1.20.2.11 +++ image.c 2003/01/04 06:14:33 1.20.2.14 @@ -677,14 +677,14 @@ case XVID_CSP_I420: yv12_to_yv12(image->y, image->u, image->v, edged_width, edged_width2, - src, src + width*height, src + width*height + width2*height2, - width, width2, width, height, (csp & XVID_CSP_VFLIP)); + src, src + src_stride*height, src + src_stride*height + (src_stride/2)*height2, + src_stride, src_stride/2, width, height, (csp & XVID_CSP_VFLIP)); break ; case XVID_CSP_YV12: /* u/v swapped */ yv12_to_yv12(image->y, image->v, image->u, edged_width, edged_width2, - src, src + width*height, src + width*height + width2*height2, - width, width2, width, height, (csp & XVID_CSP_VFLIP)); + src, src + src_stride*height, src + src_stride*height + (src_stride/2)*height2, + src_stride, src_stride/2, width, height, (csp & XVID_CSP_VFLIP)); break; case XVID_CSP_USER: @@ -765,7 +765,6 @@ int interlacing) { const int edged_width2 = edged_width/2; - int width2 = width/2; int height2 = height/2; /* @@ -874,15 +873,15 @@ return 0; case XVID_CSP_I420: - yv12_to_yv12(dst, dst + width*height, dst + width*height + width2*height2, - width, width2, + yv12_to_yv12(dst, dst + dst_stride*height, dst + dst_stride*height + (dst_stride/2)*height2, + dst_stride, dst_stride/2, image->y, image->u, image->v, edged_width, edged_width2, width, height, (csp & XVID_CSP_VFLIP)); return 0; case XVID_CSP_YV12: // u,v swapped - yv12_to_yv12(dst, dst + width*height, dst + width*height + width2*height2, - width, width2, + yv12_to_yv12(dst, dst + dst_stride*height, dst + dst_stride*height + (dst_stride/2)*height2, + dst_stride, dst_stride/2, image->y, image->v, image->u, edged_width, edged_width2, width, height, (csp & XVID_CSP_VFLIP)); return 0; @@ -1035,7 +1034,6 @@ } -#define ABS(X) (((X)>0)?(X):-(X)) float image_mad(const IMAGE * img1, const IMAGE * img2, @@ -1149,7 +1147,7 @@ if (mbs[(j-1)/2*mb_stride + (i/2)].mode != MODE_NOT_CODED || mbs[(j+0)/2*mb_stride + (i/2)].mode != MODE_NOT_CODED) { - xvid_HFilter_31_C(img->y + (j*block - 1)*edged_width + i*block, + hfilter_31(img->y + (j*block - 1)*edged_width + i*block, img->y + (j*block + 0)*edged_width + i*block, nblocks); } } @@ -1171,7 +1169,20 @@ /* chroma */ if ((flags & XVID_DEC_DEBLOCKUV)) { - for (j = 0; j < mb_height; j++) /* horizontal deblocking */ + for (j = 1; j < mb_height; j++) /* horizontal deblocking */ + for (i = 0; i < mb_width; i++) + { + if (mbs[(j-1)*mb_stride + i].mode != MODE_NOT_CODED || + mbs[(j+0)*mb_stride + i].mode != MODE_NOT_CODED) + { + hfilter_31(img->u + (j*block - 1)*edged_width2 + i*block, + img->u + (j*block + 0)*edged_width2 + i*block, nblocks); + hfilter_31(img->v + (j*block - 1)*edged_width2 + i*block, + img->v + (j*block + 0)*edged_width2 + i*block, nblocks); + } + } + + for (j = 0; j < mb_height; j++) /* vertical deblocking */ for (i = 1; i < mb_width; i++) { if (mbs[j*mb_stride + i - 1].mode != MODE_NOT_CODED || @@ -1185,19 +1196,6 @@ edged_width2, nblocks); } } - - for (j = 1; j < mb_height; j++) /* vertical deblocking */ - for (i = 0; i < mb_width; i++) - { - if (mbs[(j-1)*mb_stride + i].mode != MODE_NOT_CODED || - mbs[(j+0)*mb_stride + i].mode != MODE_NOT_CODED) - { - hfilter_31(img->u + (j*block - 1)*edged_width2 + i*block, - img->u + (j*block + 0)*edged_width2 + i*block, nblocks); - hfilter_31(img->v + (j*block - 1)*edged_width2 + i*block, - img->v + (j*block + 0)*edged_width2 + i*block, nblocks); - } - } } }