summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2011-06-26 06:28:14 +0300
committerUoti Urpala <uau@mplayer2.org>2011-06-26 06:28:18 +0300
commitfd01bee8f7ad057e79202a6ce2aaa65875862794 (patch)
treee815b4a8e58d67cea212abb46cd62a5eda5c1088 /libmpcodecs
parent48e85562982aee72f055b5ca523ff73bfe34cc43 (diff)
parentd3bef0286bc0688da91452f6e07429052d324b51 (diff)
downloadmpv-fd01bee8f7ad057e79202a6ce2aaa65875862794.tar.bz2
mpv-fd01bee8f7ad057e79202a6ce2aaa65875862794.tar.xz
Merge branch '10bit'
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/img_format.c20
-rw-r--r--libmpcodecs/img_format.h24
-rw-r--r--libmpcodecs/mp_image.c10
-rw-r--r--libmpcodecs/vd.c26
-rw-r--r--libmpcodecs/vd.h10
-rw-r--r--libmpcodecs/vd_ffmpeg.c13
-rw-r--r--libmpcodecs/vf_scale.c10
7 files changed, 98 insertions, 15 deletions
diff --git a/libmpcodecs/img_format.c b/libmpcodecs/img_format.c
index df47ce043b..09711e5270 100644
--- a/libmpcodecs/img_format.c
+++ b/libmpcodecs/img_format.c
@@ -59,10 +59,20 @@ const char *vo_format_name(int format)
case IMGFMT_Y8: return "Planar Y8";
case IMGFMT_420P16_LE: return "Planar 420P 16-bit little-endian";
case IMGFMT_420P16_BE: return "Planar 420P 16-bit big-endian";
+ case IMGFMT_420P10_LE: return "Planar 420P 10-bit little-endian";
+ case IMGFMT_420P10_BE: return "Planar 420P 10-bit big-endian";
+ case IMGFMT_420P9_LE: return "Planar 420P 9-bit little-endian";
+ case IMGFMT_420P9_BE: return "Planar 420P 9-bit big-endian";
case IMGFMT_422P16_LE: return "Planar 422P 16-bit little-endian";
case IMGFMT_422P16_BE: return "Planar 422P 16-bit big-endian";
+ case IMGFMT_422P10_LE: return "Planar 422P 10-bit little-endian";
+ case IMGFMT_422P10_BE: return "Planar 422P 10-bit big-endian";
case IMGFMT_444P16_LE: return "Planar 444P 16-bit little-endian";
case IMGFMT_444P16_BE: return "Planar 444P 16-bit big-endian";
+ case IMGFMT_444P10_LE: return "Planar 444P 10-bit little-endian";
+ case IMGFMT_444P10_BE: return "Planar 444P 10-bit big-endian";
+ case IMGFMT_444P9_LE: return "Planar 444P 9-bit little-endian";
+ case IMGFMT_444P9_BE: return "Planar 444P 9-bit big-endian";
case IMGFMT_420A: return "Planar 420P with alpha";
case IMGFMT_444P: return "Planar 444P";
case IMGFMT_422P: return "Planar 422P";
@@ -116,6 +126,10 @@ int mp_get_chroma_shift(int format, int *x_shift, int *y_shift)
switch (format) {
case IMGFMT_420P16_LE:
case IMGFMT_420P16_BE:
+ case IMGFMT_420P10_LE:
+ case IMGFMT_420P10_BE:
+ case IMGFMT_420P9_LE:
+ case IMGFMT_420P9_BE:
bpp_factor = 2;
case IMGFMT_420A:
case IMGFMT_I420:
@@ -131,6 +145,10 @@ int mp_get_chroma_shift(int format, int *x_shift, int *y_shift)
break;
case IMGFMT_444P16_LE:
case IMGFMT_444P16_BE:
+ case IMGFMT_444P10_LE:
+ case IMGFMT_444P10_BE:
+ case IMGFMT_444P9_LE:
+ case IMGFMT_444P9_BE:
bpp_factor = 2;
case IMGFMT_444P:
xs = 0;
@@ -138,6 +156,8 @@ int mp_get_chroma_shift(int format, int *x_shift, int *y_shift)
break;
case IMGFMT_422P16_LE:
case IMGFMT_422P16_BE:
+ case IMGFMT_422P10_LE:
+ case IMGFMT_422P10_BE:
bpp_factor = 2;
case IMGFMT_422P:
xs = 1;
diff --git a/libmpcodecs/img_format.h b/libmpcodecs/img_format.h
index c95ed4df3c..52a5ffbe25 100644
--- a/libmpcodecs/img_format.h
+++ b/libmpcodecs/img_format.h
@@ -123,22 +123,42 @@
#define IMGFMT_444P16_LE 0x51343434
#define IMGFMT_444P16_BE 0x34343451
+#define IMGFMT_444P10_LE 0x52343434
+#define IMGFMT_444P10_BE 0x34343452
+#define IMGFMT_444P9_LE 0x53343434
+#define IMGFMT_444P9_BE 0x34343453
#define IMGFMT_422P16_LE 0x51323234
#define IMGFMT_422P16_BE 0x34323251
+#define IMGFMT_422P10_LE 0x52323234
+#define IMGFMT_422P10_BE 0x34323252
#define IMGFMT_420P16_LE 0x51303234
#define IMGFMT_420P16_BE 0x34323051
+#define IMGFMT_420P10_LE 0x52303234
+#define IMGFMT_420P10_BE 0x34323052
+#define IMGFMT_420P9_LE 0x53303234
+#define IMGFMT_420P9_BE 0x34323053
#if HAVE_BIGENDIAN
#define IMGFMT_444P16 IMGFMT_444P16_BE
+#define IMGFMT_444P10 IMGFMT_444P10_BE
+#define IMGFMT_444P9 IMGFMT_444P9_BE
#define IMGFMT_422P16 IMGFMT_422P16_BE
+#define IMGFMT_422P10 IMGFMT_422P10_BE
#define IMGFMT_420P16 IMGFMT_420P16_BE
+#define IMGFMT_420P10 IMGFMT_420P10_BE
+#define IMGFMT_420P9 IMGFMT_420P9_BE
#else
#define IMGFMT_444P16 IMGFMT_444P16_LE
+#define IMGFMT_444P10 IMGFMT_444P10_LE
+#define IMGFMT_444P9 IMGFMT_444P9_LE
#define IMGFMT_422P16 IMGFMT_422P16_LE
+#define IMGFMT_422P10 IMGFMT_422P10_LE
#define IMGFMT_420P16 IMGFMT_420P16_LE
+#define IMGFMT_420P10 IMGFMT_420P10_LE
+#define IMGFMT_420P9 IMGFMT_420P9_LE
#endif
-#define IMGFMT_IS_YUVP16_LE(fmt) (((fmt ^ IMGFMT_420P16_LE) & 0xff0000ff) == 0)
-#define IMGFMT_IS_YUVP16_BE(fmt) (((fmt ^ IMGFMT_420P16_BE) & 0xff0000ff) == 0)
+#define IMGFMT_IS_YUVP16_LE(fmt) (((fmt - 0x51000034) & 0xfc0000ff) == 0)
+#define IMGFMT_IS_YUVP16_BE(fmt) (((fmt - 0x34000051) & 0xff0000fc) == 0)
#define IMGFMT_IS_YUVP16_NE(fmt) (((fmt ^ IMGFMT_420P16 ) & 0xff0000ff) == 0)
#define IMGFMT_IS_YUVP16(fmt) (IMGFMT_IS_YUVP16_LE(fmt) || IMGFMT_IS_YUVP16_BE(fmt))
diff --git a/libmpcodecs/mp_image.c b/libmpcodecs/mp_image.c
index d250376276..4d2892cf81 100644
--- a/libmpcodecs/mp_image.c
+++ b/libmpcodecs/mp_image.c
@@ -145,10 +145,20 @@ void mp_image_setfmt(mp_image_t* mpi,unsigned int out_fmt){
case IMGFMT_440P:
case IMGFMT_444P16_LE:
case IMGFMT_444P16_BE:
+ case IMGFMT_444P10_LE:
+ case IMGFMT_444P10_BE:
+ case IMGFMT_444P9_LE:
+ case IMGFMT_444P9_BE:
case IMGFMT_422P16_LE:
case IMGFMT_422P16_BE:
+ case IMGFMT_422P10_LE:
+ case IMGFMT_422P10_BE:
case IMGFMT_420P16_LE:
case IMGFMT_420P16_BE:
+ case IMGFMT_420P10_LE:
+ case IMGFMT_420P10_BE:
+ case IMGFMT_420P9_LE:
+ case IMGFMT_420P9_BE:
return;
case IMGFMT_Y800:
case IMGFMT_Y8:
diff --git a/libmpcodecs/vd.c b/libmpcodecs/vd.c
index c54ae5260b..3ba72790a5 100644
--- a/libmpcodecs/vd.c
+++ b/libmpcodecs/vd.c
@@ -35,6 +35,7 @@
#include "vd.h"
#include "vf.h"
+#include "libvo/video_out.h"
extern const vd_functions_t mpcodecs_vd_null;
extern const vd_functions_t mpcodecs_vd_ffmpeg;
@@ -108,13 +109,12 @@ const vd_functions_t * const mpcodecs_vd_drivers[] = {
NULL
};
-#include "libvo/video_out.h"
-
-int mpcodecs_config_vo(sh_video_t *sh, int w, int h,
- unsigned int preferred_outfmt)
+int mpcodecs_config_vo2(sh_video_t *sh, int w, int h,
+ const unsigned int *outfmts,
+ unsigned int preferred_outfmt)
{
struct MPOpts *opts = sh->opts;
- int i, j;
+ int j;
unsigned int out_fmt = 0;
int screen_size_x = 0;
int screen_size_y = 0;
@@ -138,6 +138,10 @@ int mpcodecs_config_vo(sh_video_t *sh, int w, int h,
// user wants postprocess but no pp filter yet:
sh->vfilter = vf = vf_open_filter(opts, vf, "pp", NULL);
}
+
+ if (!outfmts || sh->codec->outfmt[0] != 0xffffffff)
+ outfmts = sh->codec->outfmt;
+
// check if libvo and codec has common outfmt (no conversion):
csp_again:
@@ -150,11 +154,11 @@ int mpcodecs_config_vo(sh_video_t *sh, int w, int h,
}
j = -1;
- for (i = 0; i < CODECS_MAX_OUTFMT; i++) {
+ for (int i = 0; i < CODECS_MAX_OUTFMT; i++) {
int flags;
- out_fmt = sh->codec->outfmt[i];
+ out_fmt = outfmts[i];
if (out_fmt == (unsigned int) 0xFFFFFFFF)
- continue;
+ break;
flags = vf->query_format(vf, out_fmt);
mp_msg(MSGT_CPLAYER, MSGL_DBG2,
"vo_debug: query(%s) returned 0x%X (i=%d) \n",
@@ -234,7 +238,8 @@ int mpcodecs_config_vo(sh_video_t *sh, int w, int h,
sh->vf_initialized = -1;
return 0; // failed
}
- out_fmt = sh->codec->outfmt[j];
+ out_fmt = outfmts[j];
+ sh->outfmt = out_fmt;
mp_msg(MSGT_CPLAYER, MSGL_V, "VDec: using %s as output csp (no %d)\n",
vo_format_name(out_fmt), j);
sh->outfmtidx = j;
@@ -354,8 +359,7 @@ mp_image_t *mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag,
int w, int h)
{
mp_image_t *mpi =
- vf_get_image(sh->vfilter, sh->codec->outfmt[sh->outfmtidx], mp_imgtype,
- mp_imgflag, w, h);
+ vf_get_image(sh->vfilter, sh->outfmt, mp_imgtype, mp_imgflag, w, h);
if (mpi)
mpi->x = mpi->y = 0;
return mpi;
diff --git a/libmpcodecs/vd.h b/libmpcodecs/vd.h
index 4615a9dc6e..76f3d00553 100644
--- a/libmpcodecs/vd.h
+++ b/libmpcodecs/vd.h
@@ -49,7 +49,15 @@ extern const vd_functions_t * const mpcodecs_vd_drivers[];
#define VDCTRL_QUERY_UNSEEN_FRAMES 9 /* current decoder lag */
// callbacks:
-int mpcodecs_config_vo(sh_video_t *sh, int w, int h, unsigned int preferred_outfmt);
+int mpcodecs_config_vo2(sh_video_t *sh, int w, int h,
+ const unsigned int *outfmts,
+ unsigned int preferred_outfmt);
+static inline int mpcodecs_config_vo(sh_video_t *sh, int w, int h,
+ unsigned int preferred_outfmt)
+{
+ return mpcodecs_config_vo2(sh, w, h, NULL, preferred_outfmt);
+}
+
mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h);
void mpcodecs_draw_slice(sh_video_t *sh, unsigned char** src, int* stride, int w,int h, int x, int y);
diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c
index 5a17bc243e..5460d20fd1 100644
--- a/libmpcodecs/vd_ffmpeg.c
+++ b/libmpcodecs/vd_ffmpeg.c
@@ -501,7 +501,18 @@ static int init_vo(sh_video_t *sh, enum PixelFormat pix_fmt){
sh->disp_h = height;
ctx->pix_fmt = pix_fmt;
ctx->best_csp = pixfmt2imgfmt(pix_fmt);
- if (!mpcodecs_config_vo(sh, sh->disp_w, sh->disp_h, ctx->best_csp))
+ const unsigned int *supported_fmts;
+ if (ctx->best_csp == IMGFMT_YV12)
+ supported_fmts = (const unsigned int[])
+ {IMGFMT_YV12, IMGFMT_I420, IMGFMT_IYUV, 0xffffffff};
+ else if (ctx->best_csp == IMGFMT_422P)
+ supported_fmts = (const unsigned int[])
+ {IMGFMT_422P, IMGFMT_YV12, IMGFMT_I420, IMGFMT_IYUV,
+ 0xffffffff};
+ else
+ supported_fmts = (const unsigned int[]){ctx->best_csp, 0xffffffff};
+ if (!mpcodecs_config_vo2(sh, sh->disp_w, sh->disp_h, supported_fmts,
+ ctx->best_csp))
return -1;
ctx->vo_initialized = 1;
}
diff --git a/libmpcodecs/vf_scale.c b/libmpcodecs/vf_scale.c
index e8e846c92f..1a2cb28e94 100644
--- a/libmpcodecs/vf_scale.c
+++ b/libmpcodecs/vf_scale.c
@@ -68,13 +68,23 @@ static const unsigned int outfmt_list[]={
IMGFMT_444P,
IMGFMT_444P16_LE,
IMGFMT_444P16_BE,
+ IMGFMT_444P10_LE,
+ IMGFMT_444P10_BE,
+ IMGFMT_444P9_LE,
+ IMGFMT_444P9_BE,
IMGFMT_422P,
IMGFMT_422P16_LE,
IMGFMT_422P16_BE,
+ IMGFMT_422P10_LE,
+ IMGFMT_422P10_BE,
IMGFMT_YV12,
IMGFMT_I420,
IMGFMT_420P16_LE,
IMGFMT_420P16_BE,
+ IMGFMT_420P10_LE,
+ IMGFMT_420P10_BE,
+ IMGFMT_420P9_LE,
+ IMGFMT_420P9_BE,
IMGFMT_420A,
IMGFMT_IYUV,
IMGFMT_YVU9,