aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2009-04-01 21:07:49 +0000
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2009-04-01 21:07:49 +0000
commit0a47f60aa8a25bc71f717f4d8c09d46b2d16e5ba (patch)
tree74b080fc206b8c08e8f9181f0c958137a8b65872
parent710441c2f628be7d7bc18b8fd682520fd74e1526 (diff)
downloadffmpeg-0a47f60aa8a25bc71f717f4d8c09d46b2d16e5ba.tar.gz
Extend read_line() to make it take a read_pal_component parameter.
Originally committed as revision 18303 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavcodec/pixdesc.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/libavcodec/pixdesc.h b/libavcodec/pixdesc.h
index bc0c5559c6..6ad217acee 100644
--- a/libavcodec/pixdesc.h
+++ b/libavcodec/pixdesc.h
@@ -94,8 +94,13 @@ extern const AVPixFmtDescriptor av_pix_fmt_descriptors[];
* @param y the vertical coordinate of the first pixel to read
* @param w the width of the line to read, that is the number of
* values to write to \p dst
+ * @param read_pal_component if not zero and the format is a paletted
+ * format writes to \p dst the values corresponding to the palette
+ * component \p c in data[1], rather than the palette indexes in
+ * data[0]. The behavior is undefined if the format is not paletted.
*/
-static inline void read_line(uint16_t *dst, const uint8_t *data[4], const int linesize[4], const AVPixFmtDescriptor *desc, int x, int y, int c, int w)
+static inline void read_line(uint16_t *dst, const uint8_t *data[4], const int linesize[4],
+ const AVPixFmtDescriptor *desc, int x, int y, int c, int w, int read_pal_component)
{
AVComponentDescriptor comp= desc->comp[c];
int plane= comp.plane;
@@ -112,7 +117,7 @@ static inline void read_line(uint16_t *dst, const uint8_t *data[4], const int li
while(w--){
int val = show_bits(&gb, depth);
- if(flags & PIX_FMT_PAL)
+ if(read_pal_component)
val= data[1][4*val + c];
skip_bits(&gb, step);
*dst++= val;
@@ -125,7 +130,7 @@ static inline void read_line(uint16_t *dst, const uint8_t *data[4], const int li
if(flags & PIX_FMT_BE) val= AV_RB16(p);
else val= AV_RL16(p);
val = (val>>shift) & mask;
- if(flags & PIX_FMT_PAL)
+ if(read_pal_component)
val= data[1][4*val + c];
p+= step;
*dst++= val;