/* * AltiVec optimizations for libjpeg-turbo * * Copyright (C) 2014-2015, D. R. Commander. All Rights Reserved. * Copyright (C) 2014, Jay Foad. All Rights Reserved. * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages * arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. If you use this software * in a product, an acknowledgment in the product documentation would be * appreciated but is not required. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution.
*/
/* (Original) * Y = 0.29900 * R + 0.58700 * G + 0.11400 * B * Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE * Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE * * (This implementation) * Y = 0.29900 * R + 0.33700 * G + 0.11400 * B + 0.25000 * G * Cb = -0.16874 * R - 0.33126 * G + 0.50000 * B + CENTERJSAMPLE * Cr = 0.50000 * R - 0.41869 * G - 0.08131 * B + CENTERJSAMPLE
*/
/* Calculate Y values */
y0 = vec_msums(rg0, pw_f0299_f0337, pd_onehalf);
y1 = vec_msums(rg1, pw_f0299_f0337, pd_onehalf);
y2 = vec_msums(rg2, pw_f0299_f0337, pd_onehalf);
y3 = vec_msums(rg3, pw_f0299_f0337, pd_onehalf);
y0 = vec_msums(bg0, pw_f0114_f0250, y0);
y1 = vec_msums(bg1, pw_f0114_f0250, y1);
y2 = vec_msums(bg2, pw_f0114_f0250, y2);
y3 = vec_msums(bg3, pw_f0114_f0250, y3); /* Clever way to avoid 4 shifts + 2 packs. This packs the high word from * each dword into a new 16-bit vector, which is the equivalent of * descaling the 32-bit results (right-shifting by 16 bits) and then * packing them.
*/
yl = vec_perm((__vector unsignedshort)y0, (__vector unsignedshort)y1,
shift_pack_index);
yh = vec_perm((__vector unsignedshort)y2, (__vector unsignedshort)y3,
shift_pack_index);
y = vec_pack(yl, yh);
vec_st(y, 0, outptr0);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.