Revert "use fullrange by default for yuv420p if supported (#6655)" (#6656)

This reverts commit 80afa98d66.
This commit is contained in:
RustDesk
2023-12-11 23:46:32 +09:00
committed by GitHub
parent 80afa98d66
commit ebb14af488
15 changed files with 141 additions and 388 deletions

View File

@@ -1,5 +1,5 @@
use crate::{
codec::{base_bitrate, codec_thread_num, EncoderApi, EncoderCfg, ExtraEncoderCfg},
codec::{base_bitrate, codec_thread_num, EncoderApi, EncoderCfg},
hw, ImageFormat, ImageRgb, Pixfmt, HW_STRIDE_ALIGN,
};
use hbb_common::{
@@ -36,11 +36,10 @@ pub struct HwEncoder {
width: u32,
height: u32,
bitrate: u32, //kbs
extra: ExtraEncoderCfg,
}
impl EncoderApi for HwEncoder {
fn new(cfg: EncoderCfg, extra: ExtraEncoderCfg) -> ResultType<Self>
fn new(cfg: EncoderCfg, _i444: bool) -> ResultType<Self>
where
Self: Sized,
{
@@ -83,7 +82,6 @@ impl EncoderApi for HwEncoder {
width: ctx.width as _,
height: ctx.height as _,
bitrate,
extra,
}),
Err(_) => Err(anyhow!(format!("Failed to create encoder"))),
}
@@ -122,7 +120,7 @@ impl EncoderApi for HwEncoder {
let pixfmt = if self.pixfmt == AVPixelFormat::AV_PIX_FMT_NV12 {
Pixfmt::NV12
} else {
Pixfmt::YUV420P
Pixfmt::I420
};
let stride = self
.encoder
@@ -133,7 +131,6 @@ impl EncoderApi for HwEncoder {
.collect();
crate::EncodeYuvFormat {
pixfmt,
range: self.extra.range,
w: self.encoder.ctx.width as _,
h: self.encoder.ctx.height as _,
stride,