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>
... | ... |
@@ -279,7 +279,11 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame, |
279 | 279 |
|
280 | 280 |
x264_picture_init( &x4->pic ); |
281 | 281 |
x4->pic.img.i_csp = x4->params.i_csp; |
282 |
+#if X264_BUILD >= 153 |
|
283 |
+ if (x4->params.i_bitdepth > 8) |
|
284 |
+#else |
|
282 | 285 |
if (x264_bit_depth > 8) |
286 |
+#endif |
|
283 | 287 |
x4->pic.img.i_csp |= X264_CSP_HIGH_DEPTH; |
284 | 288 |
x4->pic.img.i_plane = avfmt2_num_planes(ctx->pix_fmt); |
285 | 289 |
|
... | ... |
@@ -490,6 +494,9 @@ static av_cold int X264_init(AVCodecContext *avctx) |
490 | 490 |
x4->params.p_log_private = avctx; |
491 | 491 |
x4->params.i_log_level = X264_LOG_DEBUG; |
492 | 492 |
x4->params.i_csp = convert_pix_fmt(avctx->pix_fmt); |
493 |
+#if X264_BUILD >= 153 |
|
494 |
+ x4->params.i_bitdepth = av_pix_fmt_desc_get(avctx->pix_fmt)->comp[0].depth; |
|
495 |
+#endif |
|
493 | 496 |
|
494 | 497 |
PARSE_X264_OPT("weightp", wpredp); |
495 | 498 |
|
... | ... |
@@ -878,6 +885,24 @@ static const enum AVPixelFormat pix_fmts_10bit[] = { |
878 | 878 |
AV_PIX_FMT_NV20, |
879 | 879 |
AV_PIX_FMT_NONE |
880 | 880 |
}; |
881 |
+static const enum AVPixelFormat pix_fmts_all[] = { |
|
882 |
+ AV_PIX_FMT_YUV420P, |
|
883 |
+ AV_PIX_FMT_YUVJ420P, |
|
884 |
+ AV_PIX_FMT_YUV422P, |
|
885 |
+ AV_PIX_FMT_YUVJ422P, |
|
886 |
+ AV_PIX_FMT_YUV444P, |
|
887 |
+ AV_PIX_FMT_YUVJ444P, |
|
888 |
+ AV_PIX_FMT_NV12, |
|
889 |
+ AV_PIX_FMT_NV16, |
|
890 |
+#ifdef X264_CSP_NV21 |
|
891 |
+ AV_PIX_FMT_NV21, |
|
892 |
+#endif |
|
893 |
+ AV_PIX_FMT_YUV420P10, |
|
894 |
+ AV_PIX_FMT_YUV422P10, |
|
895 |
+ AV_PIX_FMT_YUV444P10, |
|
896 |
+ AV_PIX_FMT_NV20, |
|
897 |
+ AV_PIX_FMT_NONE |
|
898 |
+}; |
|
881 | 899 |
#if CONFIG_LIBX264RGB_ENCODER |
882 | 900 |
static const enum AVPixelFormat pix_fmts_8bit_rgb[] = { |
883 | 901 |
AV_PIX_FMT_BGR0, |
... | ... |
@@ -889,12 +914,16 @@ static const enum AVPixelFormat pix_fmts_8bit_rgb[] = { |
889 | 889 |
|
890 | 890 |
static av_cold void X264_init_static(AVCodec *codec) |
891 | 891 |
{ |
892 |
+#if X264_BUILD < 153 |
|
892 | 893 |
if (x264_bit_depth == 8) |
893 | 894 |
codec->pix_fmts = pix_fmts_8bit; |
894 | 895 |
else if (x264_bit_depth == 9) |
895 | 896 |
codec->pix_fmts = pix_fmts_9bit; |
896 | 897 |
else if (x264_bit_depth == 10) |
897 | 898 |
codec->pix_fmts = pix_fmts_10bit; |
899 |
+#else |
|
900 |
+ codec->pix_fmts = pix_fmts_all; |
|
901 |
+#endif |
|
898 | 902 |
} |
899 | 903 |
|
900 | 904 |
#define OFFSET(x) offsetof(X264Context, x) |