diff options
| author | Miroslav Slugeň <[email protected]> | 2017-02-12 18:47:07 +0100 | 
|---|---|---|
| committer | Timo Rothenpieler <[email protected]> | 2017-02-18 12:44:08 +0100 | 
| commit | 4cb8872eb79a43b7acaa35bc92ffd1ab1a64eb75 (patch) | |
| tree | 075988bbcd8a1dac57203530c88e077148e2b057 | |
| parent | 6baee21eb72ddbd2508ef789ecdcd938419df3a4 (diff) | |
avcodec/cuvid: don't overwrite deinterlace at progressive input
If there is progressive input it will disable deinterlacing in cuvid for
all future frames even those interlaced.
Signed-off-by: Timo Rothenpieler <[email protected]>
| -rw-r--r-- | libavcodec/cuvid.c | 20 | 
1 files changed, 10 insertions, 10 deletions
diff --git a/libavcodec/cuvid.c b/libavcodec/cuvid.c index f5a49ce86f..844e782af2 100644 --- a/libavcodec/cuvid.c +++ b/libavcodec/cuvid.c @@ -51,6 +51,7 @@ typedef struct CuvidContext      AVFifoBuffer *frame_queue;      int deint_mode; +    int deint_mode_current;      int64_t prev_pts;      int internal_error; @@ -164,7 +165,11 @@ static int CUDAAPI cuvid_handle_video_sequence(void *opaque, CUVIDEOFORMAT* form          (AVRational){ format->display_aspect_ratio.x, format->display_aspect_ratio.y },          (AVRational){ avctx->width, avctx->height })); -    if (!format->progressive_sequence && ctx->deint_mode == cudaVideoDeinterlaceMode_Weave) +    ctx->deint_mode_current = format->progressive_sequence +                              ? cudaVideoDeinterlaceMode_Weave +                              : ctx->deint_mode; + +    if (!format->progressive_sequence && ctx->deint_mode_current == cudaVideoDeinterlaceMode_Weave)          avctx->flags |= AV_CODEC_FLAG_INTERLACED_DCT;      else          avctx->flags &= ~AV_CODEC_FLAG_INTERLACED_DCT; @@ -260,14 +265,9 @@ static int CUDAAPI cuvid_handle_video_sequence(void *opaque, CUVIDEOFORMAT* form      cuinfo.ulNumOutputSurfaces = 1;      cuinfo.ulCreationFlags = cudaVideoCreate_PreferCUVID;      cuinfo.bitDepthMinus8 = format->bit_depth_luma_minus8; +    cuinfo.DeinterlaceMode = ctx->deint_mode_current; -    if (format->progressive_sequence) { -        ctx->deint_mode = cuinfo.DeinterlaceMode = cudaVideoDeinterlaceMode_Weave; -    } else { -        cuinfo.DeinterlaceMode = ctx->deint_mode; -    } - -    if (ctx->deint_mode != cudaVideoDeinterlaceMode_Weave) +    if (ctx->deint_mode_current != cudaVideoDeinterlaceMode_Weave)          avctx->framerate = av_mul_q(avctx->framerate, (AVRational){2, 1});      ctx->internal_error = CHECK_CU(ctx->cvdl->cuvidCreateDecoder(&ctx->cudecoder, &cuinfo)); @@ -312,7 +312,7 @@ static int CUDAAPI cuvid_handle_picture_display(void *opaque, CUVIDPARSERDISPINF      parsed_frame.dispinfo = *dispinfo;      ctx->internal_error = 0; -    if (ctx->deint_mode == cudaVideoDeinterlaceMode_Weave) { +    if (ctx->deint_mode_current == cudaVideoDeinterlaceMode_Weave) {          av_fifo_generic_write(ctx->frame_queue, &parsed_frame, sizeof(CuvidParsedFrame), NULL);      } else {          parsed_frame.is_deinterlacing = 1; @@ -583,7 +583,7 @@ static int cuvid_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,      av_log(avctx, AV_LOG_TRACE, "cuvid_decode_frame\n"); -    if (ctx->deint_mode != cudaVideoDeinterlaceMode_Weave) { +    if (ctx->deint_mode_current != cudaVideoDeinterlaceMode_Weave) {          av_log(avctx, AV_LOG_ERROR, "Deinterlacing is not supported via the old API\n");          return AVERROR(EINVAL);      }  | 
