aboutsummaryrefslogtreecommitdiffstats
path: root/libswscale/swscale.c
diff options
context:
space:
mode:
authorReinhard Tartler <siretart@tauware.de>2010-06-03 20:16:42 +0000
committerReinhard Tartler <siretart@tauware.de>2010-06-03 20:16:42 +0000
commit20d4a1f020242fa2df2399728310d5549b52091e (patch)
tree664cebd4f0ca67d70b4140647d1273b31746d216 /libswscale/swscale.c
parente5880b3f24292ee86929d4cab7fd98d7afed1feb (diff)
downloadffmpeg-20d4a1f020242fa2df2399728310d5549b52091e.tar.gz
Add an entry to APIchanges for the addition of sws_convertPalette8ToPacked32 -24
backport r23415 by siretart Originally committed as revision 23446 to svn://svn.ffmpeg.org/ffmpeg/branches/0.6
Diffstat (limited to 'libswscale/swscale.c')
-rw-r--r--libswscale/swscale.c35
1 files changed, 29 insertions, 6 deletions
diff --git a/libswscale/swscale.c b/libswscale/swscale.c
index 2b02dd3dfd..81f475c6e2 100644
--- a/libswscale/swscale.c
+++ b/libswscale/swscale.c
@@ -1424,12 +1424,12 @@ static int palToRgbWrapper(SwsContext *c, const uint8_t* src[], int srcStride[],
if (usePal(srcFormat)) {
switch (dstFormat) {
- case PIX_FMT_RGB32 : conv = palette8topacked32; break;
- case PIX_FMT_BGR32 : conv = palette8topacked32; break;
- case PIX_FMT_BGR32_1: conv = palette8topacked32; break;
- case PIX_FMT_RGB32_1: conv = palette8topacked32; break;
- case PIX_FMT_RGB24 : conv = palette8topacked24; break;
- case PIX_FMT_BGR24 : conv = palette8topacked24; break;
+ case PIX_FMT_RGB32 : conv = sws_convertPalette8ToPacked32; break;
+ case PIX_FMT_BGR32 : conv = sws_convertPalette8ToPacked32; break;
+ case PIX_FMT_BGR32_1: conv = sws_convertPalette8ToPacked32; break;
+ case PIX_FMT_RGB32_1: conv = sws_convertPalette8ToPacked32; break;
+ case PIX_FMT_RGB24 : conv = sws_convertPalette8ToPacked24; break;
+ case PIX_FMT_BGR24 : conv = sws_convertPalette8ToPacked24; break;
}
}
@@ -1962,3 +1962,26 @@ int sws_scale_ordered(SwsContext *c, const uint8_t* const src[], int srcStride[]
return sws_scale(c, src, srcStride, srcSliceY, srcSliceH, dst, dstStride);
}
#endif
+
+/* Convert the palette to the same packed 32-bit format as the palette */
+void sws_convertPalette8ToPacked32(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette)
+{
+ long i;
+
+ for (i=0; i<num_pixels; i++)
+ ((uint32_t *) dst)[i] = ((const uint32_t *) palette)[src[i]];
+}
+
+/* Palette format: ABCD -> dst format: ABC */
+void sws_convertPalette8ToPacked24(const uint8_t *src, uint8_t *dst, long num_pixels, const uint8_t *palette)
+{
+ long i;
+
+ for (i=0; i<num_pixels; i++) {
+ //FIXME slow?
+ dst[0]= palette[src[i]*4+0];
+ dst[1]= palette[src[i]*4+1];
+ dst[2]= palette[src[i]*4+2];
+ dst+= 3;
+ }
+}