]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/libvpxenc.c
Merge commit '03adfe913062c6995136eb1ca51152b6d596c0f4'
[ffmpeg] / libavcodec / libvpxenc.c
index de0d0b6bcbb6a399cb7d19d5f9b45a8990c55b55..b8e8d3a87b06a2081936721a0fa8e42350109d45 100644 (file)
@@ -108,6 +108,7 @@ typedef struct VPxEncoderContext {
     int noise_sensitivity;
     int vpx_cs;
     float level;
+    int row_mt;
 } VPxContext;
 
 /** String mappings for enum vp8e_enc_control_id */
@@ -139,6 +140,9 @@ static const char *const ctlidstr[] = {
     [VP9E_SET_TARGET_LEVEL]            = "VP9E_SET_TARGET_LEVEL",
     [VP9E_GET_LEVEL]                   = "VP9E_GET_LEVEL",
 #endif
+#ifdef VPX_CTRL_VP9E_SET_ROW_MT
+    [VP9E_SET_ROW_MT]                  = "VP9E_SET_ROW_MT",
+#endif
 #endif
 };
 
@@ -719,6 +723,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
 #endif
 #if VPX_ENCODER_ABI_VERSION >= 12
         codecctl_int(avctx, VP9E_SET_TARGET_LEVEL, ctx->level < 0 ? 255 : lrint(ctx->level * 10));
+#endif
+#ifdef VPX_CTRL_VP9E_SET_ROW_MT
+        if (ctx->row_mt >= 0)
+            codecctl_int(avctx, VP9E_SET_ROW_MT, ctx->row_mt);
 #endif
     }
 #endif
@@ -1012,6 +1020,16 @@ static int vpx_encode(AVCodecContext *avctx, AVPacket *pkt,
             rawimg_alpha->stride[VPX_PLANE_V] = frame->linesize[2];
         }
         timestamp                   = frame->pts;
+#if VPX_IMAGE_ABI_VERSION >= 4
+        switch (frame->color_range) {
+        case AVCOL_RANGE_MPEG:
+            rawimg->range = VPX_CR_STUDIO_RANGE;
+            break;
+        case AVCOL_RANGE_JPEG:
+            rawimg->range = VPX_CR_FULL_RANGE;
+            break;
+        }
+#endif
         if (frame->pict_type == AV_PICTURE_TYPE_I)
             flags |= VPX_EFLAG_FORCE_KF;
     }
@@ -1131,6 +1149,9 @@ static const AVOption vp9_options[] = {
     { "cyclic",          "Cyclic Refresh Aq",   0, AV_OPT_TYPE_CONST, {.i64 = 3}, 0, 0, VE, "aq_mode" },
 #if VPX_ENCODER_ABI_VERSION >= 12
     {"level", "Specify level", OFFSET(level), AV_OPT_TYPE_FLOAT, {.dbl=-1}, -1, 6.2, VE},
+#endif
+#ifdef VPX_CTRL_VP9E_SET_ROW_MT
+    {"row-mt", "Row based multi-threading", OFFSET(row_mt), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE},
 #endif
     LEGACY_OPTIONS
     { NULL }