mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-07 17:26:49 +08:00
I422Rotate take stride for temporary buffers
- Minor variable name changes first/last to top/bottom - Comments explaining rotate temporary buffers usage - Add asserts for scale parameter - Use NULL and stddef.h instead of 0 - Use void * for allocation in row.h - Add () around size parameter in macros Bug: libyuv:926, libyuv:949 Change-Id: Ib55417570926ccada0a0f8abd1753dc12e5b162e Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/4136762 Reviewed-by: Wan-Teh Chang <wtc@google.com> Commit-Queue: Frank Barchard <fbarchard@chromium.org>
This commit is contained in:
parent
f8626a7224
commit
6e4b0acb4b
@ -1,6 +1,6 @@
|
||||
Name: libyuv
|
||||
URL: http://code.google.com/p/libyuv/
|
||||
Version: 1855
|
||||
Version: 1856
|
||||
License: BSD
|
||||
License File: LICENSE
|
||||
|
||||
|
||||
@ -11,7 +11,8 @@
|
||||
#ifndef INCLUDE_LIBYUV_ROW_H_
|
||||
#define INCLUDE_LIBYUV_ROW_H_
|
||||
|
||||
#include <stdlib.h> // For malloc.
|
||||
#include <stddef.h> // For NULL
|
||||
#include <stdlib.h> // For malloc
|
||||
|
||||
#include "libyuv/basic_types.h"
|
||||
|
||||
@ -829,21 +830,21 @@ struct YuvConstants {
|
||||
|
||||
#define IS_ALIGNED(p, a) (!((uintptr_t)(p) & ((a)-1)))
|
||||
|
||||
#define align_buffer_64(var, size) \
|
||||
uint8_t* var##_mem = (uint8_t*)(malloc((size) + 63)); /* NOLINT */ \
|
||||
uint8_t* var = (uint8_t*)(((intptr_t)(var##_mem) + 63) & ~63) /* NOLINT */
|
||||
#define align_buffer_64(var, size) \
|
||||
void* var##_mem = malloc((size) + 63); /* NOLINT */ \
|
||||
uint8_t* var = (uint8_t*)(((intptr_t)var##_mem + 63) & ~63) /* NOLINT */
|
||||
|
||||
#define free_aligned_buffer_64(var) \
|
||||
free(var##_mem); \
|
||||
var = 0
|
||||
var = NULL
|
||||
|
||||
#define align_buffer_64_16(var, size) \
|
||||
uint8_t* var##_mem = (uint8_t*)(malloc((size * 2) + 63)); /* NOLINT */ \
|
||||
uint16_t* var = (uint16_t*)(((intptr_t)(var##_mem) + 63) & ~63) /* NOLINT */
|
||||
#define align_buffer_64_16(var, size) \
|
||||
void* var##_mem = malloc((size)*2 + 63); /* NOLINT */ \
|
||||
uint16_t* var = (uint16_t*)(((intptr_t)var##_mem + 63) & ~63) /* NOLINT */
|
||||
|
||||
#define free_aligned_buffer_64_16(var) \
|
||||
free(var##_mem); \
|
||||
var = 0
|
||||
var = NULL
|
||||
|
||||
#if defined(__APPLE__) || defined(__x86_64__) || defined(__llvm__)
|
||||
#define OMITFP
|
||||
|
||||
@ -885,7 +885,7 @@ int I422ToNV21(const uint8_t* src_y,
|
||||
int y;
|
||||
void (*MergeUVRow)(const uint8_t* src_u, const uint8_t* src_v,
|
||||
uint8_t* dst_uv, int width) = MergeUVRow_C;
|
||||
void (*InterpolateRow)(uint8_t * dst_ptr, const uint8_t* src_ptr,
|
||||
void (*InterpolateRow)(uint8_t* dst_ptr, const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride, int dst_width,
|
||||
int source_y_fraction) = InterpolateRow_C;
|
||||
int halfwidth = (width + 1) >> 1;
|
||||
|
||||
@ -333,7 +333,7 @@ int I210Copy(const uint16_t* src_y,
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Copy I444.
|
||||
// Copy I410.
|
||||
LIBYUV_API
|
||||
int I410Copy(const uint16_t* src_y,
|
||||
int src_stride_y,
|
||||
@ -3243,7 +3243,7 @@ void SetPlane(uint8_t* dst_y,
|
||||
int height,
|
||||
uint32_t value) {
|
||||
int y;
|
||||
void (*SetRow)(uint8_t * dst, uint8_t value, int width) = SetRow_C;
|
||||
void (*SetRow)(uint8_t* dst, uint8_t value, int width) = SetRow_C;
|
||||
|
||||
if (width <= 0 || height == 0) {
|
||||
return;
|
||||
@ -3344,7 +3344,7 @@ int ARGBRect(uint8_t* dst_argb,
|
||||
int height,
|
||||
uint32_t value) {
|
||||
int y;
|
||||
void (*ARGBSetRow)(uint8_t * dst_argb, uint32_t value, int width) =
|
||||
void (*ARGBSetRow)(uint8_t* dst_argb, uint32_t value, int width) =
|
||||
ARGBSetRow_C;
|
||||
if (!dst_argb || width <= 0 || height == 0 || dst_x < 0 || dst_y < 0) {
|
||||
return -1;
|
||||
@ -3649,7 +3649,7 @@ int ARGBSepia(uint8_t* dst_argb,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*ARGBSepiaRow)(uint8_t * dst_argb, int width) = ARGBSepiaRow_C;
|
||||
void (*ARGBSepiaRow)(uint8_t* dst_argb, int width) = ARGBSepiaRow_C;
|
||||
uint8_t* dst = dst_argb + dst_y * dst_stride_argb + dst_x * 4;
|
||||
if (!dst_argb || width <= 0 || height <= 0 || dst_x < 0 || dst_y < 0) {
|
||||
return -1;
|
||||
@ -3792,7 +3792,7 @@ int ARGBColorTable(uint8_t* dst_argb,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*ARGBColorTableRow)(uint8_t * dst_argb, const uint8_t* table_argb,
|
||||
void (*ARGBColorTableRow)(uint8_t* dst_argb, const uint8_t* table_argb,
|
||||
int width) = ARGBColorTableRow_C;
|
||||
uint8_t* dst = dst_argb + dst_y * dst_stride_argb + dst_x * 4;
|
||||
if (!dst_argb || !table_argb || width <= 0 || height <= 0 || dst_x < 0 ||
|
||||
@ -3828,7 +3828,7 @@ int RGBColorTable(uint8_t* dst_argb,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*RGBColorTableRow)(uint8_t * dst_argb, const uint8_t* table_argb,
|
||||
void (*RGBColorTableRow)(uint8_t* dst_argb, const uint8_t* table_argb,
|
||||
int width) = RGBColorTableRow_C;
|
||||
uint8_t* dst = dst_argb + dst_y * dst_stride_argb + dst_x * 4;
|
||||
if (!dst_argb || !table_argb || width <= 0 || height <= 0 || dst_x < 0 ||
|
||||
@ -3873,7 +3873,7 @@ int ARGBQuantize(uint8_t* dst_argb,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
void (*ARGBQuantizeRow)(uint8_t * dst_argb, int scale, int interval_size,
|
||||
void (*ARGBQuantizeRow)(uint8_t* dst_argb, int scale, int interval_size,
|
||||
int interval_offset, int width) = ARGBQuantizeRow_C;
|
||||
uint8_t* dst = dst_argb + dst_y * dst_stride_argb + dst_x * 4;
|
||||
if (!dst_argb || width <= 0 || height <= 0 || dst_x < 0 || dst_y < 0 ||
|
||||
@ -4126,7 +4126,7 @@ int InterpolatePlane(const uint8_t* src0,
|
||||
int height,
|
||||
int interpolation) {
|
||||
int y;
|
||||
void (*InterpolateRow)(uint8_t * dst_ptr, const uint8_t* src_ptr,
|
||||
void (*InterpolateRow)(uint8_t* dst_ptr, const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride, int dst_width,
|
||||
int source_y_fraction) = InterpolateRow_C;
|
||||
if (!src0 || !src1 || !dst || width <= 0 || height == 0) {
|
||||
@ -4206,7 +4206,7 @@ int InterpolatePlane_16(const uint16_t* src0,
|
||||
int height,
|
||||
int interpolation) {
|
||||
int y;
|
||||
void (*InterpolateRow_16)(uint16_t * dst_ptr, const uint16_t* src_ptr,
|
||||
void (*InterpolateRow_16)(uint16_t* dst_ptr, const uint16_t* src_ptr,
|
||||
ptrdiff_t src_stride, int dst_width,
|
||||
int source_y_fraction) = InterpolateRow_16_C;
|
||||
if (!src0 || !src1 || !dst || width <= 0 || height == 0) {
|
||||
@ -5321,7 +5321,7 @@ int UYVYToNV12(const uint8_t* src_uyvy,
|
||||
int halfwidth = (width + 1) >> 1;
|
||||
void (*SplitUVRow)(const uint8_t* src_uv, uint8_t* dst_u, uint8_t* dst_v,
|
||||
int width) = SplitUVRow_C;
|
||||
void (*InterpolateRow)(uint8_t * dst_ptr, const uint8_t* src_ptr,
|
||||
void (*InterpolateRow)(uint8_t* dst_ptr, const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride, int dst_width,
|
||||
int source_y_fraction) = InterpolateRow_C;
|
||||
|
||||
|
||||
@ -138,7 +138,7 @@ void RotatePlane180(const uint8_t* src,
|
||||
int dst_stride,
|
||||
int width,
|
||||
int height) {
|
||||
// Swap first and last row and mirror the content. Uses a temporary row.
|
||||
// Swap top and bottom row and mirror the content. Uses a temporary row.
|
||||
align_buffer_64(row, width);
|
||||
const uint8_t* src_bot = src + src_stride * (height - 1);
|
||||
uint8_t* dst_bot = dst + dst_stride * (height - 1);
|
||||
@ -209,9 +209,9 @@ void RotatePlane180(const uint8_t* src,
|
||||
|
||||
// Odd height will harmlessly mirror the middle row twice.
|
||||
for (y = 0; y < half_height; ++y) {
|
||||
CopyRow(src, row, width); // Copy first row into buffer
|
||||
MirrorRow(src_bot, dst, width); // Mirror last row into first row
|
||||
MirrorRow(row, dst_bot, width); // Mirror buffer into last row
|
||||
CopyRow(src, row, width); // Copy top row into buffer
|
||||
MirrorRow(src_bot, dst, width); // Mirror bottom row into top row
|
||||
MirrorRow(row, dst_bot, width); // Mirror buffer into bottom row
|
||||
src += src_stride;
|
||||
dst += dst_stride;
|
||||
src_bot -= src_stride;
|
||||
@ -531,7 +531,7 @@ static void RotatePlane180_16(const uint16_t* src,
|
||||
int dst_stride,
|
||||
int width,
|
||||
int height) {
|
||||
// Swap first and last row and mirror the content. Uses a temporary row.
|
||||
// Swap top and bottom row and mirror the content. Uses a temporary row.
|
||||
align_buffer_64_16(row, width);
|
||||
const uint16_t* src_bot = src + src_stride * (height - 1);
|
||||
uint16_t* dst_bot = dst + dst_stride * (height - 1);
|
||||
@ -540,9 +540,9 @@ static void RotatePlane180_16(const uint16_t* src,
|
||||
|
||||
// Odd height will harmlessly mirror the middle row twice.
|
||||
for (y = 0; y < half_height; ++y) {
|
||||
CopyRow_16_C(src, row, width); // Copy first row into buffer
|
||||
MirrorRow_16_C(src_bot, dst, width); // Mirror last row into first row
|
||||
MirrorRow_16_C(row, dst_bot, width); // Mirror buffer into last row
|
||||
CopyRow_16_C(src, row, width); // Copy top row into buffer
|
||||
MirrorRow_16_C(src_bot, dst, width); // Mirror bottom row into top row
|
||||
MirrorRow_16_C(row, dst_bot, width); // Mirror buffer into bottom row
|
||||
src += src_stride;
|
||||
dst += dst_stride;
|
||||
src_bot -= src_stride;
|
||||
@ -695,7 +695,7 @@ int I422Rotate(const uint8_t* src_y,
|
||||
|
||||
switch (mode) {
|
||||
case kRotate0:
|
||||
// Copy frame.
|
||||
// Copy frame
|
||||
CopyPlane(src_y, src_stride_y, dst_y, dst_stride_y, width, height);
|
||||
CopyPlane(src_u, src_stride_u, dst_u, dst_stride_u, halfwidth, height);
|
||||
CopyPlane(src_v, src_stride_v, dst_v, dst_stride_v, halfwidth, height);
|
||||
@ -1044,7 +1044,7 @@ int I210Rotate(const uint16_t* src_y,
|
||||
int halfwidth = (width + 1) >> 1;
|
||||
int halfheight = (height + 1) >> 1;
|
||||
if (!src_y || !src_u || !src_v || width <= 0 || height == 0 || !dst_y ||
|
||||
!dst_u || !dst_v || dst_stride_y < 0) {
|
||||
!dst_u || !dst_v) {
|
||||
return -1;
|
||||
}
|
||||
// Negative height means invert the image.
|
||||
@ -1060,7 +1060,7 @@ int I210Rotate(const uint16_t* src_y,
|
||||
|
||||
switch (mode) {
|
||||
case kRotate0:
|
||||
// Copy frame.
|
||||
// Copy frame
|
||||
CopyPlane_16(src_y, src_stride_y, dst_y, dst_stride_y, width, height);
|
||||
CopyPlane_16(src_u, src_stride_u, dst_u, dst_stride_u, halfwidth, height);
|
||||
CopyPlane_16(src_v, src_stride_v, dst_v, dst_stride_v, halfwidth, height);
|
||||
|
||||
@ -94,8 +94,8 @@ void TransposeUVWxH_C(const uint8_t* src,
|
||||
for (i = 0; i < width * 2; i += 2) {
|
||||
int j;
|
||||
for (j = 0; j < height; ++j) {
|
||||
dst_a[j + ((i >> 1) * dst_stride_a)] = src[i + (j * src_stride)];
|
||||
dst_b[j + ((i >> 1) * dst_stride_b)] = src[i + (j * src_stride) + 1];
|
||||
dst_a[((i >> 1) * dst_stride_a) + j] = src[i + (j * src_stride)];
|
||||
dst_b[((i >> 1) * dst_stride_b) + j] = src[i + (j * src_stride) + 1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1056,10 +1056,10 @@ void ScalePlaneBilinearDown(int src_width,
|
||||
|
||||
const int max_y = (src_height - 1) << 16;
|
||||
int j;
|
||||
void (*ScaleFilterCols)(uint8_t * dst_ptr, const uint8_t* src_ptr,
|
||||
void (*ScaleFilterCols)(uint8_t* dst_ptr, const uint8_t* src_ptr,
|
||||
int dst_width, int x, int dx) =
|
||||
(src_width >= 32768) ? ScaleFilterCols64_C : ScaleFilterCols_C;
|
||||
void (*InterpolateRow)(uint8_t * dst_ptr, const uint8_t* src_ptr,
|
||||
void (*InterpolateRow)(uint8_t* dst_ptr, const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride, int dst_width,
|
||||
int source_y_fraction) = InterpolateRow_C;
|
||||
ScaleSlope(src_width, src_height, dst_width, dst_height, filtering, &x, &y,
|
||||
@ -1179,10 +1179,10 @@ void ScalePlaneBilinearDown_16(int src_width,
|
||||
|
||||
const int max_y = (src_height - 1) << 16;
|
||||
int j;
|
||||
void (*ScaleFilterCols)(uint16_t * dst_ptr, const uint16_t* src_ptr,
|
||||
void (*ScaleFilterCols)(uint16_t* dst_ptr, const uint16_t* src_ptr,
|
||||
int dst_width, int x, int dx) =
|
||||
(src_width >= 32768) ? ScaleFilterCols64_16_C : ScaleFilterCols_16_C;
|
||||
void (*InterpolateRow)(uint16_t * dst_ptr, const uint16_t* src_ptr,
|
||||
void (*InterpolateRow)(uint16_t* dst_ptr, const uint16_t* src_ptr,
|
||||
ptrdiff_t src_stride, int dst_width,
|
||||
int source_y_fraction) = InterpolateRow_16_C;
|
||||
ScaleSlope(src_width, src_height, dst_width, dst_height, filtering, &x, &y,
|
||||
@ -1267,10 +1267,10 @@ void ScalePlaneBilinearUp(int src_width,
|
||||
int dx = 0;
|
||||
int dy = 0;
|
||||
const int max_y = (src_height - 1) << 16;
|
||||
void (*InterpolateRow)(uint8_t * dst_ptr, const uint8_t* src_ptr,
|
||||
void (*InterpolateRow)(uint8_t* dst_ptr, const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride, int dst_width,
|
||||
int source_y_fraction) = InterpolateRow_C;
|
||||
void (*ScaleFilterCols)(uint8_t * dst_ptr, const uint8_t* src_ptr,
|
||||
void (*ScaleFilterCols)(uint8_t* dst_ptr, const uint8_t* src_ptr,
|
||||
int dst_width, int x, int dx) =
|
||||
filtering ? ScaleFilterCols_C : ScaleCols_C;
|
||||
ScaleSlope(src_width, src_height, dst_width, dst_height, filtering, &x, &y,
|
||||
@ -1735,10 +1735,10 @@ void ScalePlaneBilinearUp_16(int src_width,
|
||||
int dx = 0;
|
||||
int dy = 0;
|
||||
const int max_y = (src_height - 1) << 16;
|
||||
void (*InterpolateRow)(uint16_t * dst_ptr, const uint16_t* src_ptr,
|
||||
void (*InterpolateRow)(uint16_t* dst_ptr, const uint16_t* src_ptr,
|
||||
ptrdiff_t src_stride, int dst_width,
|
||||
int source_y_fraction) = InterpolateRow_16_C;
|
||||
void (*ScaleFilterCols)(uint16_t * dst_ptr, const uint16_t* src_ptr,
|
||||
void (*ScaleFilterCols)(uint16_t* dst_ptr, const uint16_t* src_ptr,
|
||||
int dst_width, int x, int dx) =
|
||||
filtering ? ScaleFilterCols_16_C : ScaleCols_16_C;
|
||||
ScaleSlope(src_width, src_height, dst_width, dst_height, filtering, &x, &y,
|
||||
@ -1863,7 +1863,7 @@ static void ScalePlaneSimple(int src_width,
|
||||
const uint8_t* src_ptr,
|
||||
uint8_t* dst_ptr) {
|
||||
int i;
|
||||
void (*ScaleCols)(uint8_t * dst_ptr, const uint8_t* src_ptr, int dst_width,
|
||||
void (*ScaleCols)(uint8_t* dst_ptr, const uint8_t* src_ptr, int dst_width,
|
||||
int x, int dx) = ScaleCols_C;
|
||||
// Initial source x/y coordinate and step values as 16.16 fixed point.
|
||||
int x = 0;
|
||||
@ -1900,7 +1900,7 @@ static void ScalePlaneSimple_16(int src_width,
|
||||
const uint16_t* src_ptr,
|
||||
uint16_t* dst_ptr) {
|
||||
int i;
|
||||
void (*ScaleCols)(uint16_t * dst_ptr, const uint16_t* src_ptr, int dst_width,
|
||||
void (*ScaleCols)(uint16_t* dst_ptr, const uint16_t* src_ptr, int dst_width,
|
||||
int x, int dx) = ScaleCols_16_C;
|
||||
// Initial source x/y coordinate and step values as 16.16 fixed point.
|
||||
int x = 0;
|
||||
|
||||
@ -289,10 +289,10 @@ static void ScaleARGBBilinearDown(int src_width,
|
||||
int dy,
|
||||
enum FilterMode filtering) {
|
||||
int j;
|
||||
void (*InterpolateRow)(uint8_t * dst_argb, const uint8_t* src_argb,
|
||||
void (*InterpolateRow)(uint8_t* dst_argb, const uint8_t* src_argb,
|
||||
ptrdiff_t src_stride, int dst_width,
|
||||
int source_y_fraction) = InterpolateRow_C;
|
||||
void (*ScaleARGBFilterCols)(uint8_t * dst_argb, const uint8_t* src_argb,
|
||||
void (*ScaleARGBFilterCols)(uint8_t* dst_argb, const uint8_t* src_argb,
|
||||
int dst_width, int x, int dx) =
|
||||
(src_width >= 32768) ? ScaleARGBFilterCols64_C : ScaleARGBFilterCols_C;
|
||||
int64_t xlast = x + (int64_t)(dst_width - 1) * dx;
|
||||
@ -421,10 +421,10 @@ static void ScaleARGBBilinearUp(int src_width,
|
||||
int dy,
|
||||
enum FilterMode filtering) {
|
||||
int j;
|
||||
void (*InterpolateRow)(uint8_t * dst_argb, const uint8_t* src_argb,
|
||||
void (*InterpolateRow)(uint8_t* dst_argb, const uint8_t* src_argb,
|
||||
ptrdiff_t src_stride, int dst_width,
|
||||
int source_y_fraction) = InterpolateRow_C;
|
||||
void (*ScaleARGBFilterCols)(uint8_t * dst_argb, const uint8_t* src_argb,
|
||||
void (*ScaleARGBFilterCols)(uint8_t* dst_argb, const uint8_t* src_argb,
|
||||
int dst_width, int x, int dx) =
|
||||
filtering ? ScaleARGBFilterCols_C : ScaleARGBCols_C;
|
||||
const int max_y = (src_height - 1) << 16;
|
||||
@ -668,7 +668,7 @@ static void ScaleYUVToARGBBilinearUp(int src_width,
|
||||
}
|
||||
#endif
|
||||
|
||||
void (*InterpolateRow)(uint8_t * dst_argb, const uint8_t* src_argb,
|
||||
void (*InterpolateRow)(uint8_t* dst_argb, const uint8_t* src_argb,
|
||||
ptrdiff_t src_stride, int dst_width,
|
||||
int source_y_fraction) = InterpolateRow_C;
|
||||
#if defined(HAS_INTERPOLATEROW_SSSE3)
|
||||
@ -712,7 +712,7 @@ static void ScaleYUVToARGBBilinearUp(int src_width,
|
||||
}
|
||||
#endif
|
||||
|
||||
void (*ScaleARGBFilterCols)(uint8_t * dst_argb, const uint8_t* src_argb,
|
||||
void (*ScaleARGBFilterCols)(uint8_t* dst_argb, const uint8_t* src_argb,
|
||||
int dst_width, int x, int dx) =
|
||||
filtering ? ScaleARGBFilterCols_C : ScaleARGBCols_C;
|
||||
if (src_width >= 32768) {
|
||||
@ -883,7 +883,7 @@ static void ScaleARGBSimple(int src_width,
|
||||
int y,
|
||||
int dy) {
|
||||
int j;
|
||||
void (*ScaleARGBCols)(uint8_t * dst_argb, const uint8_t* src_argb,
|
||||
void (*ScaleARGBCols)(uint8_t* dst_argb, const uint8_t* src_argb,
|
||||
int dst_width, int x, int dx) =
|
||||
(src_width >= 32768) ? ScaleARGBCols64_C : ScaleARGBCols_C;
|
||||
(void)src_height;
|
||||
|
||||
@ -145,6 +145,8 @@ void ScaleRowDown2Linear_16To8_C(const uint16_t* src_ptr,
|
||||
const uint16_t* s = src_ptr;
|
||||
int x;
|
||||
(void)src_stride;
|
||||
assert(scale >= 256);
|
||||
assert(scale <= 32768);
|
||||
for (x = 0; x < dst_width - 1; x += 2) {
|
||||
dst[0] = STATIC_CAST(uint8_t, C16TO8((s[0] + s[1] + 1) >> 1, scale));
|
||||
dst[1] = STATIC_CAST(uint8_t, C16TO8((s[2] + s[3] + 1) >> 1, scale));
|
||||
@ -226,6 +228,8 @@ void ScaleRowDown2Box_16To8_C(const uint16_t* src_ptr,
|
||||
const uint16_t* s = src_ptr;
|
||||
const uint16_t* t = src_ptr + src_stride;
|
||||
int x;
|
||||
assert(scale >= 256);
|
||||
assert(scale <= 32768);
|
||||
for (x = 0; x < dst_width - 1; x += 2) {
|
||||
dst[0] = STATIC_CAST(uint8_t,
|
||||
C16TO8((s[0] + s[1] + t[0] + t[1] + 2) >> 2, scale));
|
||||
@ -1550,7 +1554,7 @@ void ScalePlaneVertical(int src_height,
|
||||
enum FilterMode filtering) {
|
||||
// TODO(fbarchard): Allow higher bpp.
|
||||
int dst_width_bytes = dst_width * bpp;
|
||||
void (*InterpolateRow)(uint8_t * dst_argb, const uint8_t* src_argb,
|
||||
void (*InterpolateRow)(uint8_t* dst_argb, const uint8_t* src_argb,
|
||||
ptrdiff_t src_stride, int dst_width,
|
||||
int source_y_fraction) = InterpolateRow_C;
|
||||
const int max_y = (src_height > 1) ? ((src_height - 1) << 16) - 1 : 0;
|
||||
@ -1629,7 +1633,7 @@ void ScalePlaneVertical_16(int src_height,
|
||||
enum FilterMode filtering) {
|
||||
// TODO(fbarchard): Allow higher wpp.
|
||||
int dst_width_words = dst_width * wpp;
|
||||
void (*InterpolateRow)(uint16_t * dst_argb, const uint16_t* src_argb,
|
||||
void (*InterpolateRow)(uint16_t* dst_argb, const uint16_t* src_argb,
|
||||
ptrdiff_t src_stride, int dst_width,
|
||||
int source_y_fraction) = InterpolateRow_16_C;
|
||||
const int max_y = (src_height > 1) ? ((src_height - 1) << 16) - 1 : 0;
|
||||
@ -1708,7 +1712,7 @@ void ScalePlaneVertical_16To8(int src_height,
|
||||
// TODO(fbarchard): Allow higher wpp.
|
||||
int dst_width_words = dst_width * wpp;
|
||||
// TODO(https://crbug.com/libyuv/931): Add NEON 32 bit and AVX2 versions.
|
||||
void (*InterpolateRow_16To8)(uint8_t * dst_argb, const uint16_t* src_argb,
|
||||
void (*InterpolateRow_16To8)(uint8_t* dst_argb, const uint16_t* src_argb,
|
||||
ptrdiff_t src_stride, int scale, int dst_width,
|
||||
int source_y_fraction) = InterpolateRow_16To8_C;
|
||||
const int max_y = (src_height > 1) ? ((src_height - 1) << 16) - 1 : 0;
|
||||
|
||||
@ -338,10 +338,10 @@ static void ScaleUVBilinearDown(int src_width,
|
||||
int dy,
|
||||
enum FilterMode filtering) {
|
||||
int j;
|
||||
void (*InterpolateRow)(uint8_t * dst_uv, const uint8_t* src_uv,
|
||||
void (*InterpolateRow)(uint8_t* dst_uv, const uint8_t* src_uv,
|
||||
ptrdiff_t src_stride, int dst_width,
|
||||
int source_y_fraction) = InterpolateRow_C;
|
||||
void (*ScaleUVFilterCols)(uint8_t * dst_uv, const uint8_t* src_uv,
|
||||
void (*ScaleUVFilterCols)(uint8_t* dst_uv, const uint8_t* src_uv,
|
||||
int dst_width, int x, int dx) =
|
||||
(src_width >= 32768) ? ScaleUVFilterCols64_C : ScaleUVFilterCols_C;
|
||||
int64_t xlast = x + (int64_t)(dst_width - 1) * dx;
|
||||
@ -464,10 +464,10 @@ static void ScaleUVBilinearUp(int src_width,
|
||||
int dy,
|
||||
enum FilterMode filtering) {
|
||||
int j;
|
||||
void (*InterpolateRow)(uint8_t * dst_uv, const uint8_t* src_uv,
|
||||
void (*InterpolateRow)(uint8_t* dst_uv, const uint8_t* src_uv,
|
||||
ptrdiff_t src_stride, int dst_width,
|
||||
int source_y_fraction) = InterpolateRow_C;
|
||||
void (*ScaleUVFilterCols)(uint8_t * dst_uv, const uint8_t* src_uv,
|
||||
void (*ScaleUVFilterCols)(uint8_t* dst_uv, const uint8_t* src_uv,
|
||||
int dst_width, int x, int dx) =
|
||||
filtering ? ScaleUVFilterCols_C : ScaleUVCols_C;
|
||||
const int max_y = (src_height - 1) << 16;
|
||||
@ -854,7 +854,7 @@ static void ScaleUVSimple(int src_width,
|
||||
int y,
|
||||
int dy) {
|
||||
int j;
|
||||
void (*ScaleUVCols)(uint8_t * dst_uv, const uint8_t* src_uv, int dst_width,
|
||||
void (*ScaleUVCols)(uint8_t* dst_uv, const uint8_t* src_uv, int dst_width,
|
||||
int x, int dx) =
|
||||
(src_width >= 32768) ? ScaleUVCols64_C : ScaleUVCols_C;
|
||||
(void)src_height;
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
#ifndef UNIT_TEST_UNIT_TEST_H_ // NOLINT
|
||||
#define UNIT_TEST_UNIT_TEST_H_
|
||||
|
||||
#include <stddef.h> // For NULL
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
#else
|
||||
@ -76,19 +77,18 @@ static inline bool SizeValid(int src_width,
|
||||
|
||||
#define free_aligned_buffer_page_end(var) \
|
||||
free(var##_mem); \
|
||||
var = 0
|
||||
var = NULL
|
||||
|
||||
#define align_buffer_page_end_16(var, size) \
|
||||
uint8_t* var##_mem = \
|
||||
reinterpret_cast<uint8_t*>(malloc(((size * 2) + 4095 + 63) & ~4095)); \
|
||||
reinterpret_cast<uint8_t*>(malloc(((size)*2 + 4095 + 63) & ~4095)); \
|
||||
uint16_t* var = reinterpret_cast<uint16_t*>( \
|
||||
(intptr_t)(var##_mem + (((size * 2) + 4095 + 63) & ~4095) - \
|
||||
(size * 2)) & \
|
||||
(intptr_t)(var##_mem + (((size)*2 + 4095 + 63) & ~4095) - (size)*2) & \
|
||||
~63)
|
||||
|
||||
#define free_aligned_buffer_page_end_16(var) \
|
||||
free(var##_mem); \
|
||||
var = 0
|
||||
var = NULL
|
||||
|
||||
#ifdef WIN32
|
||||
static inline double get_time() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user