diff options
author | u3shit <u3shit@gmail.com> | 2023-02-24 21:28:16 +0100 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2023-02-26 19:41:30 +0100 |
commit | 466b7731793af0617ce403f56abad2615dc66292 (patch) | |
tree | eaae8f143b9c2a53273f91ecb80f34aa57d2f7ba /gfx | |
parent | 092ff20c60603759cab335178cf5f560ea7d6eaf (diff) | |
download | uxp-466b7731793af0617ce403f56abad2615dc66292.tar.gz |
Issue #2101 - Part 2: Use stdint.h types instead of uint8 and friends
Required for upcoming libyuv update
Diffstat (limited to 'gfx')
-rw-r--r-- | gfx/ycbcr/scale_yuv_argb.cpp | 142 | ||||
-rw-r--r-- | gfx/ycbcr/scale_yuv_argb.h | 10 | ||||
-rw-r--r-- | gfx/ycbcr/ycbcr_to_rgb565.cpp | 28 | ||||
-rw-r--r-- | gfx/ycbcr/ycbcr_to_rgb565.h | 8 | ||||
-rw-r--r-- | gfx/ycbcr/yuv_convert.cpp | 104 | ||||
-rw-r--r-- | gfx/ycbcr/yuv_convert.h | 32 | ||||
-rw-r--r-- | gfx/ycbcr/yuv_convert_arm.cpp | 14 | ||||
-rw-r--r-- | gfx/ycbcr/yuv_convert_mmx.cpp | 2 | ||||
-rw-r--r-- | gfx/ycbcr/yuv_convert_sse2.cpp | 2 | ||||
-rw-r--r-- | gfx/ycbcr/yuv_row.h | 94 | ||||
-rw-r--r-- | gfx/ycbcr/yuv_row_c.cpp | 48 | ||||
-rw-r--r-- | gfx/ycbcr/yuv_row_other.cpp | 24 | ||||
-rw-r--r-- | gfx/ycbcr/yuv_row_posix.cpp | 156 | ||||
-rw-r--r-- | gfx/ycbcr/yuv_row_table.cpp | 18 | ||||
-rw-r--r-- | gfx/ycbcr/yuv_row_win.cpp | 72 | ||||
-rw-r--r-- | gfx/ycbcr/yuv_row_win64.cpp | 82 |
16 files changed, 408 insertions, 428 deletions
diff --git a/gfx/ycbcr/scale_yuv_argb.cpp b/gfx/ycbcr/scale_yuv_argb.cpp index 13b16c8029..11f8617906 100644 --- a/gfx/ycbcr/scale_yuv_argb.cpp +++ b/gfx/ycbcr/scale_yuv_argb.cpp @@ -68,21 +68,21 @@ struct YUVBuferIter { int src_stride_y; int src_stride_u; int src_stride_v; - const uint8* src_y; - const uint8* src_u; - const uint8* src_v; + const uint8_t* src_y; + const uint8_t* src_u; + const uint8_t* src_v; - uint32 src_fourcc; + uint32_t src_fourcc; const struct YuvConstants* yuvconstants; int y_index; - const uint8* src_row_y; - const uint8* src_row_u; - const uint8* src_row_v; - - void (*YUVToARGBRow)(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, + const uint8_t* src_row_y; + const uint8_t* src_row_u; + const uint8_t* src_row_v; + + void (*YUVToARGBRow)(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, const struct YuvConstants* yuvconstants, int width); void (*MoveTo)(YUVBuferIter& iter, int y_index); @@ -202,11 +202,11 @@ static void YUVBuferIter_MoveToNextRowForI420(YUVBuferIter& iter) { iter.y_index++; } -static __inline void YUVBuferIter_ConvertToARGBRow(YUVBuferIter& iter, uint8* argb_row) { +static __inline void YUVBuferIter_ConvertToARGBRow(YUVBuferIter& iter, uint8_t* argb_row) { iter.YUVToARGBRow(iter.src_row_y, iter.src_row_u, iter.src_row_v, argb_row, iter.yuvconstants, iter.src_width); } -void YUVBuferIter_Init(YUVBuferIter& iter, uint32 src_fourcc, mozilla::YUVColorSpace yuv_color_space) { +void YUVBuferIter_Init(YUVBuferIter& iter, uint32_t src_fourcc, mozilla::YUVColorSpace yuv_color_space) { iter.src_fourcc = src_fourcc; iter.y_index = 0; iter.src_row_y = iter.src_y; @@ -243,20 +243,20 @@ static void ScaleYUVToARGBDown2(int src_width, int src_height, int src_stride_u, int src_stride_v, int dst_stride_argb, - const uint8* src_y, - const uint8* src_u, - const uint8* src_v, - uint8* dst_argb, + const uint8_t* src_y, + const uint8_t* src_u, + const uint8_t* src_v, + uint8_t* dst_argb, int x, int dx, int y, int dy, enum FilterMode filtering, - uint32 src_fourcc, + uint32_t src_fourcc, mozilla::YUVColorSpace yuv_color_space) { int j; // Allocate 2 rows of ARGB for source conversion. const int kRowSize = (src_width * 4 + 15) & ~15; align_buffer_64(argb_cnv_row, kRowSize * 2); - uint8* argb_cnv_rowptr = argb_cnv_row; + uint8_t* argb_cnv_rowptr = argb_cnv_row; int argb_cnv_rowstride = kRowSize; YUVBuferIter iter; @@ -270,8 +270,8 @@ static void ScaleYUVToARGBDown2(int src_width, int src_height, iter.src_v = src_v; YUVBuferIter_Init(iter, src_fourcc, yuv_color_space); - void (*ScaleARGBRowDown2)(const uint8* src_argb, ptrdiff_t src_stride, - uint8* dst_argb, int dst_width) = + void (*ScaleARGBRowDown2)(const uint8_t* src_argb, ptrdiff_t src_stride, + uint8_t* dst_argb, int dst_width) = filtering == kFilterNone ? ScaleARGBRowDown2_C : (filtering == kFilterLinear ? ScaleARGBRowDown2Linear_C : ScaleARGBRowDown2Box_C); @@ -380,24 +380,24 @@ static void ScaleYUVToARGBDownEven(int src_width, int src_height, int src_stride_u, int src_stride_v, int dst_stride_argb, - const uint8* src_y, - const uint8* src_u, - const uint8* src_v, - uint8* dst_argb, + const uint8_t* src_y, + const uint8_t* src_u, + const uint8_t* src_v, + uint8_t* dst_argb, int x, int dx, int y, int dy, enum FilterMode filtering, - uint32 src_fourcc, + uint32_t src_fourcc, mozilla::YUVColorSpace yuv_color_space) { int j; // Allocate 2 rows of ARGB for source conversion. const int kRowSize = (src_width * 4 + 15) & ~15; align_buffer_64(argb_cnv_row, kRowSize * 2); - uint8* argb_cnv_rowptr = argb_cnv_row; + uint8_t* argb_cnv_rowptr = argb_cnv_row; int argb_cnv_rowstride = kRowSize; int col_step = dx >> 16; - void (*ScaleARGBRowDownEven)(const uint8* src_argb, ptrdiff_t src_stride, - int src_step, uint8* dst_argb, int dst_width) = + void (*ScaleARGBRowDownEven)(const uint8_t* src_argb, ptrdiff_t src_stride, + int src_step, uint8_t* dst_argb, int dst_width) = filtering ? ScaleARGBRowDownEvenBox_C : ScaleARGBRowDownEven_C; assert(IS_ALIGNED(src_width, 2)); assert(IS_ALIGNED(src_height, 2)); @@ -501,24 +501,24 @@ static void ScaleYUVToARGBBilinearDown(int src_width, int src_height, int src_stride_u, int src_stride_v, int dst_stride_argb, - const uint8* src_y, - const uint8* src_u, - const uint8* src_v, - uint8* dst_argb, + const uint8_t* src_y, + const uint8_t* src_u, + const uint8_t* src_v, + uint8_t* dst_argb, int x, int dx, int y, int dy, enum FilterMode filtering, - uint32 src_fourcc, + uint32_t src_fourcc, mozilla::YUVColorSpace yuv_color_space) { int j; - void (*InterpolateRow)(uint8* dst_argb, const uint8* 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* dst_argb, const uint8* 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 xlast = x + (int64)(dst_width - 1) * dx; - int64 xl = (dx >= 0) ? x : xlast; - int64 xr = (dx >= 0) ? xlast : x; + int64_t xlast = x + (int64_t)(dst_width - 1) * dx; + int64_t xl = (dx >= 0) ? x : xlast; + int64_t xr = (dx >= 0) ? xlast : x; int clip_src_width; xl = (xl >> 16) & ~3; // Left edge aligned. xr = (xr >> 16) + 1; // Right most pixel used. Bilinear uses 2 pixels. @@ -533,7 +533,7 @@ static void ScaleYUVToARGBBilinearDown(int src_width, int src_height, // Allocate 2 row of ARGB for source conversion. const int kRowSize = (src_width * 4 + 15) & ~15; align_buffer_64(argb_cnv_row, kRowSize * 2); - uint8* argb_cnv_rowptr = argb_cnv_row; + uint8_t* argb_cnv_rowptr = argb_cnv_row; int argb_cnv_rowstride = kRowSize; #if defined(HAS_INTERPOLATEROW_SSSE3) @@ -670,19 +670,19 @@ static void ScaleYUVToARGBBilinearUp(int src_width, int src_height, int src_stride_u, int src_stride_v, int dst_stride_argb, - const uint8* src_y, - const uint8* src_u, - const uint8* src_v, - uint8* dst_argb, + const uint8_t* src_y, + const uint8_t* src_u, + const uint8_t* src_v, + uint8_t* dst_argb, int x, int dx, int y, int dy, enum FilterMode filtering, - uint32 src_fourcc, + uint32_t src_fourcc, mozilla::YUVColorSpace yuv_color_space) { int j; - void (*InterpolateRow)(uint8* dst_argb, const uint8* 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* dst_argb, const uint8* 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; @@ -781,7 +781,7 @@ static void ScaleYUVToARGBBilinearUp(int src_width, int src_height, const int kRowSize = (dst_width * 4 + 15) & ~15; align_buffer_64(row, kRowSize * 2); - uint8* rowptr = row; + uint8_t* rowptr = row; int rowstride = kRowSize; int lastyi = yi; @@ -855,15 +855,15 @@ static void ScaleYUVToARGBSimple(int src_width, int src_height, int src_stride_u, int src_stride_v, int dst_stride_argb, - const uint8* src_y, - const uint8* src_u, - const uint8* src_v, - uint8* dst_argb, + const uint8_t* src_y, + const uint8_t* src_u, + const uint8_t* src_v, + uint8_t* dst_argb, int x, int dx, int y, int dy, - uint32 src_fourcc, + uint32_t src_fourcc, mozilla::YUVColorSpace yuv_color_space) { int j; - void (*ScaleARGBCols)(uint8* dst_argb, const uint8* 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; @@ -923,13 +923,13 @@ static void ScaleYUVToARGBSimple(int src_width, int src_height, free_aligned_buffer_64(argb_cnv_row); } -static void YUVToARGBCopy(const uint8* src_y, int src_stride_y, - const uint8* src_u, int src_stride_u, - const uint8* src_v, int src_stride_v, +static void YUVToARGBCopy(const uint8_t* src_y, int src_stride_y, + const uint8_t* src_u, int src_stride_u, + const uint8_t* src_v, int src_stride_v, int src_width, int src_height, - uint8* dst_argb, int dst_stride_argb, + uint8_t* dst_argb, int dst_stride_argb, int dst_width, int dst_height, - uint32 src_fourcc, + uint32_t src_fourcc, mozilla::YUVColorSpace yuv_color_space) { YUVBuferIter iter; @@ -950,14 +950,14 @@ static void YUVToARGBCopy(const uint8* src_y, int src_stride_y, } } -static void ScaleYUVToARGB(const uint8* src_y, int src_stride_y, - const uint8* src_u, int src_stride_u, - const uint8* src_v, int src_stride_v, +static void ScaleYUVToARGB(const uint8_t* src_y, int src_stride_y, + const uint8_t* src_u, int src_stride_u, + const uint8_t* src_v, int src_stride_v, int src_width, int src_height, - uint8* dst_argb, int dst_stride_argb, + uint8_t* dst_argb, int dst_stride_argb, int dst_width, int dst_height, enum FilterMode filtering, - uint32 src_fourcc, + uint32_t src_fourcc, mozilla::YUVColorSpace yuv_color_space) { // Initial source x/y coordinate and step values as 16.16 fixed point. @@ -1081,7 +1081,7 @@ static void ScaleYUVToARGB(const uint8* src_y, int src_stride_y, yuv_color_space); } -bool IsConvertSupported(uint32 src_fourcc) +bool IsConvertSupported(uint32_t src_fourcc) { if (src_fourcc == FOURCC_I444 || src_fourcc == FOURCC_I422 || @@ -1092,13 +1092,13 @@ bool IsConvertSupported(uint32 src_fourcc) } LIBYUV_API -int YUVToARGBScale(const uint8* src_y, int src_stride_y, - const uint8* src_u, int src_stride_u, - const uint8* src_v, int src_stride_v, - uint32 src_fourcc, +int YUVToARGBScale(const uint8_t* src_y, int src_stride_y, + const uint8_t* src_u, int src_stride_u, + const uint8_t* src_v, int src_stride_v, + uint32_t src_fourcc, mozilla::YUVColorSpace yuv_color_space, int src_width, int src_height, - uint8* dst_argb, int dst_stride_argb, + uint8_t* dst_argb, int dst_stride_argb, int dst_width, int dst_height, enum FilterMode filtering) { diff --git a/gfx/ycbcr/scale_yuv_argb.h b/gfx/ycbcr/scale_yuv_argb.h index d1a42db1b3..25b7db04b5 100644 --- a/gfx/ycbcr/scale_yuv_argb.h +++ b/gfx/ycbcr/scale_yuv_argb.h @@ -21,13 +21,13 @@ namespace libyuv { extern "C" { #endif -int YUVToARGBScale(const uint8* src_y, int src_stride_y, - const uint8* src_u, int src_stride_u, - const uint8* src_v, int src_stride_v, - uint32 src_fourcc, +int YUVToARGBScale(const uint8_t* src_y, int src_stride_y, + const uint8_t* src_u, int src_stride_u, + const uint8_t* src_v, int src_stride_v, + uint32_t src_fourcc, mozilla::YUVColorSpace yuv_color_space, int src_width, int src_height, - uint8* dst_argb, int dst_stride_argb, + uint8_t* dst_argb, int dst_stride_argb, int dst_width, int dst_height, enum FilterMode filtering); diff --git a/gfx/ycbcr/ycbcr_to_rgb565.cpp b/gfx/ycbcr/ycbcr_to_rgb565.cpp index 0572e3e094..fe28245a9c 100644 --- a/gfx/ycbcr/ycbcr_to_rgb565.cpp +++ b/gfx/ycbcr/ycbcr_to_rgb565.cpp @@ -71,10 +71,10 @@ typedef void (*yuv2rgb565_row_scale_nearest_func)( extern "C" void ScaleYCbCr42xToRGB565_BilinearY_Row_NEON( const yuv2rgb565_row_scale_bilinear_ctx *ctx, int dither); -void __attribute((noinline)) yuv42x_to_rgb565_row_neon(uint16 *dst, - const uint8 *y, - const uint8 *u, - const uint8 *v, +void __attribute((noinline)) yuv42x_to_rgb565_row_neon(uint16_t *dst, + const uint8_t *y, + const uint8_t *u, + const uint8_t *v, int n, int oddflag); @@ -581,10 +581,10 @@ bool IsScaleYCbCrToRGB565Fast(int source_x0, -void yuv_to_rgb565_row_c(uint16 *dst, - const uint8 *y, - const uint8 *u, - const uint8 *v, +void yuv_to_rgb565_row_c(uint16_t *dst, + const uint8_t *y, + const uint8_t *u, + const uint8_t *v, int x_shift, int pic_x, int pic_width) @@ -599,10 +599,10 @@ void yuv_to_rgb565_row_c(uint16 *dst, } } -void ConvertYCbCrToRGB565(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void ConvertYCbCrToRGB565(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int pic_x, int pic_y, int pic_width, @@ -625,7 +625,7 @@ void ConvertYCbCrToRGB565(const uint8* y_buf, int uvoffs; yoffs = y_pitch * (pic_y+i) + pic_x; uvoffs = uv_pitch * ((pic_y+i)>>y_shift) + (pic_x>>x_shift); - yuv42x_to_rgb565_row_neon((uint16*)(rgb_buf + rgb_pitch * i), + yuv42x_to_rgb565_row_neon((uint16_t*)(rgb_buf + rgb_pitch * i), y_buf + yoffs, u_buf + uvoffs, v_buf + uvoffs, @@ -641,7 +641,7 @@ void ConvertYCbCrToRGB565(const uint8* y_buf, int uvoffs; yoffs = y_pitch * (pic_y+i); uvoffs = uv_pitch * ((pic_y+i)>>y_shift); - yuv_to_rgb565_row_c((uint16*)(rgb_buf + rgb_pitch * i), + yuv_to_rgb565_row_c((uint16_t*)(rgb_buf + rgb_pitch * i), y_buf + yoffs, u_buf + uvoffs, v_buf + uvoffs, diff --git a/gfx/ycbcr/ycbcr_to_rgb565.h b/gfx/ycbcr/ycbcr_to_rgb565.h index 41272223be..4351660253 100644 --- a/gfx/ycbcr/ycbcr_to_rgb565.h +++ b/gfx/ycbcr/ycbcr_to_rgb565.h @@ -17,10 +17,10 @@ namespace gfx { #ifdef HAVE_YCBCR_TO_RGB565 // Convert a frame of YUV to 16 bit RGB565. -void ConvertYCbCrToRGB565(const uint8* yplane, - const uint8* uplane, - const uint8* vplane, - uint8* rgbframe, +void ConvertYCbCrToRGB565(const uint8_t* yplane, + const uint8_t* uplane, + const uint8_t* vplane, + uint8_t* rgbframe, int pic_x, int pic_y, int pic_width, diff --git a/gfx/ycbcr/yuv_convert.cpp b/gfx/ycbcr/yuv_convert.cpp index fae2c7df69..e695509288 100644 --- a/gfx/ycbcr/yuv_convert.cpp +++ b/gfx/ycbcr/yuv_convert.cpp @@ -82,10 +82,10 @@ void GBRPlanarToARGB(const uint8_t* src_y, int y_pitch, } // Convert a frame of YUV to 32 bit ARGB. -void ConvertYCbCrToRGB32(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void ConvertYCbCrToRGB32(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int pic_x, int pic_y, int pic_width, @@ -119,11 +119,11 @@ void ConvertYCbCrToRGB32(const uint8* y_buf, y_pitch, uv_pitch, rgb_pitch, yuv_type); return; } - + if (yuv_type == YV24) { - const uint8* src_y = y_buf + y_pitch * pic_y + pic_x; - const uint8* src_u = u_buf + uv_pitch * pic_y + pic_x; - const uint8* src_v = v_buf + uv_pitch * pic_y + pic_x; + const uint8_t* src_y = y_buf + y_pitch * pic_y + pic_x; + const uint8_t* src_u = u_buf + uv_pitch * pic_y + pic_x; + const uint8_t* src_v = v_buf + uv_pitch * pic_y + pic_x; if (yuv_color_space == YUVColorSpace::IDENTITY) { // Special case for RGB image GBRPlanarToARGB(src_y, y_pitch, src_u, uv_pitch, src_v, uv_pitch, @@ -138,9 +138,9 @@ void ConvertYCbCrToRGB32(const uint8* y_buf, MOZ_ASSERT(!err); } } else if (yuv_type == YV16) { - const uint8* src_y = y_buf + y_pitch * pic_y + pic_x; - const uint8* src_u = u_buf + uv_pitch * pic_y + pic_x / 2; - const uint8* src_v = v_buf + uv_pitch * pic_y + pic_x / 2; + const uint8_t* src_y = y_buf + y_pitch * pic_y + pic_x; + const uint8_t* src_u = u_buf + uv_pitch * pic_y + pic_x / 2; + const uint8_t* src_v = v_buf + uv_pitch * pic_y + pic_x / 2; DebugOnly<int> err = libyuv::I422ToARGB(src_y, y_pitch, src_u, uv_pitch, src_v, uv_pitch, @@ -149,9 +149,9 @@ void ConvertYCbCrToRGB32(const uint8* y_buf, MOZ_ASSERT(!err); } else { MOZ_ASSERT(yuv_type == YV12); - const uint8* src_y = y_buf + y_pitch * pic_y + pic_x; - const uint8* src_u = u_buf + (uv_pitch * pic_y + pic_x) / 2; - const uint8* src_v = v_buf + (uv_pitch * pic_y + pic_x) / 2; + const uint8_t* src_y = y_buf + y_pitch * pic_y + pic_x; + const uint8_t* src_u = u_buf + (uv_pitch * pic_y + pic_x) / 2; + const uint8_t* src_v = v_buf + (uv_pitch * pic_y + pic_x) / 2; if (yuv_color_space == YUVColorSpace::BT709) { DebugOnly<int> err = libyuv::H420ToARGB(src_y, y_pitch, src_u, uv_pitch, @@ -172,10 +172,10 @@ void ConvertYCbCrToRGB32(const uint8* y_buf, } // Convert a frame of YUV to 32 bit ARGB. -void ConvertYCbCrToRGB32_deprecated(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void ConvertYCbCrToRGB32_deprecated(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int pic_x, int pic_y, int pic_width, @@ -195,10 +195,10 @@ void ConvertYCbCrToRGB32_deprecated(const uint8* y_buf, int x_width = odd_pic_x ? pic_width - 1 : pic_width; for (int y = pic_y; y < pic_height + pic_y; ++y) { - uint8* rgb_row = rgb_buf + (y - pic_y) * rgb_pitch; - const uint8* y_ptr = y_buf + y * y_pitch + pic_x; - const uint8* u_ptr = u_buf + (y >> y_shift) * uv_pitch + (pic_x >> x_shift); - const uint8* v_ptr = v_buf + (y >> y_shift) * uv_pitch + (pic_x >> x_shift); + uint8_t* rgb_row = rgb_buf + (y - pic_y) * rgb_pitch; + const uint8_t* y_ptr = y_buf + y * y_pitch + pic_x; + const uint8_t* u_ptr = u_buf + (y >> y_shift) * uv_pitch + (pic_x >> x_shift); + const uint8_t* v_ptr = v_buf + (y >> y_shift) * uv_pitch + (pic_x >> x_shift); if (odd_pic_x) { // Handle the single odd pixel manually and use the @@ -235,11 +235,11 @@ void ConvertYCbCrToRGB32_deprecated(const uint8* y_buf, } // C version does 8 at a time to mimic MMX code -static void FilterRows_C(uint8* ybuf, const uint8* y0_ptr, const uint8* y1_ptr, +static void FilterRows_C(uint8_t* ybuf, const uint8_t* y0_ptr, const uint8_t* y1_ptr, int source_width, int source_y_fraction) { int y1_fraction = source_y_fraction; int y0_fraction = 256 - y1_fraction; - uint8* end = ybuf + source_width; + uint8_t* end = ybuf + source_width; do { ybuf[0] = (y0_ptr[0] * y0_fraction + y1_ptr[0] * y1_fraction) >> 8; ybuf[1] = (y0_ptr[1] * y0_fraction + y1_ptr[1] * y1_fraction) >> 8; @@ -256,17 +256,17 @@ static void FilterRows_C(uint8* ybuf, const uint8* y0_ptr, const uint8* y1_ptr, } #ifdef MOZILLA_MAY_SUPPORT_MMX -void FilterRows_MMX(uint8* ybuf, const uint8* y0_ptr, const uint8* y1_ptr, +void FilterRows_MMX(uint8_t* ybuf, const uint8_t* y0_ptr, const uint8_t* y1_ptr, int source_width, int source_y_fraction); #endif #ifdef MOZILLA_MAY_SUPPORT_SSE2 -void FilterRows_SSE2(uint8* ybuf, const uint8* y0_ptr, const uint8* y1_ptr, +void FilterRows_SSE2(uint8_t* ybuf, const uint8_t* y0_ptr, const uint8_t* y1_ptr, int source_width, int source_y_fraction); #endif -static inline void FilterRows(uint8* ybuf, const uint8* y0_ptr, - const uint8* y1_ptr, int source_width, +static inline void FilterRows(uint8_t* ybuf, const uint8_t* y0_ptr, + const uint8_t* y1_ptr, int source_width, int source_y_fraction) { #ifdef MOZILLA_MAY_SUPPORT_SSE2 if (mozilla::supports_sse2()) { @@ -287,10 +287,10 @@ static inline void FilterRows(uint8* ybuf, const uint8* y0_ptr, // Scale a frame of YUV to 32 bit ARGB. -void ScaleYCbCrToRGB32(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void ScaleYCbCrToRGB32(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int source_width, int source_height, int width, @@ -327,7 +327,7 @@ void ScaleYCbCrToRGB32(const uint8* y_buf, } if (yuv_type == YV24 && yuv_color_space == YUVColorSpace::IDENTITY) { - auto buffer = MakeUnique<uint8[]>(source_width * source_height * 4); + auto buffer = MakeUnique<uint8_t[]>(source_width * source_height * 4); auto buffer_pitch = source_width * 4; GBRPlanarToARGB(y_buf, y_pitch, u_buf, uv_pitch, v_buf, uv_pitch, buffer.get(), buffer_pitch, source_width, source_height); @@ -356,10 +356,10 @@ void ScaleYCbCrToRGB32(const uint8* y_buf, } // Scale a frame of YUV to 32 bit ARGB. -void ScaleYCbCrToRGB32_deprecated(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void ScaleYCbCrToRGB32_deprecated(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int source_width, int source_height, int width, @@ -443,39 +443,39 @@ void ScaleYCbCrToRGB32_deprecated(const uint8* y_buf, // Need padding because FilterRows() will write 1 to 16 extra pixels // after the end for SSE2 version. - uint8 yuvbuf[16 + kFilterBufferSize * 3 + 16]; - uint8* ybuf = - reinterpret_cast<uint8*>(reinterpret_cast<uintptr_t>(yuvbuf + 15) & ~15); - uint8* ubuf = ybuf + kFilterBufferSize; - uint8* vbuf = ubuf + kFilterBufferSize; + uint8_t yuvbuf[16 + kFilterBufferSize * 3 + 16]; + uint8_t* ybuf = + reinterpret_cast<uint8_t*>(reinterpret_cast<uintptr_t>(yuvbuf + 15) & ~15); + uint8_t* ubuf = ybuf + kFilterBufferSize; + uint8_t* vbuf = ubuf + kFilterBufferSize; // TODO(fbarchard): Fixed point math is off by 1 on negatives. int yscale_fixed = (source_height << kFractionBits) / height; // TODO(fbarchard): Split this into separate function for better efficiency. for (int y = 0; y < height; ++y) { - uint8* dest_pixel = rgb_buf + y * rgb_pitch; + uint8_t* dest_pixel = rgb_buf + y * rgb_pitch; int source_y_subpixel = (y * yscale_fixed); if (yscale_fixed >= (kFractionMax * 2)) { source_y_subpixel += kFractionMax / 2; // For 1/2 or less, center filter. } int source_y = source_y_subpixel >> kFractionBits; - const uint8* y0_ptr = y_buf + source_y * y_pitch; - const uint8* y1_ptr = y0_ptr + y_pitch; + const uint8_t* y0_ptr = y_buf + source_y * y_pitch; + const uint8_t* y1_ptr = y0_ptr + y_pitch; - const uint8* u0_ptr = u_buf + (source_y >> y_shift) * uv_pitch; - const uint8* u1_ptr = u0_ptr + uv_pitch; - const uint8* v0_ptr = v_buf + (source_y >> y_shift) * uv_pitch; - const uint8* v1_ptr = v0_ptr + uv_pitch; + const uint8_t* u0_ptr = u_buf + (source_y >> y_shift) * uv_pitch; + const uint8_t* u1_ptr = u0_ptr + uv_pitch; + const uint8_t* v0_ptr = v_buf + (source_y >> y_shift) * uv_pitch; + const uint8_t* v1_ptr = v0_ptr + uv_pitch; // vertical scaler uses 16.8 fixed point int source_y_fraction = (source_y_subpixel & kFractionMask) >> 8; int source_uv_fraction = ((source_y_subpixel >> y_shift) & kFractionMask) >> 8; - const uint8* y_ptr = y0_ptr; - const uint8* u_ptr = u0_ptr; - const uint8* v_ptr = v0_ptr; + const uint8_t* y_ptr = y0_ptr; + const uint8_t* u_ptr = u0_ptr; + const uint8_t* v_ptr = v0_ptr; // Apply vertical filtering if necessary. // TODO(fbarchard): Remove memcpy when not necessary. if (filter & mozilla::gfx::FILTER_BILINEAR_V) { diff --git a/gfx/ycbcr/yuv_convert.h b/gfx/ycbcr/yuv_convert.h index 266a23d456..8563b567ca 100644 --- a/gfx/ycbcr/yuv_convert.h +++ b/gfx/ycbcr/yuv_convert.h @@ -45,10 +45,10 @@ YUVType TypeFromSize(int ywidth, int yheight, int cbcrwidth, int cbcrheight); // Convert a frame of YUV to 32 bit ARGB. // Pass in YV16/YV12 depending on source format -void ConvertYCbCrToRGB32(const uint8* yplane, - const uint8* uplane, - const uint8* vplane, - uint8* rgbframe, +void ConvertYCbCrToRGB32(const uint8_t* yplane, + const uint8_t* uplane, + const uint8_t* vplane, + uint8_t* rgbframe, int pic_x, int pic_y, int pic_width, @@ -59,10 +59,10 @@ void ConvertYCbCrToRGB32(const uint8* yplane, YUVType yuv_type, YUVColorSpace yuv_color_space); -void ConvertYCbCrToRGB32_deprecated(const uint8* yplane, - const uint8* uplane, - const uint8* vplane, - uint8* rgbframe, +void ConvertYCbCrToRGB32_deprecated(const uint8_t* yplane, + const uint8_t* uplane, + const uint8_t* vplane, + uint8_t* rgbframe, int pic_x, int pic_y, int pic_width, @@ -74,10 +74,10 @@ void ConvertYCbCrToRGB32_deprecated(const uint8* yplane, // Scale a frame of YUV to 32 bit ARGB. // Supports rotation and mirroring. -void ScaleYCbCrToRGB32(const uint8* yplane, - const uint8* uplane, - const uint8* vplane, - uint8* rgbframe, +void ScaleYCbCrToRGB32(const uint8_t* yplane, + const uint8_t* uplane, + const uint8_t* vplane, + uint8_t* rgbframe, int source_width, int source_height, int width, @@ -89,10 +89,10 @@ void ScaleYCbCrToRGB32(const uint8* yplane, YUVColorSpace yuv_color_space, ScaleFilter filter); -void ScaleYCbCrToRGB32_deprecated(const uint8* yplane, - const uint8* uplane, - const uint8* vplane, - uint8* rgbframe, +void ScaleYCbCrToRGB32_deprecated(const uint8_t* yplane, + const uint8_t* uplane, + const uint8_t* vplane, + uint8_t* rgbframe, int source_width, int source_height, int width, diff --git a/gfx/ycbcr/yuv_convert_arm.cpp b/gfx/ycbcr/yuv_convert_arm.cpp index 081343b0b1..7d58fa475d 100644 --- a/gfx/ycbcr/yuv_convert_arm.cpp +++ b/gfx/ycbcr/yuv_convert_arm.cpp @@ -21,20 +21,20 @@ void __attribute((noinline)) # else void __attribute((noinline,optimize("-fomit-frame-pointer"))) # endif - yuv42x_to_rgb565_row_neon(uint16 *dst, - const uint8 *y, - const uint8 *u, - const uint8 *v, + yuv42x_to_rgb565_row_neon(uint16_t *dst, + const uint8_t *y, + const uint8_t *u, + const uint8_t *v, int n, int oddflag) { - static __attribute__((aligned(16))) uint16 acc_r[8] = { + static __attribute__((aligned(16))) uint16_t acc_r[8] = { 22840, 22840, 22840, 22840, 22840, 22840, 22840, 22840, }; - static __attribute__((aligned(16))) uint16 acc_g[8] = { + static __attribute__((aligned(16))) uint16_t acc_g[8] = { 17312, 17312, 17312, 17312, 17312, 17312, 17312, 17312, }; - static __attribute__((aligned(16))) uint16 acc_b[8] = { + static __attribute__((aligned(16))) uint16_t acc_b[8] = { 28832, 28832, 28832, 28832, 28832, 28832, 28832, 28832, }; /* diff --git a/gfx/ycbcr/yuv_convert_mmx.cpp b/gfx/ycbcr/yuv_convert_mmx.cpp index b5353e5008..797b032f79 100644 --- a/gfx/ycbcr/yuv_convert_mmx.cpp +++ b/gfx/ycbcr/yuv_convert_mmx.cpp @@ -10,7 +10,7 @@ namespace gfx { // FilterRows combines two rows of the image using linear interpolation. // MMX version does 8 pixels at a time. -void FilterRows_MMX(uint8* ybuf, const uint8* y0_ptr, const uint8* y1_ptr, +void FilterRows_MMX(uint8_t* ybuf, const uint8_t* y0_ptr, const uint8_t* y1_ptr, int source_width, int source_y_fraction) { __m64 zero = _mm_setzero_si64(); __m64 y1_fraction = _mm_set1_pi16(source_y_fraction); diff --git a/gfx/ycbcr/yuv_convert_sse2.cpp b/gfx/ycbcr/yuv_convert_sse2.cpp index 25fe20639d..b5a84c908d 100644 --- a/gfx/ycbcr/yuv_convert_sse2.cpp +++ b/gfx/ycbcr/yuv_convert_sse2.cpp @@ -10,7 +10,7 @@ namespace gfx { // FilterRows combines two rows of the image using linear interpolation. // SSE2 version does 16 pixels at a time. -void FilterRows_SSE2(uint8* ybuf, const uint8* y0_ptr, const uint8* y1_ptr, +void FilterRows_SSE2(uint8_t* ybuf, const uint8_t* y0_ptr, const uint8_t* y1_ptr, int source_width, int source_y_fraction) { __m128i zero = _mm_setzero_si128(); __m128i y1_fraction = _mm_set1_epi16(source_y_fraction); diff --git a/gfx/ycbcr/yuv_row.h b/gfx/ycbcr/yuv_row.h index c89f54b8fd..f73f9554f7 100644 --- a/gfx/ycbcr/yuv_row.h +++ b/gfx/ycbcr/yuv_row.h @@ -15,33 +15,27 @@ extern "C" { // Can only do 1x. // This is the second fastest of the scalers. -void FastConvertYUVToRGB32Row(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void FastConvertYUVToRGB32Row(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width); -void FastConvertYUVToRGB32Row_C(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void FastConvertYUVToRGB32Row_C(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width, unsigned int x_shift); -void FastConvertYUVToRGB32Row(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, - int width); - // Can do 1x, half size or any scale down by an integer amount. // Step can be negative (mirroring, rotate 180). // This is the third fastest of the scalers. // Only defined on Windows x86-32. -void ConvertYUVToRGB32Row_SSE(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void ConvertYUVToRGB32Row_SSE(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width, int step); @@ -49,10 +43,10 @@ void ConvertYUVToRGB32Row_SSE(const uint8* y_buf, // This allows rotation by 90 or 270, by stepping by stride. // This is the forth fastest of the scalers. // Only defined on Windows x86-32. -void RotateConvertYUVToRGB32Row_SSE(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void RotateConvertYUVToRGB32Row_SSE(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width, int ystep, int uvstep); @@ -60,33 +54,26 @@ void RotateConvertYUVToRGB32Row_SSE(const uint8* y_buf, // Doubler does 4 pixels at a time. Each pixel is replicated. // This is the fastest of the scalers. // Only defined on Windows x86-32. -void DoubleYUVToRGB32Row_SSE(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void DoubleYUVToRGB32Row_SSE(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width); // Handles arbitrary scaling up or down. // Mirroring is supported, but not 90 or 270 degree rotation. // Chroma is under sampled every 2 pixels for performance. -void ScaleYUVToRGB32Row(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, - int width, - int source_dx); - -void ScaleYUVToRGB32Row(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void ScaleYUVToRGB32Row(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width, int source_dx); -void ScaleYUVToRGB32Row_C(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void ScaleYUVToRGB32Row_C(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width, int source_dx); @@ -94,24 +81,17 @@ void ScaleYUVToRGB32Row_C(const uint8* y_buf, // Mirroring is supported, but not 90 or 270 degree rotation. // Chroma is under sampled every 2 pixels for performance. // This is the slowest of the scalers. -void LinearScaleYUVToRGB32Row(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, - int width, - int source_dx); - -void LinearScaleYUVToRGB32Row(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void LinearScaleYUVToRGB32Row(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width, int source_dx); -void LinearScaleYUVToRGB32Row_C(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void LinearScaleYUVToRGB32Row_C(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width, int source_dx); @@ -121,7 +101,7 @@ void LinearScaleYUVToRGB32Row_C(const uint8* y_buf, #else #define SIMD_ALIGNED(var) var __attribute__((aligned(16))) #endif -extern SIMD_ALIGNED(const int16 kCoefficientsRgbY[768][4]); +extern SIMD_ALIGNED(const int16_t kCoefficientsRgbY[768][4]); // x64 uses MMX2 (SSE) so emms is not required. // Warning C4799: function has no EMMS instruction. diff --git a/gfx/ycbcr/yuv_row_c.cpp b/gfx/ycbcr/yuv_row_c.cpp index d327f854ee..b986451ec2 100644 --- a/gfx/ycbcr/yuv_row_c.cpp +++ b/gfx/ycbcr/yuv_row_c.cpp @@ -13,10 +13,10 @@ extern "C" { #define paddsw(x, y) (((x) + (y)) < -32768 ? -32768 : \ (((x) + (y)) > 32767 ? 32767 : ((x) + (y)))) -static inline void YuvPixel(uint8 y, - uint8 u, - uint8 v, - uint8* rgb_buf) { +static inline void YuvPixel(uint8_t y, + uint8_t u, + uint8_t v, + uint8_t* rgb_buf) { int b = kCoefficientsRgbY[256+u][0]; int g = kCoefficientsRgbY[256+u][1]; @@ -38,25 +38,25 @@ static inline void YuvPixel(uint8 y, r >>= 6; a >>= 6; - *reinterpret_cast<uint32*>(rgb_buf) = (packuswb(b)) | - (packuswb(g) << 8) | - (packuswb(r) << 16) | - (packuswb(a) << 24); + *reinterpret_cast<uint32_t*>(rgb_buf) = (packuswb(b)) | + (packuswb(g) << 8) | + (packuswb(r) << 16) | + (packuswb(a) << 24); } -void FastConvertYUVToRGB32Row_C(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void FastConvertYUVToRGB32Row_C(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width, unsigned int x_shift) { for (int x = 0; x < width; x += 2) { - uint8 u = u_buf[x >> x_shift]; - uint8 v = v_buf[x >> x_shift]; - uint8 y0 = y_buf[x]; + uint8_t u = u_buf[x >> x_shift]; + uint8_t v = v_buf[x >> x_shift]; + uint8_t y0 = y_buf[x]; YuvPixel(y0, u, v, rgb_buf); if ((x + 1) < width) { - uint8 y1 = y_buf[x + 1]; + uint8_t y1 = y_buf[x + 1]; if (x_shift == 0) { u = u_buf[x + 1]; v = v_buf[x + 1]; @@ -71,10 +71,10 @@ void FastConvertYUVToRGB32Row_C(const uint8* y_buf, // A shift by 17 is used to further subsample the chrominence channels. // & 0xffff isolates the fixed point fraction. >> 2 to get the upper 2 bits, // for 1/65536 pixel accurate interpolation. -void ScaleYUVToRGB32Row_C(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void ScaleYUVToRGB32Row_C(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width, int source_dx) { int x = 0; @@ -93,10 +93,10 @@ void ScaleYUVToRGB32Row_C(const uint8* y_buf, } } -void LinearScaleYUVToRGB32Row_C(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void LinearScaleYUVToRGB32Row_C(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width, int source_dx) { int x = 0; diff --git a/gfx/ycbcr/yuv_row_other.cpp b/gfx/ycbcr/yuv_row_other.cpp index c351139f90..437f90476d 100644 --- a/gfx/ycbcr/yuv_row_other.cpp +++ b/gfx/ycbcr/yuv_row_other.cpp @@ -5,27 +5,27 @@ #include "yuv_row.h" extern "C" { -void FastConvertYUVToRGB32Row(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void FastConvertYUVToRGB32Row(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width) { FastConvertYUVToRGB32Row_C(y_buf, u_buf, v_buf, rgb_buf, width, 1); } -void ScaleYUVToRGB32Row(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void ScaleYUVToRGB32Row(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width, int source_dx) { ScaleYUVToRGB32Row_C(y_buf, u_buf, v_buf, rgb_buf, width, source_dx); } -void LinearScaleYUVToRGB32Row(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void LinearScaleYUVToRGB32Row(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width, int source_dx) { LinearScaleYUVToRGB32Row_C(y_buf, u_buf, v_buf, rgb_buf, width, source_dx); diff --git a/gfx/ycbcr/yuv_row_posix.cpp b/gfx/ycbcr/yuv_row_posix.cpp index a84792d966..825fea2912 100644 --- a/gfx/ycbcr/yuv_row_posix.cpp +++ b/gfx/ycbcr/yuv_row_posix.cpp @@ -14,11 +14,11 @@ extern "C" { // We don't need CPUID guards here, since x86-64 implies SSE2. // AMD64 ABI uses register paremters. -void FastConvertYUVToRGB32Row(const uint8* y_buf, // rdi - const uint8* u_buf, // rsi - const uint8* v_buf, // rdx - uint8* rgb_buf, // rcx - int width) { // r8 +void FastConvertYUVToRGB32Row(const uint8_t* y_buf, // rdi + const uint8_t* u_buf, // rsi + const uint8_t* v_buf, // rdx + uint8_t* rgb_buf, // rcx + int width) { // r8 asm( "jmp 1f\n" "0:" @@ -72,12 +72,12 @@ void FastConvertYUVToRGB32Row(const uint8* y_buf, // rdi ); } -void ScaleYUVToRGB32Row(const uint8* y_buf, // rdi - const uint8* u_buf, // rsi - const uint8* v_buf, // rdx - uint8* rgb_buf, // rcx - int width, // r8 - int source_dx) { // r9 +void ScaleYUVToRGB32Row(const uint8_t* y_buf, // rdi + const uint8_t* u_buf, // rsi + const uint8_t* v_buf, // rdx + uint8_t* rgb_buf, // rcx + int width, // r8 + int source_dx) { // r9 asm( "xor %%r11,%%r11\n" "sub $0x2,%4\n" @@ -141,10 +141,10 @@ void ScaleYUVToRGB32Row(const uint8* y_buf, // rdi ); } -void LinearScaleYUVToRGB32Row(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void LinearScaleYUVToRGB32Row(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width, int source_dx) { asm( @@ -262,10 +262,10 @@ void LinearScaleYUVToRGB32Row(const uint8* y_buf, // PIC version is slower because less registers are available, so // non-PIC is used on platforms where it is possible. -void FastConvertYUVToRGB32Row_SSE(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void FastConvertYUVToRGB32Row_SSE(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width); asm( ".text\n" @@ -324,10 +324,10 @@ void FastConvertYUVToRGB32Row_SSE(const uint8* y_buf, #endif ); -void FastConvertYUVToRGB32Row(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void FastConvertYUVToRGB32Row(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width) { if (mozilla::supports_sse()) { @@ -339,10 +339,10 @@ void FastConvertYUVToRGB32Row(const uint8* y_buf, } -void ScaleYUVToRGB32Row_SSE(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void ScaleYUVToRGB32Row_SSE(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width, int source_dx); asm( @@ -417,10 +417,10 @@ void ScaleYUVToRGB32Row_SSE(const uint8* y_buf, #endif ); -void ScaleYUVToRGB32Row(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void ScaleYUVToRGB32Row(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width, int source_dx) { @@ -434,10 +434,10 @@ void ScaleYUVToRGB32Row(const uint8* y_buf, width, source_dx); } -void LinearScaleYUVToRGB32Row_SSE(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void LinearScaleYUVToRGB32Row_SSE(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width, int source_dx); asm( @@ -549,10 +549,10 @@ void LinearScaleYUVToRGB32Row_SSE(const uint8* y_buf, #endif ); -void LinearScaleYUVToRGB32Row(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void LinearScaleYUVToRGB32Row(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width, int source_dx) { @@ -568,12 +568,12 @@ void LinearScaleYUVToRGB32Row(const uint8* y_buf, #elif defined(MOZILLA_MAY_SUPPORT_SSE) && defined(ARCH_CPU_X86_32) && defined(__PIC__) -void PICConvertYUVToRGB32Row_SSE(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void PICConvertYUVToRGB32Row_SSE(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width, - const int16 *kCoefficientsRgbY); + const int16_t *kCoefficientsRgbY); asm( ".text\n" @@ -635,10 +635,10 @@ void PICConvertYUVToRGB32Row_SSE(const uint8* y_buf, #endif ); -void FastConvertYUVToRGB32Row(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void FastConvertYUVToRGB32Row(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width) { if (mozilla::supports_sse()) { @@ -650,13 +650,13 @@ void FastConvertYUVToRGB32Row(const uint8* y_buf, FastConvertYUVToRGB32Row_C(y_buf, u_buf, v_buf, rgb_buf, width, 1); } -void PICScaleYUVToRGB32Row_SSE(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void PICScaleYUVToRGB32Row_SSE(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width, int source_dx, - const int16 *kCoefficientsRgbY); + const int16_t *kCoefficientsRgbY); asm( ".text\n" @@ -732,10 +732,10 @@ void PICScaleYUVToRGB32Row_SSE(const uint8* y_buf, #endif ); -void ScaleYUVToRGB32Row(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void ScaleYUVToRGB32Row(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width, int source_dx) { @@ -748,13 +748,13 @@ void ScaleYUVToRGB32Row(const uint8* y_buf, ScaleYUVToRGB32Row_C(y_buf, u_buf, v_buf, rgb_buf, width, source_dx); } -void PICLinearScaleYUVToRGB32Row_SSE(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void PICLinearScaleYUVToRGB32Row_SSE(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width, int source_dx, - const int16 *kCoefficientsRgbY); + const int16_t *kCoefficientsRgbY); asm( ".text\n" @@ -871,10 +871,10 @@ void PICLinearScaleYUVToRGB32Row_SSE(const uint8* y_buf, ); -void LinearScaleYUVToRGB32Row(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void LinearScaleYUVToRGB32Row(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width, int source_dx) { @@ -887,27 +887,27 @@ void LinearScaleYUVToRGB32Row(const uint8* y_buf, LinearScaleYUVToRGB32Row_C(y_buf, u_buf, v_buf, rgb_buf, width, source_dx); } #else -void FastConvertYUVToRGB32Row(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void FastConvertYUVToRGB32Row(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width) { FastConvertYUVToRGB32Row_C(y_buf, u_buf, v_buf, rgb_buf, width, 1); } -void ScaleYUVToRGB32Row(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void ScaleYUVToRGB32Row(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width, int source_dx) { ScaleYUVToRGB32Row_C(y_buf, u_buf, v_buf, rgb_buf, width, source_dx); } -void LinearScaleYUVToRGB32Row(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void LinearScaleYUVToRGB32Row(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width, int source_dx) { LinearScaleYUVToRGB32Row_C(y_buf, u_buf, v_buf, rgb_buf, width, source_dx); diff --git a/gfx/ycbcr/yuv_row_table.cpp b/gfx/ycbcr/yuv_row_table.cpp index c531b60c21..a916ffde57 100644 --- a/gfx/ycbcr/yuv_row_table.cpp +++ b/gfx/ycbcr/yuv_row_table.cpp @@ -7,27 +7,27 @@ extern "C" { #define RGBY(i) { \ - static_cast<int16>(1.164 * 64 * (i - 16) + 0.5), \ - static_cast<int16>(1.164 * 64 * (i - 16) + 0.5), \ - static_cast<int16>(1.164 * 64 * (i - 16) + 0.5), \ + static_cast<int16_t>(1.164 * 64 * (i - 16) + 0.5), \ + static_cast<int16_t>(1.164 * 64 * (i - 16) + 0.5), \ + static_cast<int16_t>(1.164 * 64 * (i - 16) + 0.5), \ 0 \ } #define RGBU(i) { \ - static_cast<int16>(2.018 * 64 * (i - 128) + 0.5), \ - static_cast<int16>(-0.391 * 64 * (i - 128) + 0.5), \ + static_cast<int16_t>(2.018 * 64 * (i - 128) + 0.5), \ + static_cast<int16_t>(-0.391 * 64 * (i - 128) + 0.5), \ 0, \ - static_cast<int16>(256 * 64 - 1) \ + static_cast<int16_t>(256 * 64 - 1) \ } #define RGBV(i) { \ 0, \ - static_cast<int16>(-0.813 * 64 * (i - 128) + 0.5), \ - static_cast<int16>(1.596 * 64 * (i - 128) + 0.5), \ + static_cast<int16_t>(-0.813 * 64 * (i - 128) + 0.5), \ + static_cast<int16_t>(1.596 * 64 * (i - 128) + 0.5), \ 0 \ } -SIMD_ALIGNED(const int16 kCoefficientsRgbY[256 * 3][4]) = { +SIMD_ALIGNED(const int16_t kCoefficientsRgbY[256 * 3][4]) = { RGBY(0x00), RGBY(0x01), RGBY(0x02), RGBY(0x03), RGBY(0x04), RGBY(0x05), RGBY(0x06), RGBY(0x07), RGBY(0x08), RGBY(0x09), RGBY(0x0A), RGBY(0x0B), diff --git a/gfx/ycbcr/yuv_row_win.cpp b/gfx/ycbcr/yuv_row_win.cpp index 5cd931139e..3cf52e1a7b 100644 --- a/gfx/ycbcr/yuv_row_win.cpp +++ b/gfx/ycbcr/yuv_row_win.cpp @@ -12,10 +12,10 @@ extern "C" { #if defined(MOZILLA_MAY_SUPPORT_SSE) && defined(_M_IX86) __declspec(naked) -void FastConvertYUVToRGB32Row_SSE(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void FastConvertYUVToRGB32Row_SSE(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width) { __asm { pushad @@ -70,10 +70,10 @@ void FastConvertYUVToRGB32Row_SSE(const uint8* y_buf, } __declspec(naked) -void ConvertYUVToRGB32Row_SSE(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void ConvertYUVToRGB32Row_SSE(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width, int step) { __asm { @@ -131,10 +131,10 @@ void ConvertYUVToRGB32Row_SSE(const uint8* y_buf, } __declspec(naked) -void RotateConvertYUVToRGB32Row_SSE(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void RotateConvertYUVToRGB32Row_SSE(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width, int ystep, int uvstep) { @@ -194,10 +194,10 @@ void RotateConvertYUVToRGB32Row_SSE(const uint8* y_buf, } __declspec(naked) -void DoubleYUVToRGB32Row_SSE(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void DoubleYUVToRGB32Row_SSE(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width) { __asm { pushad @@ -266,10 +266,10 @@ void DoubleYUVToRGB32Row_SSE(const uint8* y_buf, // For performance the chroma is under-sampled, reducing cost of a 3x // 1080p scale from 8.4 ms to 5.4 ms. __declspec(naked) -void ScaleYUVToRGB32Row_SSE(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void ScaleYUVToRGB32Row_SSE(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width, int source_dx) { __asm { @@ -339,10 +339,10 @@ void ScaleYUVToRGB32Row_SSE(const uint8* y_buf, } __declspec(naked) -void LinearScaleYUVToRGB32Row_SSE(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void LinearScaleYUVToRGB32Row_SSE(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width, int source_dx) { __asm { @@ -446,10 +446,10 @@ lscalelastpixel: } #endif // if defined(MOZILLA_MAY_SUPPORT_SSE) && defined(_M_IX86) -void FastConvertYUVToRGB32Row(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void FastConvertYUVToRGB32Row(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width) { #if defined(MOZILLA_MAY_SUPPORT_SSE) && defined(_M_IX86) if (mozilla::supports_sse()) { @@ -461,10 +461,10 @@ void FastConvertYUVToRGB32Row(const uint8* y_buf, FastConvertYUVToRGB32Row_C(y_buf, u_buf, v_buf, rgb_buf, width, 1); } -void ScaleYUVToRGB32Row(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void ScaleYUVToRGB32Row(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width, int source_dx) { @@ -478,10 +478,10 @@ void ScaleYUVToRGB32Row(const uint8* y_buf, ScaleYUVToRGB32Row_C(y_buf, u_buf, v_buf, rgb_buf, width, source_dx); } -void LinearScaleYUVToRGB32Row(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void LinearScaleYUVToRGB32Row(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width, int source_dx) { #if defined(MOZILLA_MAY_SUPPORT_SSE) && defined(_M_IX86) diff --git a/gfx/ycbcr/yuv_row_win64.cpp b/gfx/ycbcr/yuv_row_win64.cpp index 6a34f840a5..17b542449b 100644 --- a/gfx/ycbcr/yuv_row_win64.cpp +++ b/gfx/ycbcr/yuv_row_win64.cpp @@ -8,15 +8,15 @@ extern "C" { // x64 compiler doesn't support MMX and inline assembler. Use SSE2 intrinsics. -#define kCoefficientsRgbU (reinterpret_cast<const uint8*>(kCoefficientsRgbY) + 2048) -#define kCoefficientsRgbV (reinterpret_cast<const uint8*>(kCoefficientsRgbY) + 4096) +#define kCoefficientsRgbU (reinterpret_cast<const uint8_t*>(kCoefficientsRgbY) + 2048) +#define kCoefficientsRgbV (reinterpret_cast<const uint8_t*>(kCoefficientsRgbY) + 4096) #include <emmintrin.h> -static void FastConvertYUVToRGB32Row_SSE2(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +static void FastConvertYUVToRGB32Row_SSE2(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width) { __m128i xmm0, xmmY1, xmmY2; __m128 xmmY; @@ -25,10 +25,10 @@ static void FastConvertYUVToRGB32Row_SSE2(const uint8* y_buf, xmm0 = _mm_adds_epi16(_mm_loadl_epi64(reinterpret_cast<const __m128i*>(kCoefficientsRgbU + 8 * *u_buf++)), _mm_loadl_epi64(reinterpret_cast<const __m128i*>(kCoefficientsRgbV + 8 * *v_buf++))); - xmmY1 = _mm_loadl_epi64(reinterpret_cast<const __m128i*>(reinterpret_cast<const uint8*>(kCoefficientsRgbY) + 8 * *y_buf++)); + xmmY1 = _mm_loadl_epi64(reinterpret_cast<const __m128i*>(reinterpret_cast<const uint8_t*>(kCoefficientsRgbY) + 8 * *y_buf++)); xmmY1 = _mm_adds_epi16(xmmY1, xmm0); - xmmY2 = _mm_loadl_epi64(reinterpret_cast<const __m128i*>(reinterpret_cast<const uint8*>(kCoefficientsRgbY) + 8 * *y_buf++)); + xmmY2 = _mm_loadl_epi64(reinterpret_cast<const __m128i*>(reinterpret_cast<const uint8_t*>(kCoefficientsRgbY) + 8 * *y_buf++)); xmmY2 = _mm_adds_epi16(xmmY2, xmm0); xmmY = _mm_shuffle_ps(_mm_castsi128_ps(xmmY1), _mm_castsi128_ps(xmmY2), @@ -44,23 +44,23 @@ static void FastConvertYUVToRGB32Row_SSE2(const uint8* y_buf, if (width) { xmm0 = _mm_adds_epi16(_mm_loadl_epi64(reinterpret_cast<const __m128i*>(kCoefficientsRgbU + 8 * *u_buf)), _mm_loadl_epi64(reinterpret_cast<const __m128i*>(kCoefficientsRgbV + 8 * *v_buf))); - xmmY1 = _mm_loadl_epi64(reinterpret_cast<const __m128i*>(reinterpret_cast<const uint8*>(kCoefficientsRgbY) + 8 * *y_buf)); + xmmY1 = _mm_loadl_epi64(reinterpret_cast<const __m128i*>(reinterpret_cast<const uint8_t*>(kCoefficientsRgbY) + 8 * *y_buf)); xmmY1 = _mm_adds_epi16(xmmY1, xmm0); xmmY1 = _mm_srai_epi16(xmmY1, 6); xmmY1 = _mm_packus_epi16(xmmY1, xmmY1); - *reinterpret_cast<uint32*>(rgb_buf) = _mm_cvtsi128_si32(xmmY1); + *reinterpret_cast<uint32_t*>(rgb_buf) = _mm_cvtsi128_si32(xmmY1); } } -static void ScaleYUVToRGB32Row_SSE2(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +static void ScaleYUVToRGB32Row_SSE2(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width, int source_dx) { __m128i xmm0, xmmY1, xmmY2; __m128 xmmY; - uint8 u, v, y; + uint8_t u, v, y; int x = 0; while (width >= 2) { @@ -71,13 +71,13 @@ static void ScaleYUVToRGB32Row_SSE2(const uint8* y_buf, xmm0 = _mm_adds_epi16(_mm_loadl_epi64(reinterpret_cast<const __m128i*>(kCoefficientsRgbU + 8 * u)), _mm_loadl_epi64(reinterpret_cast<const __m128i*>(kCoefficientsRgbV + 8 * v))); - xmmY1 = _mm_loadl_epi64(reinterpret_cast<const __m128i*>(reinterpret_cast<const uint8*>(kCoefficientsRgbY) + 8 * y)); + xmmY1 = _mm_loadl_epi64(reinterpret_cast<const __m128i*>(reinterpret_cast<const uint8_t*>(kCoefficientsRgbY) + 8 * y)); xmmY1 = _mm_adds_epi16(xmmY1, xmm0); y = y_buf[x >> 16]; x += source_dx; - xmmY2 = _mm_loadl_epi64(reinterpret_cast<const __m128i*>(reinterpret_cast<const uint8*>(kCoefficientsRgbY) + 8 * y)); + xmmY2 = _mm_loadl_epi64(reinterpret_cast<const __m128i*>(reinterpret_cast<const uint8_t*>(kCoefficientsRgbY) + 8 * y)); xmmY2 = _mm_adds_epi16(xmmY2, xmm0); xmmY = _mm_shuffle_ps(_mm_castsi128_ps(xmmY1), _mm_castsi128_ps(xmmY2), @@ -97,24 +97,24 @@ static void ScaleYUVToRGB32Row_SSE2(const uint8* y_buf, xmm0 = _mm_adds_epi16(_mm_loadl_epi64(reinterpret_cast<const __m128i*>(kCoefficientsRgbU + 8 * u)), _mm_loadl_epi64(reinterpret_cast<const __m128i*>(kCoefficientsRgbV + 8 * v))); - xmmY1 = _mm_loadl_epi64(reinterpret_cast<const __m128i*>(reinterpret_cast<const uint8*>(kCoefficientsRgbY) + 8 * y)); + xmmY1 = _mm_loadl_epi64(reinterpret_cast<const __m128i*>(reinterpret_cast<const uint8_t*>(kCoefficientsRgbY) + 8 * y)); xmmY1 = _mm_adds_epi16(xmmY1, xmm0); xmmY1 = _mm_srai_epi16(xmmY1, 6); xmmY1 = _mm_packus_epi16(xmmY1, xmmY1); - *reinterpret_cast<uint32*>(rgb_buf) = _mm_cvtsi128_si32(xmmY1); + *reinterpret_cast<uint32_t*>(rgb_buf) = _mm_cvtsi128_si32(xmmY1); } } -static void LinearScaleYUVToRGB32Row_SSE2(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +static void LinearScaleYUVToRGB32Row_SSE2(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width, int source_dx) { __m128i xmm0, xmmY1, xmmY2; __m128 xmmY; - uint8 u0, u1, v0, v1, y0, y1; - uint32 uv_frac, y_frac, u, v, y; + uint8_t u0, u1, v0, v1, y0, y1; + uint32_t uv_frac, y_frac, u, v, y; int x = 0; if (source_dx >= 0x20000) { @@ -137,7 +137,7 @@ static void LinearScaleYUVToRGB32Row_SSE2(const uint8* y_buf, xmm0 = _mm_adds_epi16(_mm_loadl_epi64(reinterpret_cast<const __m128i*>(kCoefficientsRgbU + 8 * u)), _mm_loadl_epi64(reinterpret_cast<const __m128i*>(kCoefficientsRgbV + 8 * v))); - xmmY1 = _mm_loadl_epi64(reinterpret_cast<const __m128i*>(reinterpret_cast<const uint8*>(kCoefficientsRgbY) + 8 * y)); + xmmY1 = _mm_loadl_epi64(reinterpret_cast<const __m128i*>(reinterpret_cast<const uint8_t*>(kCoefficientsRgbY) + 8 * y)); xmmY1 = _mm_adds_epi16(xmmY1, xmm0); y0 = y_buf[x >> 16]; @@ -146,7 +146,7 @@ static void LinearScaleYUVToRGB32Row_SSE2(const uint8* y_buf, y = (y_frac * y1 + (y_frac ^ 0xffff) * y0) >> 16; x += source_dx; - xmmY2 = _mm_loadl_epi64(reinterpret_cast<const __m128i*>(reinterpret_cast<const uint8*>(kCoefficientsRgbY) + 8 * y)); + xmmY2 = _mm_loadl_epi64(reinterpret_cast<const __m128i*>(reinterpret_cast<const uint8_t*>(kCoefficientsRgbY) + 8 * y)); xmmY2 = _mm_adds_epi16(xmmY2, xmm0); xmmY = _mm_shuffle_ps(_mm_castsi128_ps(xmmY1), _mm_castsi128_ps(xmmY2), @@ -166,36 +166,36 @@ static void LinearScaleYUVToRGB32Row_SSE2(const uint8* y_buf, xmm0 = _mm_adds_epi16(_mm_loadl_epi64(reinterpret_cast<const __m128i*>(kCoefficientsRgbU + 8 * u)), _mm_loadl_epi64(reinterpret_cast<const __m128i*>(kCoefficientsRgbV + 8 * v))); - xmmY1 = _mm_loadl_epi64(reinterpret_cast<const __m128i*>(reinterpret_cast<const uint8*>(kCoefficientsRgbY) + 8 * y)); + xmmY1 = _mm_loadl_epi64(reinterpret_cast<const __m128i*>(reinterpret_cast<const uint8_t*>(kCoefficientsRgbY) + 8 * y)); xmmY1 = _mm_adds_epi16(xmmY1, xmm0); xmmY1 = _mm_srai_epi16(xmmY1, 6); xmmY1 = _mm_packus_epi16(xmmY1, xmmY1); - *reinterpret_cast<uint32*>(rgb_buf) = _mm_cvtsi128_si32(xmmY1); + *reinterpret_cast<uint32_t*>(rgb_buf) = _mm_cvtsi128_si32(xmmY1); } } -void FastConvertYUVToRGB32Row(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void FastConvertYUVToRGB32Row(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width) { FastConvertYUVToRGB32Row_SSE2(y_buf, u_buf, v_buf, rgb_buf, width); } -void ScaleYUVToRGB32Row(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void ScaleYUVToRGB32Row(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width, int source_dx) { ScaleYUVToRGB32Row_SSE2(y_buf, u_buf, v_buf, rgb_buf, width, source_dx); } -void LinearScaleYUVToRGB32Row(const uint8* y_buf, - const uint8* u_buf, - const uint8* v_buf, - uint8* rgb_buf, +void LinearScaleYUVToRGB32Row(const uint8_t* y_buf, + const uint8_t* u_buf, + const uint8_t* v_buf, + uint8_t* rgb_buf, int width, int source_dx) { LinearScaleYUVToRGB32Row_SSE2(y_buf, u_buf, v_buf, rgb_buf, width, |