[FFmpeg-cvslog] hwcontext_cuda: Add P010 and YUV444P16 pixel format

Yogender Kumar Gupta git at videolan.org
Mon Mar 20 19:55:23 EET 2017


ffmpeg | branch: master | Yogender Kumar Gupta <yogender.gupta at gmail.com> | Mon Sep 19 20:19:10 2016 +0530| [340f12f71207513672b5165d810cb6c8622c6b21] | committer: Anton Khirnov

hwcontext_cuda: Add P010 and YUV444P16 pixel format

Signed-off-by: Anton Khirnov <anton at khirnov.net>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=340f12f71207513672b5165d810cb6c8622c6b21
---

 libavutil/hwcontext_cuda.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/libavutil/hwcontext_cuda.c b/libavutil/hwcontext_cuda.c
index b8781ce..2607834 100644
--- a/libavutil/hwcontext_cuda.c
+++ b/libavutil/hwcontext_cuda.c
@@ -32,7 +32,9 @@ typedef struct CUDAFramesContext {
 static const enum AVPixelFormat supported_formats[] = {
     AV_PIX_FMT_NV12,
     AV_PIX_FMT_YUV420P,
+    AV_PIX_FMT_P010,
     AV_PIX_FMT_YUV444P,
+    AV_PIX_FMT_YUV444P16,
 };
 
 static void cuda_buffer_free(void *opaque, uint8_t *data)
@@ -105,9 +107,15 @@ static int cuda_frames_init(AVHWFramesContext *ctx)
         case AV_PIX_FMT_YUV420P:
             size = ctx->width * ctx->height * 3 / 2;
             break;
+        case AV_PIX_FMT_P010:
+            size = ctx->width * ctx->height * 3;
+            break;
         case AV_PIX_FMT_YUV444P:
             size = ctx->width * ctx->height * 3;
             break;
+        case AV_PIX_FMT_YUV444P16:
+            size = ctx->width * ctx->height * 6;
+            break;
         }
 
         ctx->internal->pool_internal = av_buffer_pool_init2(size, ctx, cuda_pool_alloc, NULL);
@@ -139,6 +147,12 @@ static int cuda_get_buffer(AVHWFramesContext *ctx, AVFrame *frame)
         frame->linesize[1] = ctx->width / 2;
         frame->linesize[2] = ctx->width / 2;
         break;
+    case AV_PIX_FMT_P010:
+        frame->data[0]     = frame->buf[0]->data;
+        frame->data[1]     = frame->data[0] + 2 * ctx->width * ctx->height;
+        frame->linesize[0] = 2 * ctx->width;
+        frame->linesize[1] = 2 * ctx->width;
+        break;
     case AV_PIX_FMT_YUV444P:
         frame->data[0]     = frame->buf[0]->data;
         frame->data[1]     = frame->data[0] + ctx->width * ctx->height;
@@ -147,6 +161,14 @@ static int cuda_get_buffer(AVHWFramesContext *ctx, AVFrame *frame)
         frame->linesize[1] = ctx->width;
         frame->linesize[2] = ctx->width;
         break;
+    case AV_PIX_FMT_YUV444P16:
+        frame->data[0]     = frame->buf[0]->data;
+        frame->data[1]     = frame->data[0] + 2 * ctx->width * ctx->height;
+        frame->data[2]     = frame->data[1] + 2 * ctx->width * ctx->height;
+        frame->linesize[0] = 2 * ctx->width;
+        frame->linesize[1] = 2 * ctx->width;
+        frame->linesize[2] = 2 * ctx->width;
+        break;
     default:
         av_frame_unref(frame);
         return AVERROR_BUG;



More information about the ffmpeg-cvslog mailing list