[FFmpeg-devel] [PATCH]Allow to encode yuvj422 and yuvj444 with libx264

Carl Eugen Hoyos cehoyos at ag.or.at
Sat Sep 21 03:11:35 CEST 2013


Hi!

Attached patch allows to encode to yuvj422p and yuvj444p just like yuvj420p.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index ea7e905..1592101 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -262,8 +262,10 @@ static int convert_pix_fmt(enum AVPixelFormat pix_fmt)
     case AV_PIX_FMT_YUV420P9:
     case AV_PIX_FMT_YUV420P10: return X264_CSP_I420;
     case AV_PIX_FMT_YUV422P:
+    case AV_PIX_FMT_YUVJ422P:
     case AV_PIX_FMT_YUV422P10: return X264_CSP_I422;
     case AV_PIX_FMT_YUV444P:
+    case AV_PIX_FMT_YUVJ444P:
     case AV_PIX_FMT_YUV444P9:
     case AV_PIX_FMT_YUV444P10: return X264_CSP_I444;
 #ifdef X264_CSP_BGR
@@ -530,7 +532,9 @@ static av_cold int X264_init(AVCodecContext *avctx)
 
     x4->params.i_slice_count  = avctx->slices;
 
-    x4->params.vui.b_fullrange = avctx->pix_fmt == AV_PIX_FMT_YUVJ420P;
+    x4->params.vui.b_fullrange = (avctx->pix_fmt == AV_PIX_FMT_YUVJ420P ||
+                                  avctx->pix_fmt == AV_PIX_FMT_YUVJ422P ||
+                                  avctx->pix_fmt == AV_PIX_FMT_YUVJ444P);
 
     if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER)
         x4->params.b_repeat_headers = 0;
@@ -595,7 +599,9 @@ 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_NONE
 };
 static const enum AVPixelFormat pix_fmts_9bit[] = {


More information about the ffmpeg-devel mailing list