[FFmpeg-devel] [PATCH] document and make av_set_systematic_pal public

Reinhard Tartler siretart
Wed Feb 9 22:36:39 CET 2011


This function was formerly known by the name ff_set_systematic_pal2
---
 libavcodec/bmpenc.c     |    2 +-
 libavcodec/imgconvert.c |    2 +-
 libavcodec/rawdec.c     |    2 +-
 libavcodec/utils.c      |    2 +-
 libavutil/imgutils.c    |    4 ++--
 libavutil/imgutils.h    |    9 ++++++++-
 6 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/libavcodec/bmpenc.c b/libavcodec/bmpenc.c
index b8f9047..f6a2a33 100644
--- a/libavcodec/bmpenc.c
+++ b/libavcodec/bmpenc.c
@@ -87,7 +87,7 @@ static int bmp_encode_frame(AVCodecContext *avctx, unsigned char *buf, int buf_s
     case PIX_FMT_RGB4_BYTE:
     case PIX_FMT_BGR4_BYTE:
     case PIX_FMT_GRAY8:
-        ff_set_systematic_pal2((uint32_t*)p->data[1], avctx->pix_fmt);
+        av_set_systematic_pal((uint32_t*)p->data[1], avctx->pix_fmt);
     case PIX_FMT_PAL8:
         pal = (uint32_t *)p->data[1];
         break;
diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c
index b37c343..ca88bc8 100644
--- a/libavcodec/imgconvert.c
+++ b/libavcodec/imgconvert.c
@@ -444,7 +444,7 @@ int ff_is_hwaccel_pix_fmt(enum PixelFormat pix_fmt)
 
 #if LIBAVCODEC_VERSION_MAJOR < 53
 int ff_set_systematic_pal(uint32_t pal[256], enum PixelFormat pix_fmt){
-    return ff_set_systematic_pal2(pal, pix_fmt);
+    return av_set_systematic_pal(pal, pix_fmt);
 }
 
 int ff_fill_linesize(AVPicture *picture, enum PixelFormat pix_fmt, int width)
diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index baffceb..29430a4 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -83,7 +83,7 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx)
     else if (avctx->pix_fmt == PIX_FMT_NONE && avctx->bits_per_coded_sample)
         avctx->pix_fmt = find_pix_fmt(pix_fmt_bps_avi, avctx->bits_per_coded_sample);
 
-    ff_set_systematic_pal2(context->palette, avctx->pix_fmt);
+    av_set_systematic_pal(context->palette, avctx->pix_fmt);
     context->length = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height);
     if((avctx->bits_per_coded_sample == 4 || avctx->bits_per_coded_sample == 2) &&
        avctx->pix_fmt==PIX_FMT_PAL8 &&
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 1d1913d..775f769 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -328,7 +328,7 @@ int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){
                 buf->data[i] = buf->base[i] + FFALIGN((buf->linesize[i]*EDGE_WIDTH>>v_shift) + (EDGE_WIDTH>>h_shift), stride_align[i]);
         }
         if(size[1] && !size[2])
-            ff_set_systematic_pal2((uint32_t*)buf->data[1], s->pix_fmt);
+            av_set_systematic_pal((uint32_t*)buf->data[1], s->pix_fmt);
         buf->width  = s->width;
         buf->height = s->height;
         buf->pix_fmt= s->pix_fmt;
diff --git a/libavutil/imgutils.c b/libavutil/imgutils.c
index 0f449ff..ea69b8a 100644
--- a/libavutil/imgutils.c
+++ b/libavutil/imgutils.c
@@ -132,7 +132,7 @@ int av_image_fill_pointers(uint8_t *data[4], enum PixelFormat pix_fmt, int heigh
     return total_size;
 }
 
-int ff_set_systematic_pal2(uint32_t pal[256], enum PixelFormat pix_fmt)
+int av_set_systematic_pal(uint32_t pal[256], enum PixelFormat pix_fmt)
 {
     int i;
 
@@ -196,7 +196,7 @@ int av_image_alloc(uint8_t *pointers[4], int linesizes[4],
         return ret;
     }
     if (av_pix_fmt_descriptors[pix_fmt].flags & PIX_FMT_PAL)
-        ff_set_systematic_pal2((uint32_t*)pointers[1], pix_fmt);
+        av_set_systematic_pal((uint32_t*)pointers[1], pix_fmt);
 
     return ret;
 }
diff --git a/libavutil/imgutils.h b/libavutil/imgutils.h
index c181863..52b9806 100644
--- a/libavutil/imgutils.h
+++ b/libavutil/imgutils.h
@@ -125,7 +125,14 @@ void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],
  */
 int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx);
 
-int ff_set_systematic_pal2(uint32_t pal[256], enum PixelFormat pix_fmt);
+
+/**
+ * Set a palette for 8bit formats. All of the given palette is overwritten.
+ *
+ * @param pal the palette to set
+ * @param pix_fmt must be an 8 bit pixel format
+ */
+int av_set_systematic_pal(uint32_t pal[256], enum PixelFormat pix_fmt);
 
 #if FF_API_OLD_IMAGE_NAMES
 attribute_deprecated
-- 
1.7.0.4




More information about the ffmpeg-devel mailing list