[FFmpeg-cvslog] vf_mp: Set pseudo pal
Michael Niedermayer
git at videolan.org
Sat Feb 23 22:39:34 CET 2013
ffmpeg | branch: release/1.1 | Michael Niedermayer <michaelni at gmx.at> | Sat Feb 23 19:25:46 2013 +0100| [1f9073f41be1776aca2382357ca2ad7b3bb934db] | committer: Carl Eugen Hoyos
vf_mp: Set pseudo pal
Fixes ticket2140
Fixes null pointer dereference
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 73fce258b774d0480f2d2dd7ec81fa1ec1b27812)
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1f9073f41be1776aca2382357ca2ad7b3bb934db
---
libavfilter/libmpcodecs/mp_image.c | 9 ++++++++-
libavfilter/libmpcodecs/mp_image.h | 2 ++
libavfilter/vf_mp.c | 6 ++++++
3 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/libavfilter/libmpcodecs/mp_image.c b/libavfilter/libmpcodecs/mp_image.c
index 1ef5cbd..dbc1d62 100644
--- a/libavfilter/libmpcodecs/mp_image.c
+++ b/libavfilter/libmpcodecs/mp_image.c
@@ -31,8 +31,13 @@
#include "libvo/fastmemcpy.h"
//#include "libavutil/mem.h"
+#include "libavutil/imgutils.h"
void ff_mp_image_alloc_planes(mp_image_t *mpi) {
+ uint32_t temp[256];
+ if (avpriv_set_systematic_pal2(temp, ff_mp2ff_pix_fmt(mpi->imgfmt)) >= 0)
+ mpi->flags |= MP_IMGFLAG_RGB_PALETTE;
+
// IF09 - allocate space for 4. plane delta info - unused
if (mpi->imgfmt == IMGFMT_IF09) {
mpi->planes[0]=av_malloc(mpi->bpp*mpi->width*(mpi->height+2)/8+
@@ -65,8 +70,10 @@ void ff_mp_image_alloc_planes(mp_image_t *mpi) {
}
} else {
mpi->stride[0]=mpi->width*mpi->bpp/8;
- if (mpi->flags & MP_IMGFLAG_RGB_PALETTE)
+ if (mpi->flags & MP_IMGFLAG_RGB_PALETTE) {
mpi->planes[1] = av_malloc(1024);
+ memcpy(mpi->planes[1], temp, 1024);
+ }
}
mpi->flags|=MP_IMGFLAG_ALLOCATED;
}
diff --git a/libavfilter/libmpcodecs/mp_image.h b/libavfilter/libmpcodecs/mp_image.h
index d658ab0..c33703b 100644
--- a/libavfilter/libmpcodecs/mp_image.h
+++ b/libavfilter/libmpcodecs/mp_image.h
@@ -37,6 +37,8 @@
#define ASMALIGN(ZEROBITS) ".p2align " #ZEROBITS "\n\t"
#define CODEC_FLAG2_MEMC_ONLY 0x00001000 ///< Only do ME/MC (I frames -> ref, P frame -> ME+MC).
+enum AVPixelFormat ff_mp2ff_pix_fmt(int mp);
+
//--------- codec's requirements (filled by the codec/vf) ---------
//--- buffer content restrictions:
diff --git a/libavfilter/vf_mp.c b/libavfilter/vf_mp.c
index 6c87b3a..70d1797 100644
--- a/libavfilter/vf_mp.c
+++ b/libavfilter/vf_mp.c
@@ -217,6 +217,12 @@ zrmjpeg
CpuCaps ff_gCpuCaps; //FIXME initialize this so optims work
+enum AVPixelFormat ff_mp2ff_pix_fmt(int mp){
+ int i;
+ for(i=0; conversion_map[i].fmt && mp != conversion_map[i].fmt; i++)
+ ;
+ return mp == conversion_map[i].fmt ? conversion_map[i].pix_fmt : AV_PIX_FMT_NONE;
+}
static void ff_sws_getFlagsAndFilterFromCmdLine(int *flags, SwsFilter **srcFilterParam, SwsFilter **dstFilterParam)
{
More information about the ffmpeg-cvslog
mailing list