// Copyright 2014 Google Inc. All Rights Reserved. // // Use of this source code is governed by a BSD-style license // that can be found in the COPYING file in the root of the source // tree. An additional intellectual property rights grant can be found // in the file PATENTS. All contributing project authors may // be found in the AUTHORS file in the root of the source tree. // ----------------------------------------------------------------------------- // // YUV to RGB upsampling functions. // // Author(s): Branimir Vasic (branimir.vasic@imgtec.com) // Djordje Pesut (djordje.pesut@imgtec.com)
#include"src/dsp/dsp.h"
#ifdefined(WEBP_USE_MIPS_DSP_R2)
#include <assert.h> #include"src/dsp/yuv.h"
#define YUV_TO_RGB(Y, U, V, R, G, B) do { \ constint t1 = MultHi(Y, 19077); \ constint t2 = MultHi(V, 13320); \
R = MultHi(V, 26149); \
G = MultHi(U, 6419); \
B = MultHi(U, 33050); \
R = t1 + R; \
G = t1 - G; \
B = t1 + B; \
R = R - 14234; \
G = G - t2 + 8708; \
B = B - 17685; \
__asm__ volatile ( \ "shll_s.w %["#R"], %["#R"], 17 \n\t" \ "shll_s.w %["#G"], %["#G"], 17 \n\t" \ "shll_s.w %["#B"], %["#B"], 17 \n\t" \ "precrqu_s.qb.ph %["#R"], %["#R"], $zero \n\t" \ "precrqu_s.qb.ph %["#G"], %["#G"], $zero \n\t" \ "precrqu_s.qb.ph %["#B"], %["#B"], $zero \n\t" \ "srl %["#R"], %["#R"], 24 \n\t" \ "srl %["#G"], %["#G"], 24 \n\t" \ "srl %["#B"], %["#B"], 24 \n\t" \
: [R]"+r"(R), [G]"+r"(G), [B]"+r"(B) \
: \
); \
} while (0)
#if !defined(WEBP_REDUCE_CSP) static WEBP_INLINE void YuvToRgb(int y, int u, int v, uint8_t* const rgb) { int r, g, b;
YUV_TO_RGB(y, u, v, r, g, b);
rgb[0] = r;
rgb[1] = g;
rgb[2] = b;
} static WEBP_INLINE void YuvToBgr(int y, int u, int v, uint8_t* const bgr) { int r, g, b;
YUV_TO_RGB(y, u, v, r, g, b);
bgr[0] = b;
bgr[1] = g;
bgr[2] = r;
} static WEBP_INLINE void YuvToRgb565(int y, int u, int v, uint8_t* const rgb) { int r, g, b;
YUV_TO_RGB(y, u, v, r, g, b);
{ constint rg = (r & 0xf8) | (g >> 5); constint gb = ((g << 3) & 0xe0) | (b >> 3); #if (WEBP_SWAP_16BIT_CSP == 1)
rgb[0] = gb;
rgb[1] = rg; #else
rgb[0] = rg;
rgb[1] = gb; #endif
}
} static WEBP_INLINE void YuvToRgba4444(int y, int u, int v,
uint8_t* const argb) { int r, g, b;
YUV_TO_RGB(y, u, v, r, g, b);
{ constint rg = (r & 0xf0) | (g >> 4); constint ba = (b & 0xf0) | 0x0f; // overwrite the lower 4 bits #if (WEBP_SWAP_16BIT_CSP == 1)
argb[0] = ba;
argb[1] = rg; #else
argb[0] = rg;
argb[1] = ba; #endif
}
} #endif// WEBP_REDUCE_CSP
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.