summaryrefslogtreecommitdiffstats
path: root/video/filter/vf_scale.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/filter/vf_scale.c')
-rw-r--r--video/filter/vf_scale.c53
1 files changed, 1 insertions, 52 deletions
diff --git a/video/filter/vf_scale.c b/video/filter/vf_scale.c
index 30a185390e..a10825ee56 100644
--- a/video/filter/vf_scale.c
+++ b/video/filter/vf_scale.c
@@ -47,7 +47,6 @@ static struct vf_priv_s {
double param[2];
unsigned int fmt;
struct SwsContext *ctx;
- unsigned char* palette;
int interlaced;
int noup;
int accurate_rnd;
@@ -57,9 +56,6 @@ static struct vf_priv_s {
-1,-1,
0,
{SWS_PARAM_DEFAULT, SWS_PARAM_DEFAULT},
- 0,
- NULL,
- NULL
};
static int mp_sws_set_colorspace(struct SwsContext *sws,
@@ -162,6 +158,7 @@ static int preferred_conversions[][2] = {
{IMGFMT_GBRP, IMGFMT_RGB24},
{IMGFMT_GBRP, IMGFMT_BGR32},
{IMGFMT_GBRP, IMGFMT_RGB32},
+ {IMGFMT_PAL8, IMGFMT_BGR32},
{0, 0}
};
@@ -210,7 +207,6 @@ static int config(struct vf_instance *vf,
unsigned int best=find_best_out(vf, outfmt);
int int_sws_flags=0;
int round_w=0, round_h=0;
- int i;
SwsFilter *srcFilter, *dstFilter;
enum PixelFormat dfmt, sfmt;
@@ -221,7 +217,6 @@ static int config(struct vf_instance *vf,
return 0;
}
sfmt = imgfmt2pixfmt(outfmt);
- if (outfmt == IMGFMT_RGB8 || outfmt == IMGFMT_BGR8) sfmt = PIX_FMT_PAL8;
dfmt = imgfmt2pixfmt(best);
vf->next->query_format(vf->next,best);
@@ -316,51 +311,6 @@ static int config(struct vf_instance *vf,
}
vf->priv->fmt=best;
- free(vf->priv->palette);
- vf->priv->palette=NULL;
- switch(best){
- case IMGFMT_RGB8: {
- /* set 332 palette for 8 bpp */
- vf->priv->palette=malloc(4*256);
- for(i=0; i<256; i++){
- vf->priv->palette[4*i+0]=4*(i>>6)*21;
- vf->priv->palette[4*i+1]=4*((i>>3)&7)*9;
- vf->priv->palette[4*i+2]=4*((i&7)&7)*9;
- vf->priv->palette[4*i+3]=0;
- }
- break; }
- case IMGFMT_BGR8: {
- /* set 332 palette for 8 bpp */
- vf->priv->palette=malloc(4*256);
- for(i=0; i<256; i++){
- vf->priv->palette[4*i+0]=4*(i&3)*21;
- vf->priv->palette[4*i+1]=4*((i>>2)&7)*9;
- vf->priv->palette[4*i+2]=4*((i>>5)&7)*9;
- vf->priv->palette[4*i+3]=0;
- }
- break; }
- case IMGFMT_BGR4:
- case IMGFMT_BG4B: {
- vf->priv->palette=malloc(4*16);
- for(i=0; i<16; i++){
- vf->priv->palette[4*i+0]=4*(i&1)*63;
- vf->priv->palette[4*i+1]=4*((i>>1)&3)*21;
- vf->priv->palette[4*i+2]=4*((i>>3)&1)*63;
- vf->priv->palette[4*i+3]=0;
- }
- break; }
- case IMGFMT_RGB4:
- case IMGFMT_RG4B: {
- vf->priv->palette=malloc(4*16);
- for(i=0; i<16; i++){
- vf->priv->palette[4*i+0]=4*(i>>3)*63;
- vf->priv->palette[4*i+1]=4*((i>>1)&3)*21;
- vf->priv->palette[4*i+2]=4*((i&1)&1)*63;
- vf->priv->palette[4*i+3]=0;
- }
- break; }
- }
-
if (!opts->screen_size_x && !opts->screen_size_y
&& !(opts->screen_size_xy >= 0.001)) {
// Compute new d_width and d_height, preserving aspect
@@ -566,7 +516,6 @@ static int query_format(struct vf_instance *vf, unsigned int fmt){
static void uninit(struct vf_instance *vf){
if(vf->priv->ctx) sws_freeContext(vf->priv->ctx);
- free(vf->priv->palette);
free(vf->priv);
}