mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-03-22 20:51:17 +03:00
This reverts commit 80afa98d66.
This commit is contained in:
@@ -50,7 +50,7 @@ pub mod record;
|
||||
mod vpx;
|
||||
|
||||
#[repr(usize)]
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
#[derive(Copy, Clone)]
|
||||
pub enum ImageFormat {
|
||||
Raw,
|
||||
ABGR,
|
||||
@@ -124,21 +124,14 @@ pub trait TraitFrame {
|
||||
pub enum Pixfmt {
|
||||
BGRA,
|
||||
RGBA,
|
||||
YUV420P,
|
||||
I420,
|
||||
NV12,
|
||||
YUV444P,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||
pub enum ColorRange {
|
||||
Studio,
|
||||
Full,
|
||||
I444,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct EncodeYuvFormat {
|
||||
pub pixfmt: Pixfmt,
|
||||
pub range: ColorRange,
|
||||
pub w: usize,
|
||||
pub h: usize,
|
||||
pub stride: Vec<usize>,
|
||||
@@ -299,8 +292,6 @@ pub trait GoogleImage {
|
||||
fn stride(&self) -> Vec<i32>;
|
||||
fn planes(&self) -> Vec<*mut u8>;
|
||||
fn chroma(&self) -> Chroma;
|
||||
fn pixfmt(&self) -> Pixfmt;
|
||||
fn range(&self) -> ColorRange;
|
||||
fn get_bytes_per_row(w: usize, fmt: ImageFormat, stride: usize) -> usize {
|
||||
let bytes_per_pixel = match fmt {
|
||||
ImageFormat::Raw => 3,
|
||||
@@ -319,13 +310,9 @@ pub trait GoogleImage {
|
||||
let stride = self.stride();
|
||||
let planes = self.planes();
|
||||
unsafe {
|
||||
match (self.pixfmt(), rgb.fmt()) {
|
||||
(Pixfmt::YUV420P, ImageFormat::Raw) => {
|
||||
let f = match self.range() {
|
||||
ColorRange::Studio => super::I420ToRAW,
|
||||
ColorRange::Full => super::J420ToRAW,
|
||||
};
|
||||
f(
|
||||
match (self.chroma(), rgb.fmt()) {
|
||||
(Chroma::I420, ImageFormat::Raw) => {
|
||||
super::I420ToRAW(
|
||||
planes[0],
|
||||
stride[0],
|
||||
planes[1],
|
||||
@@ -338,12 +325,8 @@ pub trait GoogleImage {
|
||||
self.height() as _,
|
||||
);
|
||||
}
|
||||
(Pixfmt::YUV420P, ImageFormat::ARGB) => {
|
||||
let f = match self.range() {
|
||||
ColorRange::Studio => super::I420ToARGB,
|
||||
ColorRange::Full => super::J420ToARGB,
|
||||
};
|
||||
f(
|
||||
(Chroma::I420, ImageFormat::ARGB) => {
|
||||
super::I420ToARGB(
|
||||
planes[0],
|
||||
stride[0],
|
||||
planes[1],
|
||||
@@ -356,12 +339,8 @@ pub trait GoogleImage {
|
||||
self.height() as _,
|
||||
);
|
||||
}
|
||||
(Pixfmt::YUV420P, ImageFormat::ABGR) => {
|
||||
let f = match self.range() {
|
||||
ColorRange::Studio => super::I420ToABGR,
|
||||
ColorRange::Full => super::J420ToABGR,
|
||||
};
|
||||
f(
|
||||
(Chroma::I420, ImageFormat::ABGR) => {
|
||||
super::I420ToABGR(
|
||||
planes[0],
|
||||
stride[0],
|
||||
planes[1],
|
||||
@@ -374,12 +353,8 @@ pub trait GoogleImage {
|
||||
self.height() as _,
|
||||
);
|
||||
}
|
||||
(Pixfmt::YUV444P, ImageFormat::ARGB) => {
|
||||
let f = match self.range() {
|
||||
ColorRange::Studio => super::I444ToARGB,
|
||||
ColorRange::Full => super::J444ToARGB,
|
||||
};
|
||||
f(
|
||||
(Chroma::I444, ImageFormat::ARGB) => {
|
||||
super::I444ToARGB(
|
||||
planes[0],
|
||||
stride[0],
|
||||
planes[1],
|
||||
@@ -392,12 +367,8 @@ pub trait GoogleImage {
|
||||
self.height() as _,
|
||||
);
|
||||
}
|
||||
(Pixfmt::YUV444P, ImageFormat::ABGR) => {
|
||||
let f = match self.range() {
|
||||
ColorRange::Studio => super::I444ToABGR,
|
||||
ColorRange::Full => super::J444ToABGR,
|
||||
};
|
||||
f(
|
||||
(Chroma::I444, ImageFormat::ABGR) => {
|
||||
super::I444ToABGR(
|
||||
planes[0],
|
||||
stride[0],
|
||||
planes[1],
|
||||
@@ -411,7 +382,7 @@ pub trait GoogleImage {
|
||||
);
|
||||
}
|
||||
// (Chroma::I444, ImageFormat::Raw), new version libyuv have I444ToRAW
|
||||
_ => log::error!("{:?} -> {:?} is not supported", self.pixfmt(), rgb.fmt()),
|
||||
_ => log::error!("unsupported pixfmt: {:?}", self.chroma()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user