aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2017-12-27 21:09:45 -0300
committerJames Almer <jamrial@gmail.com>2017-12-27 21:11:10 -0300
commit2f96190732d15510ba29471fa45d66841c0c3df1 (patch)
treec05594df328b7906a39225b1e86f63af04db5e84 /libavcodec
parentaa6f43c2e959a960792f76d006b8699d733f258f (diff)
parentc6558e8840fbb2386bf8742e4d68dd6e067d262e (diff)
downloadffmpeg-2f96190732d15510ba29471fa45d66841c0c3df1.tar.gz
Merge commit 'c6558e8840fbb2386bf8742e4d68dd6e067d262e'
* commit 'c6558e8840fbb2386bf8742e4d68dd6e067d262e': x264: Support version 153 See 2a111c99a60fdf4fe5eea2b073901630190c6c93 7e60c74329353db28db00552028bc88cd2a52346 Merged-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/libx264.c43
1 files changed, 23 insertions, 20 deletions
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 0e714f1615..12379ff763 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -272,7 +272,6 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame,
int *got_packet)
{
X264Context *x4 = ctx->priv_data;
- const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(ctx->pix_fmt);
x264_nal_t *nal;
int nnal, i, ret;
x264_picture_t pic_out = {0};
@@ -280,7 +279,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 (desc->comp[0].depth > 8)
+#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);
@@ -491,6 +494,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
PARSE_X264_OPT("weightp", wpredp);
@@ -724,9 +730,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
x4->params.i_width = avctx->width;
x4->params.i_height = avctx->height;
-#if X264_BUILD >= 153
- x4->params.i_bitdepth = av_pix_fmt_desc_get(avctx->pix_fmt)->comp[0].depth;
-#endif
av_reduce(&sw, &sh, avctx->sample_aspect_ratio.num, avctx->sample_aspect_ratio.den, 4096);
x4->params.vui.i_sar_width = sw;
x4->params.vui.i_sar_height = sh;
@@ -840,25 +843,33 @@ FF_ENABLE_DEPRECATION_WARNINGS
return 0;
}
-static const enum AVPixelFormat pix_fmts[] = {
+static const enum AVPixelFormat pix_fmts_8bit[] = {
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_YUV420P10,
- AV_PIX_FMT_YUV422P10,
- AV_PIX_FMT_YUV444P10,
AV_PIX_FMT_NV12,
AV_PIX_FMT_NV16,
- AV_PIX_FMT_NV20,
#ifdef X264_CSP_NV21
AV_PIX_FMT_NV21,
#endif
AV_PIX_FMT_NONE
};
-static const enum AVPixelFormat pix_fmts_8bit[] = {
+static const enum AVPixelFormat pix_fmts_9bit[] = {
+ AV_PIX_FMT_YUV420P9,
+ AV_PIX_FMT_YUV444P9,
+ AV_PIX_FMT_NONE
+};
+static const enum AVPixelFormat pix_fmts_10bit[] = {
+ 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_all[] = {
AV_PIX_FMT_YUV420P,
AV_PIX_FMT_YUVJ420P,
AV_PIX_FMT_YUV422P,
@@ -870,14 +881,6 @@ static const enum AVPixelFormat pix_fmts_8bit[] = {
#ifdef X264_CSP_NV21
AV_PIX_FMT_NV21,
#endif
- AV_PIX_FMT_NONE
-};
-static const enum AVPixelFormat pix_fmts_9bit[] = {
- AV_PIX_FMT_YUV420P9,
- AV_PIX_FMT_YUV444P9,
- AV_PIX_FMT_NONE
-};
-static const enum AVPixelFormat pix_fmts_10bit[] = {
AV_PIX_FMT_YUV420P10,
AV_PIX_FMT_YUV422P10,
AV_PIX_FMT_YUV444P10,
@@ -903,7 +906,7 @@ static av_cold void X264_init_static(AVCodec *codec)
else if (x264_bit_depth == 10)
codec->pix_fmts = pix_fmts_10bit;
#else
- codec->pix_fmts = pix_fmts;
+ codec->pix_fmts = pix_fmts_all;
#endif
}