diff options
author | Miroslav Slugeň <thunder.m@email.cz> | 2017-02-12 21:22:46 +0100 |
---|---|---|
committer | Timo Rothenpieler <timo@rothenpieler.org> | 2017-02-18 12:44:08 +0100 |
commit | 2a2f6b28873e0a665c6a6075c4db5692497b52bb (patch) | |
tree | e53eb8e7fa7104250079e32713de3df5d25b7343 /libavcodec/cuvid.c | |
parent | 4cb8872eb79a43b7acaa35bc92ffd1ab1a64eb75 (diff) | |
download | ffmpeg-2a2f6b28873e0a665c6a6075c4db5692497b52bb.tar.gz |
avcodec/cuvid: add drop_second_field as input option
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
Diffstat (limited to 'libavcodec/cuvid.c')
-rw-r--r-- | libavcodec/cuvid.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/libavcodec/cuvid.c b/libavcodec/cuvid.c index 844e782af2..c0b4a37734 100644 --- a/libavcodec/cuvid.c +++ b/libavcodec/cuvid.c @@ -42,6 +42,7 @@ typedef struct CuvidContext char *cu_gpu; int nb_surfaces; + int drop_second_field; AVBufferRef *hwdevice; AVBufferRef *hwframe; @@ -267,7 +268,7 @@ static int CUDAAPI cuvid_handle_video_sequence(void *opaque, CUVIDEOFORMAT* form cuinfo.bitDepthMinus8 = format->bit_depth_luma_minus8; cuinfo.DeinterlaceMode = ctx->deint_mode_current; - if (ctx->deint_mode_current != cudaVideoDeinterlaceMode_Weave) + if (ctx->deint_mode_current != cudaVideoDeinterlaceMode_Weave && !ctx->drop_second_field) avctx->framerate = av_mul_q(avctx->framerate, (AVRational){2, 1}); ctx->internal_error = CHECK_CU(ctx->cvdl->cuvidCreateDecoder(&ctx->cudecoder, &cuinfo)); @@ -317,8 +318,10 @@ static int CUDAAPI cuvid_handle_picture_display(void *opaque, CUVIDPARSERDISPINF } else { parsed_frame.is_deinterlacing = 1; av_fifo_generic_write(ctx->frame_queue, &parsed_frame, sizeof(CuvidParsedFrame), NULL); - parsed_frame.second_field = 1; - av_fifo_generic_write(ctx->frame_queue, &parsed_frame, sizeof(CuvidParsedFrame), NULL); + if (!ctx->drop_second_field) { + parsed_frame.second_field = 1; + av_fifo_generic_write(ctx->frame_queue, &parsed_frame, sizeof(CuvidParsedFrame), NULL); + } } return 1; @@ -949,6 +952,7 @@ static const AVOption options[] = { { "adaptive", "Adaptive deinterlacing", 0, AV_OPT_TYPE_CONST, { .i64 = cudaVideoDeinterlaceMode_Adaptive }, 0, 0, VD, "deint" }, { "gpu", "GPU to be used for decoding", OFFSET(cu_gpu), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, VD }, { "surfaces", "Maximum surfaces to be used for decoding", OFFSET(nb_surfaces), AV_OPT_TYPE_INT, { .i64 = 25 }, 0, INT_MAX, VD }, + { "drop_second_field", "Drop second field when deinterlacing", OFFSET(drop_second_field), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VD }, { NULL } }; |