aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/libx264.c
diff options
context:
space:
mode:
authorLuca Barbato <lu_zero@gentoo.org>2017-12-26 12:32:42 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2017-12-31 03:21:36 +0100
commit8d75aa8d79519c21f91a7dd96f330ad30d6625ed (patch)
tree0a0219ea8a7c0b9c1e1cfc0d42275d44c8f55824 /libavcodec/libx264.c
parentf391eec032bad23de45345874f4fb7a5ef2f4cf4 (diff)
downloadffmpeg-8d75aa8d79519c21f91a7dd96f330ad30d6625ed.tar.gz
x264: Support version 153
It has native simultaneus 8 and 10 bit support. (cherry picked from commit c6558e8840fbb2386bf8742e4d68dd6e067d262e) (cherry picked from commit 96e8400553ae47f8f8df5b66cc268297ba38824c) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/libx264.c')
-rw-r--r--libavcodec/libx264.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index fa3aea9375..7f46abd80b 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -167,7 +167,11 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame,
x264_picture_init( &x4->pic );
x4->pic.img.i_csp = x4->params.i_csp;
+#if X264_BUILD >= 153
+ if (x4->params.i_bitdepth > 8)
+#else
if (x264_bit_depth > 8)
+#endif
x4->pic.img.i_csp |= X264_CSP_HIGH_DEPTH;
x4->pic.img.i_plane = avfmt2_num_planes(ctx->pix_fmt);
@@ -393,6 +397,9 @@ static av_cold int X264_init(AVCodecContext *avctx)
x4->params.p_log_private = avctx;
x4->params.i_log_level = X264_LOG_DEBUG;
x4->params.i_csp = convert_pix_fmt(avctx->pix_fmt);
+#if X264_BUILD >= 153
+ x4->params.i_bitdepth = av_pix_fmt_desc_get(avctx->pix_fmt)->comp[0].depth;
+#endif
OPT_STR("weightp", x4->wpredp);
@@ -731,6 +738,24 @@ static const enum AVPixelFormat pix_fmts_10bit[] = {
AV_PIX_FMT_NV20,
AV_PIX_FMT_NONE
};
+static const enum AVPixelFormat pix_fmts_all[] = {
+ AV_PIX_FMT_YUV420P,
+ AV_PIX_FMT_YUVJ420P,
+ AV_PIX_FMT_YUV422P,
+ AV_PIX_FMT_YUVJ422P,
+ AV_PIX_FMT_YUV444P,
+ AV_PIX_FMT_YUVJ444P,
+ AV_PIX_FMT_NV12,
+ AV_PIX_FMT_NV16,
+#ifdef X264_CSP_NV21
+ AV_PIX_FMT_NV21,
+#endif
+ AV_PIX_FMT_YUV420P10,
+ AV_PIX_FMT_YUV422P10,
+ AV_PIX_FMT_YUV444P10,
+ AV_PIX_FMT_NV20,
+ AV_PIX_FMT_NONE
+};
static const enum AVPixelFormat pix_fmts_8bit_rgb[] = {
#ifdef X264_CSP_BGR
AV_PIX_FMT_BGR24,
@@ -741,12 +766,16 @@ static const enum AVPixelFormat pix_fmts_8bit_rgb[] = {
static av_cold void X264_init_static(AVCodec *codec)
{
+#if X264_BUILD < 153
if (x264_bit_depth == 8)
codec->pix_fmts = pix_fmts_8bit;
else if (x264_bit_depth == 9)
codec->pix_fmts = pix_fmts_9bit;
else if (x264_bit_depth == 10)
codec->pix_fmts = pix_fmts_10bit;
+#else
+ codec->pix_fmts = pix_fmts_all;
+#endif
}
#define OFFSET(x) offsetof(X264Context, x)