vf_mp: Set pseudo pal

Fixes ticket2140
Fixes null pointer dereference

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-02-23 19:25:46 +01:00
parent da8ef5ac2f
commit 73fce258b7
3 changed files with 16 additions and 1 deletions

View File

@ -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;
}

View File

@ -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:

View File

@ -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)
{