Commit 73fce258 authored by Michael Niedermayer's avatar Michael Niedermayer

vf_mp: Set pseudo pal

Fixes ticket2140
Fixes null pointer dereference
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent da8ef5ac
......@@ -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;
}
......
......@@ -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:
......
......@@ -207,6 +207,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)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment