diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-11-09 22:22:36 +0000 |
---|---|---|
committer | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2010-11-09 22:22:36 +0000 |
commit | ed5d30d91ca226fce0ff47a284df5e724cd0adcc (patch) | |
tree | 7e8351a89a0ee383f90bed00bc3b3f63ac77ced2 /libavcore | |
parent | a29039aef39f16c28649c39025765b10bda0b74a (diff) | |
download | ffmpeg-ed5d30d91ca226fce0ff47a284df5e724cd0adcc.tar.gz |
Move internal function ff_set_systematic_pal() to libavcore, and
rename it ff_set_systematic_pal2().
Originally committed as revision 25712 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcore')
-rw-r--r-- | libavcore/avcore.h | 2 | ||||
-rw-r--r-- | libavcore/imgutils.c | 41 | ||||
-rw-r--r-- | libavcore/internal.h | 31 |
3 files changed, 73 insertions, 1 deletions
diff --git a/libavcore/avcore.h b/libavcore/avcore.h index b2bb810628..312cd865d3 100644 --- a/libavcore/avcore.h +++ b/libavcore/avcore.h @@ -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, \ diff --git a/libavcore/imgutils.c b/libavcore/imgutils.c index 0a21f6de20..554639f3b2 100644 --- a/libavcore/imgutils.c +++ b/libavcore/imgutils.c @@ -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 index 0000000000..3960bd3986 --- /dev/null +++ b/libavcore/internal.h @@ -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 */ |