Doesn't work. Signed-off-by: Philip Langdale <phil...@overt.org> --- libavcodec/libnvenc.c | 7 +++++++ libavcodec/libnvenc.h | 3 +++ libavcodec/nvencoder.c | 6 ++++-- 3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/libavcodec/libnvenc.c b/libavcodec/libnvenc.c index 3c64234..83587a6 100644 --- a/libavcodec/libnvenc.c +++ b/libavcodec/libnvenc.c @@ -189,6 +189,9 @@ static av_cold int ff_libnvenc_init(AVCodecContext *avctx) if (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) nvenc_ctx->nvenc_cfg.enableRepeatSPSPPS = 0; + if (avctx->flags & CODEC_FLAG_INTERLACED_DCT) + nvenc_ctx->nvenc_cfg.interlaced = 1; + // Allocate list of x264 options x264_argc = 0; x264_argv = av_calloc(255, sizeof(char*)); @@ -299,6 +302,10 @@ static int ff_libnvenc_encode(AVCodecContext *avctx, AVPacket *pkt, const AVFram nvenc_frame.width = avctx->width; nvenc_frame.height = avctx->height; nvenc_frame.format = map_avpixfmt_bufferformat(avctx->pix_fmt); + if (avctx->flags & CODEC_FLAG_INTERLACED_DCT) { + nvenc_frame.interlaced = 1; + nvenc_frame.top_field_first = frame->top_field_first; + } } // Setup output diff --git a/libavcodec/libnvenc.h b/libavcodec/libnvenc.h index 63b5d67..76cb379 100644 --- a/libavcodec/libnvenc.h +++ b/libavcodec/libnvenc.h @@ -91,6 +91,7 @@ typedef struct nvenc_cfg_t uint32_t sliceMode; uint32_t sliceModeData; uint32_t disableDeblockingFilterIDC; + bool interlaced; // x264-style list of options char **x264_paramv; @@ -112,6 +113,8 @@ typedef struct nvenc_frame_t uint32_t frame_type; bool force_idr; bool force_intra; + bool interlaced; + bool top_field_first; } nvenc_frame_t; /** diff --git a/libavcodec/nvencoder.c b/libavcodec/nvencoder.c index 2135f55..198ee09 100644 --- a/libavcodec/nvencoder.c +++ b/libavcodec/nvencoder.c @@ -478,7 +478,7 @@ static bool initialize(nvencoder_t *nvenc, nvenc_cfg_t *nvenc_cfg) nvenc->config.profileGUID = map_profile(nvenc_cfg->profile); nvenc->config.gopLength = nvenc_cfg->gopLength; nvenc->config.frameIntervalP = 1 + nvenc_cfg->numBFrames; - nvenc->config.frameFieldMode = NV_ENC_PARAMS_FRAME_FIELD_MODE_FRAME; + nvenc->config.frameFieldMode = nvenc_cfg->interlaced ? NV_ENC_PARAMS_FRAME_FIELD_MODE_FIELD : NV_ENC_PARAMS_FRAME_FIELD_MODE_FRAME; nvenc->config.mvPrecision = NV_ENC_MV_PRECISION_QUARTER_PEL; //NV_ENC_CODEC_CONFIG rate-control @@ -563,7 +563,9 @@ static bool encode_frame(nvencoder_t *nvenc, nvenc_frame_t *nvenc_frame, bool *o pic_params.inputBuffer = nvenc->i_buffer[nvenc->current_i % MAX_BUFFERS]; pic_params.outputBitstream = nvenc->o_buffer[nvenc->current_o % MAX_BUFFERS]; pic_params.bufferFmt = nvenc->buffer_fmt; - pic_params.pictureStruct = NV_ENC_PIC_STRUCT_FRAME; + pic_params.pictureStruct = nvenc_frame->interlaced ? + nvenc_frame->top_field_first ? NV_ENC_PIC_STRUCT_FIELD_TOP_BOTTOM : NV_ENC_PIC_STRUCT_FIELD_BOTTOM_TOP : + NV_ENC_PIC_STRUCT_FRAME; pic_params.frameIdx = nvenc_frame->frame_idx; if (nvenc_frame->force_idr) pic_params.encodePicFlags |= NV_ENC_PIC_FLAG_FORCEIDR; -- 2.1.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel