* Revert "Revert vcpkg ffmpeg (#8751)"
This reverts commit 5c16a8302e6c9c1381873aff45dba1487ee51d4f.
* vcpkg: Reland ffmpeg and try to fix sciter build
Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>
* vcpkg: Detect AVX2 by requiring __m256i
(ubuntu18.04 sciter)
Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>
* Install nasm from debian buster and python3.7
... from ubuntu universe
[Skip CI]
* vcpkg: Add libyuv port with fix for windows
From
abc59feabf
Found by @deep-soft
Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>
* Bump vcpkg baseline to 2024.07.12
Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>
* Fix F-Droid version action
I thought the latest release will be updated by the time hook starts
but it is not the case. Get tag from GITHUB_REF instead if GITHUB_REF_TYPE
is "tag".
Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>
---------
Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>
96 lines
3.8 KiB
Diff
96 lines
3.8 KiB
Diff
From afe89a70f6bc7ebd0a6a0a31101801b88cbd60ee Mon Sep 17 00:00:00 2001
|
|
From: 21pages <pages21@163.com>
|
|
Date: Sun, 5 May 2024 12:45:23 +0800
|
|
Subject: [PATCH] use release/7.0's update_bitrate
|
|
|
|
Signed-off-by: 21pages <pages21@163.com>
|
|
---
|
|
libavcodec/qsvenc.c | 39 +++++++++++++++++++++++++++++++++++++++
|
|
libavcodec/qsvenc.h | 6 ++++++
|
|
2 files changed, 45 insertions(+)
|
|
|
|
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
|
|
index 2382c2f5f7..9b34f37eb3 100644
|
|
--- a/libavcodec/qsvenc.c
|
|
+++ b/libavcodec/qsvenc.c
|
|
@@ -714,6 +714,11 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
|
|
brc_param_multiplier = (FFMAX(FFMAX3(target_bitrate_kbps, max_bitrate_kbps, buffer_size_in_kilobytes),
|
|
initial_delay_in_kilobytes) + 0x10000) / 0x10000;
|
|
|
|
+ q->old_rc_buffer_size = avctx->rc_buffer_size;
|
|
+ q->old_rc_initial_buffer_occupancy = avctx->rc_initial_buffer_occupancy;
|
|
+ q->old_bit_rate = avctx->bit_rate;
|
|
+ q->old_rc_max_rate = avctx->rc_max_rate;
|
|
+
|
|
switch (q->param.mfx.RateControlMethod) {
|
|
case MFX_RATECONTROL_CBR:
|
|
case MFX_RATECONTROL_VBR:
|
|
@@ -1657,6 +1662,39 @@ static int update_qp(AVCodecContext *avctx, QSVEncContext *q,
|
|
return updated;
|
|
}
|
|
|
|
+static int update_bitrate(AVCodecContext *avctx, QSVEncContext *q)
|
|
+{
|
|
+ int updated = 0;
|
|
+ int target_bitrate_kbps, max_bitrate_kbps, brc_param_multiplier;
|
|
+ int buffer_size_in_kilobytes, initial_delay_in_kilobytes;
|
|
+
|
|
+ UPDATE_PARAM(q->old_rc_buffer_size, avctx->rc_buffer_size);
|
|
+ UPDATE_PARAM(q->old_rc_initial_buffer_occupancy, avctx->rc_initial_buffer_occupancy);
|
|
+ UPDATE_PARAM(q->old_bit_rate, avctx->bit_rate);
|
|
+ UPDATE_PARAM(q->old_rc_max_rate, avctx->rc_max_rate);
|
|
+ if (!updated)
|
|
+ return 0;
|
|
+
|
|
+ buffer_size_in_kilobytes = avctx->rc_buffer_size / 8000;
|
|
+ initial_delay_in_kilobytes = avctx->rc_initial_buffer_occupancy / 8000;
|
|
+ target_bitrate_kbps = avctx->bit_rate / 1000;
|
|
+ max_bitrate_kbps = avctx->rc_max_rate / 1000;
|
|
+ brc_param_multiplier = (FFMAX(FFMAX3(target_bitrate_kbps, max_bitrate_kbps, buffer_size_in_kilobytes),
|
|
+ initial_delay_in_kilobytes) + 0x10000) / 0x10000;
|
|
+
|
|
+ q->param.mfx.BufferSizeInKB = buffer_size_in_kilobytes / brc_param_multiplier;
|
|
+ q->param.mfx.InitialDelayInKB = initial_delay_in_kilobytes / brc_param_multiplier;
|
|
+ q->param.mfx.TargetKbps = target_bitrate_kbps / brc_param_multiplier;
|
|
+ q->param.mfx.MaxKbps = max_bitrate_kbps / brc_param_multiplier;
|
|
+ q->param.mfx.BRCParamMultiplier = brc_param_multiplier;
|
|
+ av_log(avctx, AV_LOG_VERBOSE,
|
|
+ "Reset BufferSizeInKB: %d; InitialDelayInKB: %d; "
|
|
+ "TargetKbps: %d; MaxKbps: %d; BRCParamMultiplier: %d\n",
|
|
+ q->param.mfx.BufferSizeInKB, q->param.mfx.InitialDelayInKB,
|
|
+ q->param.mfx.TargetKbps, q->param.mfx.MaxKbps, q->param.mfx.BRCParamMultiplier);
|
|
+ return updated;
|
|
+}
|
|
+
|
|
static int update_parameters(AVCodecContext *avctx, QSVEncContext *q,
|
|
const AVFrame *frame)
|
|
{
|
|
@@ -1666,6 +1704,7 @@ static int update_parameters(AVCodecContext *avctx, QSVEncContext *q,
|
|
return 0;
|
|
|
|
needReset = update_qp(avctx, q, frame);
|
|
+ needReset |= update_bitrate(avctx, q);
|
|
if (!needReset)
|
|
return 0;
|
|
|
|
diff --git a/libavcodec/qsvenc.h b/libavcodec/qsvenc.h
|
|
index b754ac4b56..5745533165 100644
|
|
--- a/libavcodec/qsvenc.h
|
|
+++ b/libavcodec/qsvenc.h
|
|
@@ -224,6 +224,12 @@ typedef struct QSVEncContext {
|
|
int min_qp_p;
|
|
int max_qp_b;
|
|
int min_qp_b;
|
|
+
|
|
+ // These are used for bitrate control reset
|
|
+ int old_bit_rate;
|
|
+ int old_rc_buffer_size;
|
|
+ int old_rc_initial_buffer_occupancy;
|
|
+ int old_rc_max_rate;
|
|
} QSVEncContext;
|
|
|
|
int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q);
|
|
--
|
|
2.43.0.windows.1
|
|
|