diff options
Diffstat (limited to 'third_party/aom/common/tools_common.c')
-rw-r--r-- | third_party/aom/common/tools_common.c | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/third_party/aom/common/tools_common.c b/third_party/aom/common/tools_common.c index 359ec7341..21cd80026 100644 --- a/third_party/aom/common/tools_common.c +++ b/third_party/aom/common/tools_common.c @@ -236,7 +236,7 @@ double sse_to_psnr(double samples, double peak, double sse) { } // TODO(debargha): Consolidate the functions below into a separate file. -static void highbd_img_upshift(aom_image_t *dst, aom_image_t *src, +static void highbd_img_upshift(aom_image_t *dst, const aom_image_t *src, int input_shift) { // Note the offset is 1 less than half. const int offset = input_shift > 0 ? (1 << (input_shift - 1)) - 1 : 0; @@ -262,8 +262,8 @@ static void highbd_img_upshift(aom_image_t *dst, aom_image_t *src, h = (h + src->y_chroma_shift) >> src->y_chroma_shift; } for (y = 0; y < h; y++) { - uint16_t *p_src = - (uint16_t *)(src->planes[plane] + y * src->stride[plane]); + const uint16_t *p_src = + (const uint16_t *)(src->planes[plane] + y * src->stride[plane]); uint16_t *p_dst = (uint16_t *)(dst->planes[plane] + y * dst->stride[plane]); for (x = 0; x < w; x++) *p_dst++ = (*p_src++ << input_shift) + offset; @@ -271,7 +271,7 @@ static void highbd_img_upshift(aom_image_t *dst, aom_image_t *src, } } -static void lowbd_img_upshift(aom_image_t *dst, aom_image_t *src, +static void lowbd_img_upshift(aom_image_t *dst, const aom_image_t *src, int input_shift) { // Note the offset is 1 less than half. const int offset = input_shift > 0 ? (1 << (input_shift - 1)) - 1 : 0; @@ -297,7 +297,7 @@ static void lowbd_img_upshift(aom_image_t *dst, aom_image_t *src, h = (h + src->y_chroma_shift) >> src->y_chroma_shift; } for (y = 0; y < h; y++) { - uint8_t *p_src = src->planes[plane] + y * src->stride[plane]; + const uint8_t *p_src = src->planes[plane] + y * src->stride[plane]; uint16_t *p_dst = (uint16_t *)(dst->planes[plane] + y * dst->stride[plane]); for (x = 0; x < w; x++) { @@ -307,7 +307,8 @@ static void lowbd_img_upshift(aom_image_t *dst, aom_image_t *src, } } -void aom_img_upshift(aom_image_t *dst, aom_image_t *src, int input_shift) { +void aom_img_upshift(aom_image_t *dst, const aom_image_t *src, + int input_shift) { if (src->fmt & AOM_IMG_FMT_HIGHBITDEPTH) { highbd_img_upshift(dst, src, input_shift); } else { @@ -315,7 +316,7 @@ void aom_img_upshift(aom_image_t *dst, aom_image_t *src, int input_shift) { } } -void aom_img_truncate_16_to_8(aom_image_t *dst, aom_image_t *src) { +void aom_img_truncate_16_to_8(aom_image_t *dst, const aom_image_t *src) { int plane; if (dst->fmt + AOM_IMG_FMT_HIGHBITDEPTH != src->fmt || dst->d_w != src->d_w || dst->d_h != src->d_h || dst->x_chroma_shift != src->x_chroma_shift || @@ -337,8 +338,8 @@ void aom_img_truncate_16_to_8(aom_image_t *dst, aom_image_t *src) { h = (h + src->y_chroma_shift) >> src->y_chroma_shift; } for (y = 0; y < h; y++) { - uint16_t *p_src = - (uint16_t *)(src->planes[plane] + y * src->stride[plane]); + const uint16_t *p_src = + (const uint16_t *)(src->planes[plane] + y * src->stride[plane]); uint8_t *p_dst = dst->planes[plane] + y * dst->stride[plane]; for (x = 0; x < w; x++) { *p_dst++ = (uint8_t)(*p_src++); @@ -347,7 +348,7 @@ void aom_img_truncate_16_to_8(aom_image_t *dst, aom_image_t *src) { } } -static void highbd_img_downshift(aom_image_t *dst, aom_image_t *src, +static void highbd_img_downshift(aom_image_t *dst, const aom_image_t *src, int down_shift) { int plane; if (dst->d_w != src->d_w || dst->d_h != src->d_h || @@ -371,8 +372,8 @@ static void highbd_img_downshift(aom_image_t *dst, aom_image_t *src, h = (h + src->y_chroma_shift) >> src->y_chroma_shift; } for (y = 0; y < h; y++) { - uint16_t *p_src = - (uint16_t *)(src->planes[plane] + y * src->stride[plane]); + const uint16_t *p_src = + (const uint16_t *)(src->planes[plane] + y * src->stride[plane]); uint16_t *p_dst = (uint16_t *)(dst->planes[plane] + y * dst->stride[plane]); for (x = 0; x < w; x++) *p_dst++ = *p_src++ >> down_shift; @@ -380,7 +381,7 @@ static void highbd_img_downshift(aom_image_t *dst, aom_image_t *src, } } -static void lowbd_img_downshift(aom_image_t *dst, aom_image_t *src, +static void lowbd_img_downshift(aom_image_t *dst, const aom_image_t *src, int down_shift) { int plane; if (dst->d_w != src->d_w || dst->d_h != src->d_h || @@ -404,8 +405,8 @@ static void lowbd_img_downshift(aom_image_t *dst, aom_image_t *src, h = (h + src->y_chroma_shift) >> src->y_chroma_shift; } for (y = 0; y < h; y++) { - uint16_t *p_src = - (uint16_t *)(src->planes[plane] + y * src->stride[plane]); + const uint16_t *p_src = + (const uint16_t *)(src->planes[plane] + y * src->stride[plane]); uint8_t *p_dst = dst->planes[plane] + y * dst->stride[plane]; for (x = 0; x < w; x++) { *p_dst++ = *p_src++ >> down_shift; @@ -414,7 +415,8 @@ static void lowbd_img_downshift(aom_image_t *dst, aom_image_t *src, } } -void aom_img_downshift(aom_image_t *dst, aom_image_t *src, int down_shift) { +void aom_img_downshift(aom_image_t *dst, const aom_image_t *src, + int down_shift) { if (dst->fmt & AOM_IMG_FMT_HIGHBITDEPTH) { highbd_img_downshift(dst, src, down_shift); } else { |