From 54def1ba556e85f82e27484209dd5c85f5cde3ea Mon Sep 17 00:00:00 2001 From: cbwu <504-wuchengbo@htsdfp.com> Date: Wed, 18 Sep 2024 15:36:01 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E6=8B=89=E6=B5=81=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=94=BB=E8=B4=A8=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Src/Video/cffmpeg_decode.cpp | 3 --- Src/Video/ffmpegvideodlg.cpp | 5 ++++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Src/Video/cffmpeg_decode.cpp b/Src/Video/cffmpeg_decode.cpp index e782825..ebd601a 100644 --- a/Src/Video/cffmpeg_decode.cpp +++ b/Src/Video/cffmpeg_decode.cpp @@ -145,9 +145,6 @@ bool Cffmpeg_decode::open_input_file() { decoderCtx->height, // AV_PIX_FMT_RGB32, // SWS_BICUBIC, NULL, NULL, NULL); - // 颜色空间调整(可选) - // sws_setColorspaceDetails(swsCtx, sws_getCoefficients(SWS_CS_DEFAULT), 0, - // sws_getCoefficients(SWS_CS_DEFAULT), 0, 0, 0, 0); numBytes = av_image_get_buffer_size(AV_PIX_FMT_RGB32, // decoderCtx->width, // decoderCtx->height, // diff --git a/Src/Video/ffmpegvideodlg.cpp b/Src/Video/ffmpegvideodlg.cpp index dfcee90..c6dce82 100644 --- a/Src/Video/ffmpegvideodlg.cpp +++ b/Src/Video/ffmpegvideodlg.cpp @@ -77,6 +77,8 @@ void ffmpegvideoDlg::stop() { // 绘图事件 void ffmpegvideoDlg::paintEvent(QPaintEvent *) { QPainter painter(this); + // 开启抗锯齿 + painter.setRenderHint(QPainter::Antialiasing, true); painter.drawImage(m_ax, m_ay, img); } @@ -105,7 +107,8 @@ void ffmpegvideoDlg::receiveQImage(const QImage &rImg) { // img = rImg.scaled(this->size()); QSize imgsize(m_setVideoAreaWidth, m_setVideoAreaHeight); - img = rImg.scaled(imgsize); + // 使用平滑缩放模式来减少图像模糊 + img = rImg.scaled(imgsize, Qt::KeepAspectRatio, Qt::SmoothTransformation); update(); } // 显示不同提示消息