1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

rgb2rgb: rgb12tobgr12()

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
This commit is contained in:
Paul B Mahol 2012-01-11 19:19:00 +00:00 committed by Ronald S. Bultje
parent b5fc571e4f
commit f7f3563214
3 changed files with 15 additions and 0 deletions

View File

@ -282,6 +282,19 @@ void rgb15tobgr15(const uint8_t *src, uint8_t *dst, int src_size)
} }
} }
void rgb12tobgr12(const uint8_t *src, uint8_t *dst, int src_size)
{
uint16_t *d = (uint16_t*)dst;
uint16_t *s = (uint16_t*)src;
int i;
int num_pixels = src_size >> 1;
for (i = 0; i < num_pixels; i++) {
unsigned rgb = s[i];
d[i] = (rgb << 8 | rgb & 0xF0 | rgb >> 8) & 0xFFF;
}
}
void bgr8torgb8(const uint8_t *src, uint8_t *dst, int src_size) void bgr8torgb8(const uint8_t *src, uint8_t *dst, int src_size)
{ {
int i; int i;

View File

@ -62,6 +62,7 @@ void rgb15tobgr32(const uint8_t *src, uint8_t *dst, int src_size);
void rgb15to24(const uint8_t *src, uint8_t *dst, int src_size); void rgb15to24(const uint8_t *src, uint8_t *dst, int src_size);
void rgb15tobgr16(const uint8_t *src, uint8_t *dst, int src_size); void rgb15tobgr16(const uint8_t *src, uint8_t *dst, int src_size);
void rgb15tobgr15(const uint8_t *src, uint8_t *dst, int src_size); void rgb15tobgr15(const uint8_t *src, uint8_t *dst, int src_size);
void rgb12tobgr12(const uint8_t *src, uint8_t *dst, int src_size);
void bgr8torgb8(const uint8_t *src, uint8_t *dst, int src_size); void bgr8torgb8(const uint8_t *src, uint8_t *dst, int src_size);
void shuffle_bytes_0321(const uint8_t *src, uint8_t *dst, int src_size); void shuffle_bytes_0321(const uint8_t *src, uint8_t *dst, int src_size);

View File

@ -400,6 +400,7 @@ static int rgbToRgbWrapper(SwsContext *c, const uint8_t *src[], int srcStride[],
} else if ((isBGRinInt(srcFormat) && isRGBinInt(dstFormat)) || } else if ((isBGRinInt(srcFormat) && isRGBinInt(dstFormat)) ||
(isRGBinInt(srcFormat) && isBGRinInt(dstFormat))) { (isRGBinInt(srcFormat) && isBGRinInt(dstFormat))) {
switch (srcId | (dstId << 16)) { switch (srcId | (dstId << 16)) {
case 0x000C000C: conv = rgb12tobgr12; break;
case 0x000F000F: conv = rgb15tobgr15; break; case 0x000F000F: conv = rgb15tobgr15; break;
case 0x000F0010: conv = rgb16tobgr15; break; case 0x000F0010: conv = rgb16tobgr15; break;
case 0x000F0018: conv = rgb24tobgr15; break; case 0x000F0018: conv = rgb24tobgr15; break;