Chromium Code Reviews| Index: media/base/simd/yuv_row.asm |
| =================================================================== |
| --- media/base/simd/yuv_row.asm (revision 0) |
| +++ media/base/simd/yuv_row.asm (revision 0) |
| @@ -0,0 +1,128 @@ |
| +; Copyright (c) 2011 The Chromium Authors. All rights reserved. |
|
Alpha Left Google
2011/08/22 14:16:59
Rename this to media/base/yuv_row_sse2.asm
|
| +; Use of this source code is governed by a BSD-style license that can be |
| +; found in the LICENSE file. |
| + |
| +%include "yuv_row.inc" |
| + |
| +; |
| +; The numer of fractional bits used for fixed-point calculation. |
| +; |
| +%define SHIFT_BITS 12 |
| +%define FIX(n) (n >> (12 - SHIFT_BITS)) |
| + |
| +; |
| +; Tables used for RGB-to-YV12 conversion and YV12-to-RGB conversion. These |
| +; tables represent the conversion matrices used for the conversions as listed in |
| +; following C++ snippet. Unfortunately, we need to use precalculated constants |
| +; here since the yasm preprocessor cannot handle complicated floating-point |
| +; calculation. |
| +; |
| +; #define FIX(n) ((n) * (1 << SHIFT_BITS) + 0.5) |
| +; |
| +; int16 SIMD_ConvertRGBAToYUV_kTable[8 * 3] = { |
| +; FIX(0.098), FIX(0.504), FIX(0.257), 0, |
| +; FIX(0.098), FIX(0.504), FIX(0.257), 0, |
| +; FIX(0.5), 0, FIX(0.5), 0, |
| +; FIX(0.5), 0, FIX(0.5), 0, |
| +; FIX(0.439), -FIX(0.291), -FIX(0.148), 0, |
| +; -FIX(0.071), -FIX(0.368), FIX(0.439), 0, |
| +; }; |
| +; |
| +; int16 SIMD_ConvertYUVtoRGBA_kTable[8 * 2] = { |
| +; -16, -128, -128, FIX(0.5), |
| +; FIX(1.164), 0, FIX(1.596), 1, |
| +; FIX(1.164), -FIX(0.391), -FIX(0.813), 1, |
| +; FIX(1.164), FIX(2.018), 0, 1, |
| +; }; |
| +; |
| + SECTION SEG_CONST |
| + |
| +SIMD_ConvertARGBToYUVRow_kTable: |
|
Alpha Left Google
2011/08/22 14:16:59
SSE2_XXX, there may be a different NEON version.
|
| + dw FIX(401), FIX(2064), FIX(1053), 0 |
| + dw FIX(401), FIX(2064), FIX(1053), 0 |
| + dw FIX(2048), 0, FIX(2048), 0 |
| + dw FIX(2048), 0, FIX(2048), 0 |
| + dw FIX(1798), FIX(-1191), FIX(-605), 0 |
| + dw FIX(-290), FIX(-1506), FIX(1798), 0 |
| + |
| +SIMD_ConvertYUVtoARGB_kTable: |
|
Alpha Left Google
2011/08/22 14:16:59
SSE2_XXX, there may be a different NEON version.
|
| + dw -16, -128, -128, FIX(2048) |
| + dw FIX(4768), FIX(0), FIX(6537), 1 |
| + dw FIX(4768), FIX(-1601), FIX(-3329), 1 |
| + dw FIX(4768), FIX(8266), FIX(0), 1 |
| + |
| + SECTION SEG_TEXT |
| + CPU PENTIUM4 |
| +; |
| +; void media::simd::ConvertARGBToYUVRow(const uint8* rgba, |
| +; uint8* y, |
| +; uint8* u, |
| +; uint8* v, |
| +; int width); |
| +; |
| +%ifdef MACHO |
| +%define SYMBOL_NAME __ZN5media4simd19ConvertARGBtoYUVRowEPKhPhS3_S3_i |
| +%elifdef ELF |
| +%define SYMBOL_NAME _ZN5media4simd19ConvertARGBtoYUVRowEPKhPhS3_S3_i |
| +%elifdef MSVC |
| +%define SYMBOL_NAME ?ConvertARGBtoYUVRow@simd@media@@YAXPBEPAE11H@Z |
| +%endif |
| + |
| +%define PIXELSIZE 4 |
| +%include "yuv_row_rgb.inc" |
| + |
| +; |
| +; void media::simd::ConvertRGBToYUVRow(const uint8* rgba, |
| +; uint8* y, |
| +; uint8* u, |
| +; uint8* v, |
| +; int width); |
| +; |
| +%ifdef MACHO |
| +%define SYMBOL_NAME __ZN5media4simd18ConvertRGBtoYUVRowEPKhPhS3_S3_i |
| +%elifdef ELF |
| +%define SYMBOL_NAME _ZN5media4simd18ConvertRGBtoYUVRowEPKhPhS3_S3_i |
| +%elifdef MSVC |
| +%define SYMBOL_NAME ?ConvertRGBtoYUVRow@simd@media@@YAXPBEPAE11H@Z |
| +%endif |
| + |
| +%define PIXELSIZE 3 |
| +%include "yuv_row_rgb.inc" |
| + |
| +; |
| +; void media::simd::ConvertYUVtoRGBARow(const uint8* y, |
| +; const uint8* u, |
| +; const uint8* v, |
| +; const uint8* rgba, |
| +; int width); |
| +; |
| +%ifdef MACHO |
| +%define SYMBOL_NAME __ZN5media4simd19ConvertYUVtoARGBRowEPKhS2_S2_Phi |
| +%elifdef ELF |
| +%define SYMBOL_NAME _ZN5media4simd19ConvertYUVtoARGBRowEPKhS2_S2_Phi |
| +%elifdef MSVC |
| +%define SYMBOL_NAME ?ConvertYUVtoARGBRow@simd@media@@YAXPBE00PAEH@Z |
| +%endif |
| + |
| +%define PIXELSIZE 4 |
| +%define ALPHA 255 |
| +%include "yuv_row_yuv.inc" |
| + |
| +; |
| +; void media::simd::ConvertYUVtoRGBRow(const uint8* y, |
| +; const uint8* u, |
| +; const uint8* v, |
| +; const uint8* rgb, |
| +; int width); |
| +; |
| +%ifdef MACHO |
| +%define SYMBOL_NAME __ZN5media4simd18ConvertYUVtoRGBRowEPKhS2_S2_Phi |
| +%elifdef ELF |
| +%define SYMBOL_NAME _ZN5media4simd18ConvertYUVtoRGBRowEPKhS2_S2_Phi |
| +%elifdef MSVC |
| +%define SYMBOL_NAME ?ConvertYUVtoRGBRow@simd@media@@YAXPBE00PAEH@Z |
| +%endif |
| + |
| +%define PIXELSIZE 3 |
| +%define ALPHA 0 |
| +%include "yuv_row_yuv.inc" |