Commit 4ad40d6d authored by Paul B Mahol's avatar Paul B Mahol

rgb2rgb: rgb12tobgr12()

parent 27703062
......@@ -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)
{
int i;
int num_pixels = src_size >> 1;
for (i = 0; i < num_pixels; i++) {
unsigned br;
unsigned rgb = ((const uint16_t *)src)[i];
br = rgb & 0x0F0F;
((uint16_t *)dst)[i] = (br >> 8) | (rgb & 0x00F0) | (br << 8);
}
}
void bgr8torgb8(const uint8_t *src, uint8_t *dst, int src_size)
{
int i;
......
......@@ -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 rgb15tobgr16(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 shuffle_bytes_0321(const uint8_t *src, uint8_t *dst, int src_size);
......
......@@ -444,6 +444,7 @@ static int rgbToRgbWrapper(SwsContext *c, const uint8_t *src[], int srcStride[],
} else if ((isBGRinInt(srcFormat) && isRGBinInt(dstFormat)) ||
(isRGBinInt(srcFormat) && isBGRinInt(dstFormat))) {
switch (srcId | (dstId << 16)) {
case 0x000C000C: conv = rgb12tobgr12; break;
case 0x000F000F: conv = rgb15tobgr15; break;
case 0x000F0010: conv = rgb16tobgr15; break;
case 0x000F0018: conv = rgb24tobgr15; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment