677 |
|
|
678 |
case XVID_CSP_I420: |
case XVID_CSP_I420: |
679 |
yv12_to_yv12(image->y, image->u, image->v, edged_width, edged_width2, |
yv12_to_yv12(image->y, image->u, image->v, edged_width, edged_width2, |
680 |
src, src + width*height, src + width*height + width2*height2, |
src, src + src_stride*height, src + src_stride*height + (src_stride/2)*height2, |
681 |
width, width2, width, height, (csp & XVID_CSP_VFLIP)); |
src_stride, src_stride/2, width, height, (csp & XVID_CSP_VFLIP)); |
682 |
break |
break |
683 |
; |
; |
684 |
case XVID_CSP_YV12: /* u/v swapped */ |
case XVID_CSP_YV12: /* u/v swapped */ |
685 |
yv12_to_yv12(image->y, image->v, image->u, edged_width, edged_width2, |
yv12_to_yv12(image->y, image->v, image->u, edged_width, edged_width2, |
686 |
src, src + width*height, src + width*height + width2*height2, |
src, src + src_stride*height, src + src_stride*height + (src_stride/2)*height2, |
687 |
width, width2, width, height, (csp & XVID_CSP_VFLIP)); |
src_stride, src_stride/2, width, height, (csp & XVID_CSP_VFLIP)); |
688 |
break; |
break; |
689 |
|
|
690 |
case XVID_CSP_USER: |
case XVID_CSP_USER: |
765 |
int interlacing) |
int interlacing) |
766 |
{ |
{ |
767 |
const int edged_width2 = edged_width/2; |
const int edged_width2 = edged_width/2; |
|
int width2 = width/2; |
|
768 |
int height2 = height/2; |
int height2 = height/2; |
769 |
|
|
770 |
/* |
/* |
873 |
return 0; |
return 0; |
874 |
|
|
875 |
case XVID_CSP_I420: |
case XVID_CSP_I420: |
876 |
yv12_to_yv12(dst, dst + width*height, dst + width*height + width2*height2, |
yv12_to_yv12(dst, dst + dst_stride*height, dst + dst_stride*height + (dst_stride/2)*height2, |
877 |
width, width2, |
dst_stride, dst_stride/2, |
878 |
image->y, image->u, image->v, edged_width, edged_width2, |
image->y, image->u, image->v, edged_width, edged_width2, |
879 |
width, height, (csp & XVID_CSP_VFLIP)); |
width, height, (csp & XVID_CSP_VFLIP)); |
880 |
return 0; |
return 0; |
881 |
|
|
882 |
case XVID_CSP_YV12: // u,v swapped |
case XVID_CSP_YV12: // u,v swapped |
883 |
yv12_to_yv12(dst, dst + width*height, dst + width*height + width2*height2, |
yv12_to_yv12(dst, dst + dst_stride*height, dst + dst_stride*height + (dst_stride/2)*height2, |
884 |
width, width2, |
dst_stride, dst_stride/2, |
885 |
image->y, image->v, image->u, edged_width, edged_width2, |
image->y, image->v, image->u, edged_width, edged_width2, |
886 |
width, height, (csp & XVID_CSP_VFLIP)); |
width, height, (csp & XVID_CSP_VFLIP)); |
887 |
return 0; |
return 0; |
938 |
return psnr_y; |
return psnr_y; |
939 |
} |
} |
940 |
|
|
941 |
|
long plane_sse(uint8_t * orig, |
942 |
|
uint8_t * recon, |
943 |
|
uint16_t stride, |
944 |
|
uint16_t width, |
945 |
|
uint16_t height) |
946 |
|
{ |
947 |
|
int diff, x, y; |
948 |
|
long sse=0; |
949 |
|
|
950 |
|
for (y = 0; y < height; y++) { |
951 |
|
for (x = 0; x < width; x++) { |
952 |
|
diff = *(orig + x) - *(recon + x); |
953 |
|
sse += diff * diff; |
954 |
|
} |
955 |
|
orig += stride; |
956 |
|
recon += stride; |
957 |
|
} |
958 |
|
return sse; |
959 |
|
} |
960 |
|
|
961 |
/* |
/* |
962 |
|
|
963 |
#include <stdio.h> |
#include <stdio.h> |
1054 |
} |
} |
1055 |
|
|
1056 |
|
|
|
#define ABS(X) (((X)>0)?(X):-(X)) |
|
1057 |
float |
float |
1058 |
image_mad(const IMAGE * img1, |
image_mad(const IMAGE * img1, |
1059 |
const IMAGE * img2, |
const IMAGE * img2, |
1167 |
if (mbs[(j-1)/2*mb_stride + (i/2)].mode != MODE_NOT_CODED || |
if (mbs[(j-1)/2*mb_stride + (i/2)].mode != MODE_NOT_CODED || |
1168 |
mbs[(j+0)/2*mb_stride + (i/2)].mode != MODE_NOT_CODED) |
mbs[(j+0)/2*mb_stride + (i/2)].mode != MODE_NOT_CODED) |
1169 |
{ |
{ |
1170 |
xvid_HFilter_31_C(img->y + (j*block - 1)*edged_width + i*block, |
hfilter_31(img->y + (j*block - 1)*edged_width + i*block, |
1171 |
img->y + (j*block + 0)*edged_width + i*block, nblocks); |
img->y + (j*block + 0)*edged_width + i*block, nblocks); |
1172 |
} |
} |
1173 |
} |
} |
1189 |
/* chroma */ |
/* chroma */ |
1190 |
if ((flags & XVID_DEC_DEBLOCKUV)) |
if ((flags & XVID_DEC_DEBLOCKUV)) |
1191 |
{ |
{ |
1192 |
for (j = 0; j < mb_height; j++) /* horizontal deblocking */ |
for (j = 1; j < mb_height; j++) /* horizontal deblocking */ |
1193 |
|
for (i = 0; i < mb_width; i++) |
1194 |
|
{ |
1195 |
|
if (mbs[(j-1)*mb_stride + i].mode != MODE_NOT_CODED || |
1196 |
|
mbs[(j+0)*mb_stride + i].mode != MODE_NOT_CODED) |
1197 |
|
{ |
1198 |
|
hfilter_31(img->u + (j*block - 1)*edged_width2 + i*block, |
1199 |
|
img->u + (j*block + 0)*edged_width2 + i*block, nblocks); |
1200 |
|
hfilter_31(img->v + (j*block - 1)*edged_width2 + i*block, |
1201 |
|
img->v + (j*block + 0)*edged_width2 + i*block, nblocks); |
1202 |
|
} |
1203 |
|
} |
1204 |
|
|
1205 |
|
for (j = 0; j < mb_height; j++) /* vertical deblocking */ |
1206 |
for (i = 1; i < mb_width; i++) |
for (i = 1; i < mb_width; i++) |
1207 |
{ |
{ |
1208 |
if (mbs[j*mb_stride + i - 1].mode != MODE_NOT_CODED || |
if (mbs[j*mb_stride + i - 1].mode != MODE_NOT_CODED || |
1216 |
edged_width2, nblocks); |
edged_width2, nblocks); |
1217 |
} |
} |
1218 |
} |
} |
|
|
|
|
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); |
|
|
} |
|
|
} |
|
1219 |
} |
} |
1220 |
|
|
1221 |
} |
} |
1222 |
|
|