Log converted encoder input detail alongside HEVC quantization

This commit is contained in:
evgeny committed 2026-10-18 19:46:35 +02:00
1 parent 6d5a626b9b
commit d1ba26f8ac
3 files changed
+24 -2

No files matched your search

+16
View File
@@ -390,6 +390,22 @@ bool LiveVideoEncoder::encode(const QImage& image, uint64_t pts, bool key, QList
int stride[4] = {static_cast<int>(canvas.bytesPerLine()), 0, 0, 0};
result = sws_scale(m->scale, input, stride, 0, canvas.height(), m->frame->data, m->frame->linesize);
}
if (result >= 0 && m->reportTimer.elapsed() >= 1000 && debug_should_output(DEBUG_LEVEL_TRACE, DEBUG_CATEGORY_DEBUG)
&& (m->frame->format == AV_PIX_FMT_NV12 || m->frame->format == AV_PIX_FMT_YUV420P)) {
uint64_t edges = 0, samples = 0;
int minimum = 255, maximum = 0;
for (int y = 0; y + 1 < m->frame->height; y += 16) {
const uint8_t* row = m->frame->data[0] + y * m->frame->linesize[0];
for (int x = 0; x + 1 < m->frame->width; x += 16) {
int value = row[x]; minimum = std::min(minimum, value); maximum = std::max(maximum, value);
edges += std::abs(value - row[x + 1]) + std::abs(value - row[x + m->frame->linesize[0]]); samples += 2;
}
}
DEBUG_TRACE(DEBUG_CATEGORY_DEBUG,
"video encoder input name=%s pts=%llu source=%dx%d encoded=%dx%d pixel=%d luma_min=%d luma_max=%d edge_x1000=%llu",
qPrintable(m->name), (unsigned long long)pts, image.width(), image.height(), m->frame->width, m->frame->height,
m->frame->format, minimum, maximum, (unsigned long long)(samples ? edges * 1000 / samples : 0));
}
bool constrained = m->config.profile != LiveVideoProfile::Automatic;
if (constrained && m->timestamps.size() >= 8) {
m->error = "GPU encoder exceeded the bounded input pipeline";