| OLD | NEW |
| (Empty) | |
| 1 ; Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 ; Use of this source code is governed by a BSD-style license that can be |
| 3 ; found in the LICENSE file. |
| 4 |
| 5 %include "convert_row.inc" |
| 6 |
| 7 ; |
| 8 ; The numer of fractional bits used for fixed-point calculation. |
| 9 ; |
| 10 %define SHIFT_BITS 12 |
| 11 |
| 12 ; |
| 13 ; Tables used for RGB-to-YV12 conversion and YV12-to-RGB conversion. These |
| 14 ; tables represent the conversion matrices used for the conversions as listed in |
| 15 ; following C++ snippet. Unfortunately, we need to use precalculated constants |
| 16 ; here since the yasm preprocessor cannot handle complicated floating-point |
| 17 ; calculation. |
| 18 ; |
| 19 ; #define FIX(n) ((n) * (1 << SHIFT_BITS) + 0.5) |
| 20 ; |
| 21 ; int16 SIMD_ConvertRGBAToYUV_kTable[8 * 3] = { |
| 22 ; FIX(0.098), FIX(0.504), FIX(0.257), 0, |
| 23 ; FIX(0.098), FIX(0.504), FIX(0.257), 0, |
| 24 ; FIX(0.5), 0, FIX(0.5), 0, |
| 25 ; FIX(0.5), 0, FIX(0.5), 0, |
| 26 ; FIX(0.439), -FIX(0.291), -FIX(0.148), 0, |
| 27 ; -FIX(0.071), -FIX(0.368), FIX(0.439), 0, |
| 28 ; }; |
| 29 ; |
| 30 ; int16 SIMD_ConvertYUVtoRGBA_kTable[8 * 2] = { |
| 31 ; -16, -128, -128, FIX(0.5), |
| 32 ; FIX(1.164), 0, FIX(1.596), 1, |
| 33 ; FIX(1.164), -FIX(0.391), -FIX(0.813), 1, |
| 34 ; FIX(1.164), FIX(2.018), 0, 1, |
| 35 ; }; |
| 36 ; |
| 37 SECTION SEG_CONST |
| 38 |
| 39 global EXTN(SIMD_ConvertRGBAToYUVRow_kTable) PRIVATE |
| 40 |
| 41 EXTN(SIMD_ConvertRGBAToYUVRow_kTable): |
| 42 %if SHIFT_BITS == 8 |
| 43 dw 25, 129, 66, 0, 25, 129, 66, 0 |
| 44 dw 128, 0, 128, 0, 128, 0, 128, 0 |
| 45 dw 112, -74, -38, 0, -18, -94, 112, 0 |
| 46 %elif SHIFT_BITS == 12 |
| 47 dw 401, 2064, 1053, 0 |
| 48 dw 401, 2064, 1053, 0 |
| 49 dw 2048, 0, 2048, 0 |
| 50 dw 2048, 0, 2048, 0 |
| 51 dw 1798, -1191, -605, 0 |
| 52 dw -290, -1506, 1798, 0 |
| 53 %endif |
| 54 |
| 55 global EXTN(SIMD_ConvertYUVtoRGBA_kTable) PRIVATE |
| 56 |
| 57 EXTN(SIMD_ConvertYUVtoRGBA_kTable): |
| 58 %if SHIFT_BITS == 8 |
| 59 dw -16, -128, -128, 128 |
| 60 dw 298, 0, 409, 1 |
| 61 dw 298, -100, -208, 1 |
| 62 dw 298, 516, 0, 1, |
| 63 %elif SHIFT_BITS == 12 |
| 64 dw -16, -128, -128, 2048 |
| 65 dw 4768, 0, 6537, 1 |
| 66 dw 4768, -1601, -3329, 1 |
| 67 dw 4768, 8266, 0, 1 |
| 68 %endif |
| 69 |
| 70 SECTION SEG_TEXT |
| 71 CPU PENTIUM4 |
| 72 ; |
| 73 ; void media::simd::ConvertRGBAToYUVRow(const uint8* rgba, |
| 74 ; uint8* y, |
| 75 ; uint8* u, |
| 76 ; uint8* v, |
| 77 ; int width); |
| 78 ; |
| 79 %ifdef MACHO |
| 80 %define SYMBOL_NAME __ZN5media4simd19ConvertRGBAtoYUVRowEPKhPhS3_S3_i |
| 81 %elifdef ELF |
| 82 %define SYMBOL_NAME _ZN5media4simd19ConvertRGBAtoYUVRowEPKhPhS3_S3_i |
| 83 %elifdef MSVC |
| 84 %define SYMBOL_NAME ?ConvertRGBAtoYUVRow@simd@media@@YAXPBEPAE11H@Z |
| 85 %endif |
| 86 |
| 87 %define PIXELSIZE 4 |
| 88 %include "convert_row_rgb.inc" |
| 89 |
| 90 ; |
| 91 ; void media::simd::ConvertRGBAToYUVRow(const uint8* rgba, |
| 92 ; uint8* y, |
| 93 ; uint8* u, |
| 94 ; uint8* v, |
| 95 ; int width); |
| 96 ; |
| 97 %ifdef MACHO |
| 98 %define SYMBOL_NAME __ZN5media4simd18ConvertRGBtoYUVRowEPKhPhS3_S3_i |
| 99 %elifdef ELF |
| 100 %define SYMBOL_NAME _ZN5media4simd18ConvertRGBtoYUVRowEPKhPhS3_S3_i |
| 101 %elifdef MSVC |
| 102 %define SYMBOL_NAME ?ConvertRGBtoYUVRow@simd@media@@YAXPBEPAE11H@Z |
| 103 %endif |
| 104 |
| 105 %define PIXELSIZE 3 |
| 106 %include "convert_row_rgb.inc" |
| 107 |
| 108 ; |
| 109 ; void media::simd::ConvertYUVtoRGBARow(const uint8* y, |
| 110 ; const uint8* u, |
| 111 ; const uint8* v, |
| 112 ; const uint8* rgba, |
| 113 ; int width); |
| 114 ; |
| 115 %ifdef MACHO |
| 116 %define SYMBOL_NAME __ZN5media4simd19ConvertYUVtoRGBARowEPKhS2_S2_Phi |
| 117 %elifdef ELF |
| 118 %define SYMBOL_NAME _ZN5media4simd19ConvertYUVtoRGBARowEPKhS2_S2_Phi |
| 119 %elifdef MSVC |
| 120 %define SYMBOL_NAME ?ConvertYUVtoRGBARow@simd@media@@YAXPBE00PAEH@Z |
| 121 %endif |
| 122 |
| 123 %define PIXELSIZE 4 |
| 124 %define ALPHA 255 |
| 125 %include "convert_row_yuv.inc" |
| 126 |
| 127 ; |
| 128 ; void media::simd::ConvertYUVtoRGBRow(const uint8* y, |
| 129 ; const uint8* u, |
| 130 ; const uint8* v, |
| 131 ; const uint8* rgb, |
| 132 ; int width); |
| 133 ; |
| 134 %ifdef MACHO |
| 135 %define SYMBOL_NAME __ZN5media4simd18ConvertYUVtoRGBRowEPKhS2_S2_Phi |
| 136 %elifdef ELF |
| 137 %define SYMBOL_NAME _ZN5media4simd18ConvertYUVtoRGBRowEPKhS2_S2_Phi |
| 138 %elifdef MSVC |
| 139 %define SYMBOL_NAME ?ConvertYUVtoRGBRow@simd@media@@YAXPBE00PAEH@Z |
| 140 %endif |
| 141 |
| 142 %define PIXELSIZE 3 |
| 143 %define ALPHA 0 |
| 144 %include "convert_row_yuv.inc" |
| OLD | NEW |