aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2017-12-25 19:41:09 -0300
committerJames Almer <jamrial@gmail.com>2017-12-26 12:56:02 -0300
commit650cb712efc47cf4c1f4f419ea220fcedc65f122 (patch)
tree960a8c10377e9c37e661a8554aa3d70bf13e4ffe
parent31d6f3df25eea5bece145ad01f8a089a3005ca84 (diff)
downloadffmpeg-650cb712efc47cf4c1f4f419ea220fcedc65f122.tar.gz
avcodec/libx264: fix compilation with x264 builds >= 153
x264 now supports multibitdepth builds, with a slightly changed API to request bitdepth during initialization. Reviewed-by: Ricardo Constantino <wiiaboo@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com> (cherry picked from commit 2a111c99a60fdf4fe5eea2b073901630190c6c93)
-rw-r--r--libavcodec/libx264.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 6764c045e7..59cc0ab4a8 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -740,6 +740,9 @@ 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;
@@ -853,6 +856,24 @@ FF_ENABLE_DEPRECATION_WARNINGS
return 0;
}
+static const enum AVPixelFormat pix_fmts[] = {
+ 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[] = {
AV_PIX_FMT_YUV420P,
AV_PIX_FMT_YUVJ420P,
@@ -890,12 +911,14 @@ static const enum AVPixelFormat pix_fmts_8bit_rgb[] = {
static av_cold void X264_init_static(AVCodec *codec)
{
- if (x264_bit_depth == 8)
+ if (X264_BIT_DEPTH == 8)
codec->pix_fmts = pix_fmts_8bit;
- else if (x264_bit_depth == 9)
+ else if (X264_BIT_DEPTH == 9)
codec->pix_fmts = pix_fmts_9bit;
- else if (x264_bit_depth == 10)
+ else if (X264_BIT_DEPTH == 10)
codec->pix_fmts = pix_fmts_10bit;
+ else /* X264_BIT_DEPTH == 0 */
+ codec->pix_fmts = pix_fmts;
}
#define OFFSET(x) offsetof(X264Context, x)