Mercurial > mplayer.hg
comparison libswscale/rgb2rgb_template.c @ 27158:65b8334df960
spelling/grammar/wording overhaul
author | diego |
---|---|
date | Fri, 04 Jul 2008 13:49:45 +0000 |
parents | 3f6d2ca29727 |
children | e05965c550fc |
comparison
equal
deleted
inserted
replaced
27157:e2797c291ba9 | 27158:65b8334df960 |
---|---|
1 /* | 1 /* |
2 * rgb2rgb.c, Software RGB to RGB convertor | 2 * software RGB to RGB converter |
3 * pluralize by Software PAL8 to RGB convertor | 3 * pluralize by software PAL8 to RGB converter |
4 * Software YUV to YUV convertor | 4 * software YUV to YUV converter |
5 * Software YUV to RGB convertor | 5 * software YUV to RGB converter |
6 * Written by Nick Kurshev. | 6 * Written by Nick Kurshev. |
7 * palette & YUV & runtime CPU stuff by Michael (michaelni@gmx.at) | 7 * palette & YUV & runtime CPU stuff by Michael (michaelni@gmx.at) |
8 * lot of big-endian byteorder fixes by Alex Beregszaszi | 8 * lot of big-endian byte order fixes by Alex Beregszaszi |
9 * | 9 * |
10 * This file is part of FFmpeg. | 10 * This file is part of FFmpeg. |
11 * | 11 * |
12 * FFmpeg is free software; you can redistribute it and/or modify | 12 * FFmpeg is free software; you can redistribute it and/or modify |
13 * it under the terms of the GNU General Public License as published by | 13 * it under the terms of the GNU General Public License as published by |
21 * | 21 * |
22 * You should have received a copy of the GNU General Public License | 22 * You should have received a copy of the GNU General Public License |
23 * along with FFmpeg; if not, write to the Free Software | 23 * along with FFmpeg; if not, write to the Free Software |
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
25 * | 25 * |
26 * The C code (not assembly, mmx, ...) of this file can be used | 26 * The C code (not assembly, MMX, ...) of this file can be used |
27 * under the LGPL license. | 27 * under the LGPL license. |
28 */ | 28 */ |
29 | 29 |
30 #include <stddef.h> | 30 #include <stddef.h> |
31 #include <inttypes.h> /* for __WORDSIZE */ | 31 #include <inttypes.h> /* for __WORDSIZE */ |
227 #endif | 227 #endif |
228 } | 228 } |
229 } | 229 } |
230 | 230 |
231 /* | 231 /* |
232 Original by Strepto/Astral | 232 original by Strepto/Astral |
233 ported to gcc & bugfixed : A'rpi | 233 ported to gcc & bugfixed: A'rpi |
234 MMX2, 3DNOW optimization by Nick Kurshev | 234 MMX2, 3DNOW optimization by Nick Kurshev |
235 32 bit C version, and and&add trick by Michael Niedermayer | 235 32-bit C version, and and&add trick by Michael Niedermayer |
236 */ | 236 */ |
237 static inline void RENAME(rgb15to16)(const uint8_t *src, uint8_t *dst, long src_size) | 237 static inline void RENAME(rgb15to16)(const uint8_t *src, uint8_t *dst, long src_size) |
238 { | 238 { |
239 register const uint8_t* s=src; | 239 register const uint8_t* s=src; |
240 register uint8_t* d=dst; | 240 register uint8_t* d=dst; |
924 | 924 |
925 7 6 5 4 3 2 1 0 | 925 7 6 5 4 3 2 1 0 |
926 ---------------- | 926 ---------------- |
927 1 1 0 1 1 1 1 0 | 927 1 1 0 1 1 1 1 0 |
928 |=======| |===| | 928 |=======| |===| |
929 | Leftmost Bits Repeated to Fill Open Bits | 929 | leftmost bits repeated to fill open bits |
930 | | 930 | |
931 Original Bits | 931 original bits |
932 */ | 932 */ |
933 static inline void RENAME(rgb15to24)(const uint8_t *src, uint8_t *dst, long src_size) | 933 static inline void RENAME(rgb15to24)(const uint8_t *src, uint8_t *dst, long src_size) |
934 { | 934 { |
935 const uint16_t *end; | 935 const uint16_t *end; |
936 #ifdef HAVE_MMX | 936 #ifdef HAVE_MMX |
1004 "por %%mm5, %%mm3 \n\t" | 1004 "por %%mm5, %%mm3 \n\t" |
1005 | 1005 |
1006 :"=m"(*d) | 1006 :"=m"(*d) |
1007 :"m"(*s),"m"(mask15b),"m"(mask15g),"m"(mask15r), "m"(mmx_null) | 1007 :"m"(*s),"m"(mask15b),"m"(mask15g),"m"(mask15r), "m"(mmx_null) |
1008 :"memory"); | 1008 :"memory"); |
1009 /* Borrowed 32 to 24 */ | 1009 /* borrowed 32 to 24 */ |
1010 asm volatile( | 1010 asm volatile( |
1011 "movq %%mm0, %%mm4 \n\t" | 1011 "movq %%mm0, %%mm4 \n\t" |
1012 "movq %%mm3, %%mm5 \n\t" | 1012 "movq %%mm3, %%mm5 \n\t" |
1013 "movq %%mm6, %%mm0 \n\t" | 1013 "movq %%mm6, %%mm0 \n\t" |
1014 "movq %%mm7, %%mm1 \n\t" | 1014 "movq %%mm7, %%mm1 \n\t" |
1145 "por %%mm4, %%mm3 \n\t" | 1145 "por %%mm4, %%mm3 \n\t" |
1146 "por %%mm5, %%mm3 \n\t" | 1146 "por %%mm5, %%mm3 \n\t" |
1147 :"=m"(*d) | 1147 :"=m"(*d) |
1148 :"m"(*s),"m"(mask16b),"m"(mask16g),"m"(mask16r),"m"(mmx_null) | 1148 :"m"(*s),"m"(mask16b),"m"(mask16g),"m"(mask16r),"m"(mmx_null) |
1149 :"memory"); | 1149 :"memory"); |
1150 /* Borrowed 32 to 24 */ | 1150 /* borrowed 32 to 24 */ |
1151 asm volatile( | 1151 asm volatile( |
1152 "movq %%mm0, %%mm4 \n\t" | 1152 "movq %%mm0, %%mm4 \n\t" |
1153 "movq %%mm3, %%mm5 \n\t" | 1153 "movq %%mm3, %%mm5 \n\t" |
1154 "movq %%mm6, %%mm0 \n\t" | 1154 "movq %%mm6, %%mm0 \n\t" |
1155 "movq %%mm7, %%mm1 \n\t" | 1155 "movq %%mm7, %%mm1 \n\t" |
1477 ); | 1477 ); |
1478 | 1478 |
1479 asm volatile(SFENCE:::"memory"); | 1479 asm volatile(SFENCE:::"memory"); |
1480 asm volatile(EMMS:::"memory"); | 1480 asm volatile(EMMS:::"memory"); |
1481 | 1481 |
1482 if (mmx_size==23) return; //finihsed, was multiple of 8 | 1482 if (mmx_size==23) return; //finished, was multiple of 8 |
1483 | 1483 |
1484 src+= src_size; | 1484 src+= src_size; |
1485 dst+= src_size; | 1485 dst+= src_size; |
1486 src_size= 23-mmx_size; | 1486 src_size= 23-mmx_size; |
1487 src-= src_size; | 1487 src-= src_size; |
1636 :::"memory"); | 1636 :::"memory"); |
1637 #endif | 1637 #endif |
1638 } | 1638 } |
1639 | 1639 |
1640 /** | 1640 /** |
1641 * Height should be a multiple of 2 and width should be a multiple of 16 (if | 1641 * Height should be a multiple of 2 and width should be a multiple of 16. |
1642 * this is a problem for anyone then tell me, and I will fix it). | 1642 * (If this is a problem for anyone then tell me, and I will fix it.) |
1643 */ | 1643 */ |
1644 static inline void RENAME(yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, | 1644 static inline void RENAME(yv12toyuy2)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, |
1645 long width, long height, | 1645 long width, long height, |
1646 long lumStride, long chromStride, long dstStride) | 1646 long lumStride, long chromStride, long dstStride) |
1647 { | 1647 { |
1718 #ifdef WORDS_BIGENDIAN | 1718 #ifdef WORDS_BIGENDIAN |
1719 *idst++ = (uc[0] << 24)+ (yc[0] << 16) + | 1719 *idst++ = (uc[0] << 24)+ (yc[0] << 16) + |
1720 (vc[0] << 8) + (yc[1] << 0); | 1720 (vc[0] << 8) + (yc[1] << 0); |
1721 #else | 1721 #else |
1722 *idst++ = uc[0] + (yc[0] << 8) + | 1722 *idst++ = uc[0] + (yc[0] << 8) + |
1723 (vc[0] << 16) + (yc[1] << 24); | 1723 (vc[0] << 16) + (yc[1] << 24); |
1724 #endif | 1724 #endif |
1725 yc += 2; | 1725 yc += 2; |
1726 uc++; | 1726 uc++; |
1727 vc++; | 1727 vc++; |
1728 } | 1728 } |
1742 :::"memory"); | 1742 :::"memory"); |
1743 #endif | 1743 #endif |
1744 } | 1744 } |
1745 | 1745 |
1746 /** | 1746 /** |
1747 * Height should be a multiple of 2 and width should be a multiple of 16 (if | 1747 * Height should be a multiple of 2 and width should be a multiple of 16 |
1748 * this is a problem for anyone then tell me, and I will fix it). | 1748 * (If this is a problem for anyone then tell me, and I will fix it.) |
1749 */ | 1749 */ |
1750 static inline void RENAME(yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, | 1750 static inline void RENAME(yv12touyvy)(const uint8_t *ysrc, const uint8_t *usrc, const uint8_t *vsrc, uint8_t *dst, |
1751 long width, long height, | 1751 long width, long height, |
1752 long lumStride, long chromStride, long dstStride) | 1752 long lumStride, long chromStride, long dstStride) |
1753 { | 1753 { |
1764 { | 1764 { |
1765 RENAME(yuvPlanartoyuy2)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 1); | 1765 RENAME(yuvPlanartoyuy2)(ysrc, usrc, vsrc, dst, width, height, lumStride, chromStride, dstStride, 1); |
1766 } | 1766 } |
1767 | 1767 |
1768 /** | 1768 /** |
1769 * Height should be a multiple of 2 and width should be a multiple of 16 (if | 1769 * Height should be a multiple of 2 and width should be a multiple of 16. |
1770 * this is a problem for anyone then tell me, and I will fix it). | 1770 * (If this is a problem for anyone then tell me, and I will fix it.) |
1771 */ | 1771 */ |
1772 static inline void RENAME(yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, | 1772 static inline void RENAME(yuy2toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, |
1773 long width, long height, | 1773 long width, long height, |
1774 long lumStride, long chromStride, long srcStride) | 1774 long lumStride, long chromStride, long srcStride) |
1775 { | 1775 { |
2000 :::"memory"); | 2000 :::"memory"); |
2001 #endif | 2001 #endif |
2002 } | 2002 } |
2003 | 2003 |
2004 /** | 2004 /** |
2005 * Height should be a multiple of 2 and width should be a multiple of 16 (if | 2005 * Height should be a multiple of 2 and width should be a multiple of 16. |
2006 * this is a problem for anyone then tell me, and I will fix it). | 2006 * (If this is a problem for anyone then tell me, and I will fix it.) |
2007 * Chrominance data is only taken from every secound line, others are ignored. | 2007 * Chrominance data is only taken from every second line, others are ignored. |
2008 * FIXME: Write HQ version. | 2008 * FIXME: Write HQ version. |
2009 */ | 2009 */ |
2010 static inline void RENAME(uyvytoyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, | 2010 static inline void RENAME(uyvytoyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, |
2011 long width, long height, | 2011 long width, long height, |
2012 long lumStride, long chromStride, long srcStride) | 2012 long lumStride, long chromStride, long srcStride) |
2126 :::"memory"); | 2126 :::"memory"); |
2127 #endif | 2127 #endif |
2128 } | 2128 } |
2129 | 2129 |
2130 /** | 2130 /** |
2131 * Height should be a multiple of 2 and width should be a multiple of 2 (if | 2131 * Height should be a multiple of 2 and width should be a multiple of 2. |
2132 * this is a problem for anyone then tell me, and I will fix it). | 2132 * (If this is a problem for anyone then tell me, and I will fix it.) |
2133 * Chrominance data is only taken from every secound line, | 2133 * Chrominance data is only taken from every second line, |
2134 * others are ignored in the C version. | 2134 * others are ignored in the C version. |
2135 * FIXME: Write HQ version. | 2135 * FIXME: Write HQ version. |
2136 */ | 2136 */ |
2137 static inline void RENAME(rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, | 2137 static inline void RENAME(rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_t *udst, uint8_t *vdst, |
2138 long width, long height, | 2138 long width, long height, |