]> git.sesse.net Git - ffmpeg/commitdiff
Move internal function ff_set_systematic_pal() to libavcore, and
authorStefano Sabatini <stefano.sabatini-lala@poste.it>
Tue, 9 Nov 2010 22:22:36 +0000 (22:22 +0000)
committerStefano Sabatini <stefano.sabatini-lala@poste.it>
Tue, 9 Nov 2010 22:22:36 +0000 (22:22 +0000)
rename it ff_set_systematic_pal2().

Originally committed as revision 25712 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/avcodec.h
libavcodec/imgconvert.c
libavcodec/imgconvert.h
libavcodec/rawdec.c
libavcodec/utils.c
libavcore/avcore.h
libavcore/imgutils.c
libavcore/internal.h [new file with mode: 0644]

index 64054556188d19db74ab2bffb0b974d0b65803db..7f28e9e9ff22ae642df8caf7c970dd71e58a8230 100644 (file)
@@ -33,7 +33,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR 52
 #define LIBAVCODEC_VERSION_MINOR 94
-#define LIBAVCODEC_VERSION_MICRO  3
+#define LIBAVCODEC_VERSION_MICRO  4
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \
index 2574ec8fcc32eb326212acd90017148e7aed3715..2e63d27ac1d72ef52fede5735a7c295cf3acca50 100644 (file)
@@ -37,6 +37,7 @@
 #include "libavutil/colorspace.h"
 #include "libavutil/pixdesc.h"
 #include "libavcore/imgutils.h"
+#include "libavcore/internal.h"
 
 #if HAVE_MMX && HAVE_YASM
 #include "x86/dsputil_mmx.h"
@@ -456,46 +457,11 @@ int ff_is_hwaccel_pix_fmt(enum PixelFormat pix_fmt)
     return av_pix_fmt_descriptors[pix_fmt].flags & PIX_FMT_HWACCEL;
 }
 
+#if LIBAVCODEC_VERSION_MAJOR < 53
 int ff_set_systematic_pal(uint32_t pal[256], enum PixelFormat pix_fmt){
-    int i;
-
-    for(i=0; i<256; i++){
-        int r,g,b;
-
-        switch(pix_fmt) {
-        case PIX_FMT_RGB8:
-            r= (i>>5    )*36;
-            g= ((i>>2)&7)*36;
-            b= (i&3     )*85;
-            break;
-        case PIX_FMT_BGR8:
-            b= (i>>6    )*85;
-            g= ((i>>3)&7)*36;
-            r= (i&7     )*36;
-            break;
-        case PIX_FMT_RGB4_BYTE:
-            r= (i>>3    )*255;
-            g= ((i>>1)&3)*85;
-            b= (i&1     )*255;
-            break;
-        case PIX_FMT_BGR4_BYTE:
-            b= (i>>3    )*255;
-            g= ((i>>1)&3)*85;
-            r= (i&1     )*255;
-            break;
-        case PIX_FMT_GRAY8:
-            r=b=g= i;
-            break;
-        default:
-            return -1;
-        }
-        pal[i] =  b + (g<<8) + (r<<16);
-    }
-
-    return 0;
+    return ff_set_systematic_pal2(pal, pix_fmt);
 }
 
-#if LIBAVCODEC_VERSION_MAJOR < 53
 int ff_fill_linesize(AVPicture *picture, enum PixelFormat pix_fmt, int width)
 {
     return av_image_fill_linesizes(picture->linesize, pix_fmt, width);
@@ -909,7 +875,7 @@ int avpicture_alloc(AVPicture *picture,
         goto fail;
     avpicture_fill(picture, ptr, pix_fmt, width, height);
     if(picture->data[1] && !picture->data[2])
-        ff_set_systematic_pal((uint32_t*)picture->data[1], pix_fmt);
+        ff_set_systematic_pal2((uint32_t*)picture->data[1], pix_fmt);
 
     return 0;
  fail:
index 0f2c2e17137f74d84eddb075f5b119469da96a45..64da317d27644cfef4d57f09c3f0a640aa1a0d39 100644 (file)
@@ -36,8 +36,9 @@ int ff_fill_pointer(AVPicture *picture, uint8_t *ptr, enum PixelFormat pix_fmt,
 
 attribute_deprecated
 int ff_get_plane_bytewidth(enum PixelFormat pix_fmt, int width, int plane);
-#endif
 
+attribute_deprecated
 int ff_set_systematic_pal(uint32_t pal[256], enum PixelFormat pix_fmt);
+#endif
 
 #endif /* AVCODEC_IMGCONVERT_H */
index e8c4bd8fc3502c0bdec16446b9b20ca36871cd2c..c6642077f6556a10f5bd80ac6285f81d02a70999 100644 (file)
@@ -29,6 +29,7 @@
 #include "raw.h"
 #include "libavutil/intreadwrite.h"
 #include "libavcore/imgutils.h"
+#include "libavcore/internal.h"
 
 typedef struct RawVideoContext {
     uint32_t palette[AVPALETTE_COUNT];
@@ -83,7 +84,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_pal(context->palette, avctx->pix_fmt);
+    ff_set_systematic_pal2(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 &&
index 36918772c80231e48e0c09d1b427ed984639c430..f07e5c90c9a690caf782c08a8054163683cd144f 100644 (file)
@@ -30,6 +30,7 @@
 #include "libavutil/crc.h"
 #include "libavutil/pixdesc.h"
 #include "libavcore/imgutils.h"
+#include "libavcore/internal.h"
 #include "libavcore/samplefmt.h"
 #include "avcodec.h"
 #include "dsputil.h"
@@ -323,7 +324,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_pal((uint32_t*)buf->data[1], s->pix_fmt);
+            ff_set_systematic_pal2((uint32_t*)buf->data[1], s->pix_fmt);
         buf->width  = s->width;
         buf->height = s->height;
         buf->pix_fmt= s->pix_fmt;
index b2bb81062856e3e16cf9adcd02b67d3b100575a6..312cd865d33e0eb7135b1fcea8c6b6b57ea2225b 100644 (file)
@@ -28,7 +28,7 @@
 
 #define LIBAVCORE_VERSION_MAJOR  0
 #define LIBAVCORE_VERSION_MINOR 12
-#define LIBAVCORE_VERSION_MICRO  0
+#define LIBAVCORE_VERSION_MICRO  1
 
 #define LIBAVCORE_VERSION_INT   AV_VERSION_INT(LIBAVCORE_VERSION_MAJOR, \
                                                LIBAVCORE_VERSION_MINOR, \
index 0a21f6de20877460a1bffc8d1140a9e541af7b55..554639f3b29057659a0c9e4f841afff30cc1e566 100644 (file)
@@ -22,6 +22,7 @@
  */
 
 #include "imgutils.h"
+#include "internal.h"
 #include "libavutil/pixdesc.h"
 
 void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4],
@@ -120,6 +121,46 @@ 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 i;
+
+    for (i = 0; i < 256; i++) {
+        int r, g, b;
+
+        switch (pix_fmt) {
+        case PIX_FMT_RGB8:
+            r = (i>>5    )*36;
+            g = ((i>>2)&7)*36;
+            b = (i&3     )*85;
+            break;
+        case PIX_FMT_BGR8:
+            b = (i>>6    )*85;
+            g = ((i>>3)&7)*36;
+            r = (i&7     )*36;
+            break;
+        case PIX_FMT_RGB4_BYTE:
+            r = (i>>3    )*255;
+            g = ((i>>1)&3)*85;
+            b = (i&1     )*255;
+            break;
+        case PIX_FMT_BGR4_BYTE:
+            b = (i>>3    )*255;
+            g = ((i>>1)&3)*85;
+            r = (i&1     )*255;
+            break;
+        case PIX_FMT_GRAY8:
+            r = b = g = i;
+            break;
+        default:
+            return AVERROR(EINVAL);
+        }
+        pal[i] = b + (g<<8) + (r<<16);
+    }
+
+    return 0;
+}
+
 typedef struct ImgUtils {
     const AVClass *class;
     int   log_offset;
diff --git a/libavcore/internal.h b/libavcore/internal.h
new file mode 100644 (file)
index 0000000..3960bd3
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCORE_INTERNAL_H
+#define AVCORE_INTERNAL_H
+
+/**
+ * @file
+ * internal functions
+ */
+
+#include "avcore.h"
+
+int ff_set_systematic_pal2(uint32_t pal[256], enum PixelFormat pix_fmt);
+
+#endif /* AVCORE_INTERNAL_H */