#include "gfx_conv_mmx.h"
#include "gfx_conv_c.h"
extern "C" void _Convert_YUV422_RGBA32_SSE(void *fromYPtr, void *toPtr,
int width);
extern "C" void _Convert_YUV422_RGBA32_SSE2(void *fromYPtr, void *toPtr,
int width);
extern "C" void _Convert_YUV422_RGBA32_SSSE3(void *fromYPtr, void *toPtr,
int width);
extern "C" void _Convert_YUV420P_RGBA32_SSE(void *fromYPtr, void *fromUPtr,
void *fromVPtr, void *toPtr, int width);
extern "C" void _Convert_YUV420P_RGBA32_SSE2(void *fromYPtr, void *fromUPtr,
void *fromVPtr, void *toPtr, int width);
extern "C" void _Convert_YUV420P_RGBA32_SSSE3(void *fromYPtr, void *fromUPtr,
void *fromVPtr, void *toPtr, int width);
void
gfx_conv_yuv420p_rgba32_sse(AVFrame *in, AVFrame *out, int width, int height)
{
if ((off_t)out->data[0] % 16 != 0) {
gfx_conv_YCbCr420p_RGB32_c(in, out, width, height);
return;
}
uint8 *ybase = (uint8 *)in->data[0];
uint8 *ubase = (uint8 *)in->data[1];
uint8 *vbase = (uint8 *)in->data[2];
uint8 *rgbbase = (uint8 *)out->data[0];
int yBaseInc = in->linesize[0];
int uBaseInc = in->linesize[1];
int vBaseInc = in->linesize[2];
int rgbBaseInc = out->linesize[0];
for (int i=0;i<height;i+=2) {
_Convert_YUV420P_RGBA32_SSE(ybase, ubase, vbase, rgbbase, width);
ybase += yBaseInc;
rgbbase += rgbBaseInc;
_Convert_YUV420P_RGBA32_SSE(ybase, ubase, vbase, rgbbase, width);
ybase += yBaseInc;
ubase += uBaseInc;
vbase += vBaseInc;
rgbbase += rgbBaseInc;
}
}
void
gfx_conv_yuv420p_rgba32_sse2(AVFrame *in, AVFrame *out, int width, int height)
{
if ((off_t)out->data[0] % 32 != 0) {
gfx_conv_YCbCr420p_RGB32_c(in, out, width, height);
return;
}
uint8 *ybase = (uint8 *)in->data[0];
uint8 *ubase = (uint8 *)in->data[1];
uint8 *vbase = (uint8 *)in->data[2];
uint8 *rgbbase = (uint8 *)out->data[0];
int yBaseInc = in->linesize[0];
int uBaseInc = in->linesize[1];
int vBaseInc = in->linesize[2];
int rgbBaseInc = out->linesize[0];
for (int i=0;i<height;i+=2) {
_Convert_YUV420P_RGBA32_SSE2(ybase, ubase, vbase, rgbbase, width);
ybase += yBaseInc;
rgbbase += rgbBaseInc;
_Convert_YUV420P_RGBA32_SSE2(ybase, ubase, vbase, rgbbase, width);
ybase += yBaseInc;
ubase += uBaseInc;
vbase += vBaseInc;
rgbbase += rgbBaseInc;
}
}
void
gfx_conv_yuv420p_rgba32_ssse3(AVFrame *in, AVFrame *out, int width, int height)
{
if ((off_t)out->data[0] % 32 != 0) {
gfx_conv_YCbCr420p_RGB32_c(in, out, width, height);
return;
}
uint8 *ybase = (uint8 *)in->data[0];
uint8 *ubase = (uint8 *)in->data[1];
uint8 *vbase = (uint8 *)in->data[2];
uint8 *rgbbase = (uint8 *)out->data[0];
int yBaseInc = in->linesize[0];
int uBaseInc = in->linesize[1];
int vBaseInc = in->linesize[2];
int rgbBaseInc = out->linesize[0];
for (int i=0;i<height;i+=2) {
_Convert_YUV420P_RGBA32_SSSE3(ybase, ubase, vbase, rgbbase, width);
ybase += yBaseInc;
rgbbase += rgbBaseInc;
_Convert_YUV420P_RGBA32_SSSE3(ybase, ubase, vbase, rgbbase, width);
ybase += yBaseInc;
ubase += uBaseInc;
vbase += vBaseInc;
rgbbase += rgbBaseInc;
}
}
void
gfx_conv_yuv422p_rgba32_sse(AVFrame *in, AVFrame *out, int width, int height)
{
if ((off_t)out->data[0] % 32 != 0) {
gfx_conv_YCbCr422_RGB32_c(in, out, width, height);
return;
}
uint8 *ybase = (uint8 *)in->data[0];
uint8 *ubase = (uint8 *)in->data[1];
uint8 *vbase = (uint8 *)in->data[2];
uint8 *rgbbase = (uint8 *)out->data[0];
int yBaseInc = in->linesize[0];
int uBaseInc = in->linesize[1];
int vBaseInc = in->linesize[2];
int rgbBaseInc = out->linesize[0];
for (int i=0;i<height;i++) {
_Convert_YUV420P_RGBA32_SSE(ybase, ubase, vbase, rgbbase, width);
ybase += yBaseInc;
ubase += uBaseInc;
vbase += vBaseInc;
rgbbase += rgbBaseInc;
}
}
void
gfx_conv_yuv422p_rgba32_sse2(AVFrame *in, AVFrame *out, int width, int height)
{
if ((off_t)out->data[0] % 32 != 0) {
gfx_conv_YCbCr422_RGB32_c(in, out, width, height);
return;
}
uint8 *ybase = (uint8 *)in->data[0];
uint8 *ubase = (uint8 *)in->data[1];
uint8 *vbase = (uint8 *)in->data[2];
uint8 *rgbbase = (uint8 *)out->data[0];
int yBaseInc = in->linesize[0];
int uBaseInc = in->linesize[1];
int vBaseInc = in->linesize[2];
int rgbBaseInc = out->linesize[0];
for (int i=0;i<height;i++) {
_Convert_YUV420P_RGBA32_SSE2(ybase, ubase, vbase, rgbbase, width);
ybase += yBaseInc;
ubase += uBaseInc;
vbase += vBaseInc;
rgbbase += rgbBaseInc;
}
}
void
gfx_conv_yuv422p_rgba32_ssse3(AVFrame *in, AVFrame *out, int width, int height)
{
if ((off_t)out->data[0] % 32 != 0) {
gfx_conv_YCbCr422_RGB32_c(in, out, width, height);
return;
}
uint8 *ybase = (uint8 *)in->data[0];
uint8 *ubase = (uint8 *)in->data[1];
uint8 *vbase = (uint8 *)in->data[2];
uint8 *rgbbase = (uint8 *)out->data[0];
int yBaseInc = in->linesize[0];
int uBaseInc = in->linesize[1];
int vBaseInc = in->linesize[2];
int rgbBaseInc = out->linesize[0];
for (int i=0;i<height;i++) {
_Convert_YUV420P_RGBA32_SSSE3(ybase, ubase, vbase, rgbbase, width);
ybase += yBaseInc;
ubase += uBaseInc;
vbase += vBaseInc;
rgbbase += rgbBaseInc;
}
}
void
gfx_conv_yuv422_rgba32_sse(AVFrame *in, AVFrame *out, int width, int height)
{
if ((off_t)out->data[0] % 16 != 0) {
gfx_conv_YCbCr422_RGB32_c(in, out, width, height);
return;
}
uint8 *ybase = (uint8 *)in->data[0];
uint8 *rgbbase = (uint8 *)out->data[0];
for (int i = 0; i <= height; i++) {
_Convert_YUV422_RGBA32_SSE(ybase, rgbbase, width);
ybase += in->linesize[0];
rgbbase += out->linesize[0];
}
}
void
gfx_conv_yuv422_rgba32_sse2(AVFrame *in, AVFrame *out, int width, int height)
{
if ((off_t)out->data[0] % 32 != 0) {
gfx_conv_YCbCr422_RGB32_c(in, out, width, height);
return;
}
uint8 *ybase = (uint8 *)in->data[0];
uint8 *rgbbase = (uint8 *)out->data[0];
for (int i = 0; i <= height; i++) {
_Convert_YUV422_RGBA32_SSE2(ybase, rgbbase, width);
ybase += in->linesize[0];
rgbbase += out->linesize[0];
}
}
void
gfx_conv_yuv422_rgba32_ssse3(AVFrame *in, AVFrame *out, int width, int height)
{
if ((off_t)out->data[0] % 32 != 0) {
gfx_conv_YCbCr422_RGB32_c(in, out, width, height);
return;
}
uint8 *ybase = (uint8 *)in->data[0];
uint8 *rgbbase = (uint8 *)out->data[0];
for (int i = 0; i <= height; i++) {
_Convert_YUV422_RGBA32_SSSE3(ybase, rgbbase, width);
ybase += in->linesize[0];
rgbbase += out->linesize[0];
}
}