Le 2015-05-19 13:26, Luca Barbato a écrit :
+static int nvenc_setup_h264_config(AVCodecContext *avctx)
+{
+    NVENCContext *ctx                      = avctx->priv_data;
+    NV_ENC_CONFIG *cc                      = &ctx->config;
+    NV_ENC_CONFIG_H264 *h264               =
&cc->encodeCodecConfig.h264Config;
+ NV_ENC_CONFIG_H264_VUI_PARAMETERS *vui = &h264->h264VUIParameters;
+
+    vui->colourDescriptionPresentFlag = 1;
+    vui->videoSignalTypePresentFlag   = 1;
+
+    vui->colourMatrix            = avctx->colorspace;
+    vui->colourPrimaries         = avctx->color_primaries;
+    vui->transferCharacteristics = avctx->color_trc;
+
+ vui->videoFullRangeFlag = avctx->color_range == AVCOL_RANGE_JPEG;
+
+ h264->disableSPSPPS = (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) ? 1 : 0; + h264->repeatSPSPPS = (avctx->flags & CODEC_FLAG_GLOBAL_HEADER) ? 0 : 1;
+
+    h264->maxNumRefFrames = avctx->refs;
+    h264->idrPeriod       = cc->gopLength;
+
+    if (ctx->profile)
+        avctx->profile = ctx->profile;
+
+    if (avctx->pix_fmt == AV_PIX_FMT_YUV444P)
+        h264->chromaFormatIDC = 3;
+    else
+        h264->chromaFormatIDC = 1;
+
+    switch (avctx->profile) {
+    case FF_PROFILE_H264_BASELINE:
+        cc->profileGUID = NV_ENC_H264_PROFILE_BASELINE_GUID;
+        break;

What about CBP?


+    case FF_PROFILE_H264_MAIN:
+        cc->profileGUID = NV_ENC_H264_PROFILE_MAIN_GUID;
+        break;
+    case FF_PROFILE_H264_HIGH:
+        cc->profileGUID = NV_ENC_H264_PROFILE_HIGH_GUID;
+        break;
+    case FF_PROFILE_UNKNOWN:
+    default:
+        av_log(avctx, AV_LOG_WARNING,
+ "Unsupported profile %d requested, falling back to high\n",
+               ctx->profile);
+        cc->profileGUID = NV_ENC_H264_PROFILE_HIGH_GUID;
+        avctx->profile  = FF_PROFILE_H264_HIGH;
+        break;
+    }
+
+    if (ctx->level) {
+        h264->level = ctx->level;
+    } else {
+        h264->level = NV_ENC_LEVEL_AUTOSELECT;
+    }
+
+    return 0;
+}

--
Rémi Denis-Courmont
Remlab T:mi
http://www.remlab.net/
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to