summaryrefslogtreecommitdiffstats
path: root/video/decode/vd_lavc.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-12-19 12:04:38 +0100
committerwm4 <wm4@nowhere>2013-01-13 20:04:11 +0100
commitaa6ba6372c627bc602647d225bdfb076f93bd291 (patch)
treedd9a9840b123af5f48881d4d52b1697671018c02 /video/decode/vd_lavc.c
parentab94c64ed2d8b90bd7b0c348e79c2d8b8d055ee6 (diff)
downloadmpv-aa6ba6372c627bc602647d225bdfb076f93bd291.tar.bz2
mpv-aa6ba6372c627bc602647d225bdfb076f93bd291.tar.xz
mp_image: change how palette is handled
According to DOCS/OUTDATED-tech/colorspaces.txt, the following formats are supposed to be palettized: IMGFMT_BGR8 IMGFMT_RGB8, IMGFMT_BGR4_CHAR IMGFMT_RGB4_CHAR IMGFMT_BGR4 IMGFMT_RGB4 Of these, only BGR8 and RGB8 are actually treated as palettized in some way. ffmpeg has only one palettized format (AV_PIX_FMT_PAL8), and IMGFMT_BGR8 was inconsistently mapped to packed non-palettized RGB formats too (AV_PIX_FMT_BGR8). Moreover, vf_scale.c contained messy hacks to generate a palette when AV_PIX_FMT_BGR8 is output. (libswscale does not support AV_PIX_FMT_PAL8 output in the first place.) Get rid of all of this, and introduce IMGFMT_PAL8, which directly maps to AV_PIX_FMT_PAL8. Remove the palette creation code from vf_scale.c. IMGFMT_BGR8 maps to AV_PIX_FMT_RGB8 (don't ask me why it's swapped), without any palette use. Enabling it in vo_x11 or using it as vf_scale input seems to give correct results.
Diffstat (limited to 'video/decode/vd_lavc.c')
-rw-r--r--video/decode/vd_lavc.c14
1 files changed, 0 insertions, 14 deletions
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c
index 2d47cb9c88..24c3ba4e36 100644
--- a/video/decode/vd_lavc.c
+++ b/video/decode/vd_lavc.c
@@ -639,14 +639,6 @@ static void release_buffer_hwdec(AVCodecContext *avctx, AVFrame *pic)
pic->data[i] = NULL;
}
-static av_unused void swap_palette(void *pal)
-{
- int i;
- uint32_t *p = pal;
- for (i = 0; i < AVPALETTE_COUNT; i++)
- p[i] = le2me_32(p[i]);
-}
-
static void fb_ref(void *b)
{
mp_buffer_ref(b);
@@ -740,12 +732,6 @@ static int decode(struct sh_video *sh, struct demux_packet *packet, void *data,
assert(mpi->imgfmt == pixfmt2imgfmt(avctx->pix_fmt));
-#if BYTE_ORDER == BIG_ENDIAN
- // FIXME: this might cause problems for buffers with FF_BUFFER_HINTS_PRESERVE
- if (mpi->bpp == 8)
- swap_palette(mpi->planes[1]);
-#endif
-
mpi->colorspace = sh->colorspace;
mpi->levels = sh->color_range;
mpi->qscale = pic->qscale_table;