U17: vk-video-ffi delete the synchronous encode* methods and flush_last (no caller: ec-vk wraps submit*+flush, ec-hw calls ec-vk only)
Browse files at this commitf5328b9bcc3d4eba014e8894b62474b3e73c09a6Parent: 95a81bb4 changed files +0 -121
- shims/vk-video-ffi/src/av1_encode.rs +0 -40
- shims/vk-video-ffi/src/h264_encode.rs +0 -34
- shims/vk-video-ffi/src/h265_encode.rs +0 -40
- shims/vk-video-ffi/src/session.rs +0 -7
shims/vk-video-ffi/src/av1_encode.rsmodified+0 -40
| @@ -302,13 +302,6 @@ impl Av1EncodeSession { | ||
| 302 | 302 | self.encode_uploaded(pic) |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | - /// Encodes one picture from a shared D3D11 texture synchronously and returns its coded bytes. | |
| 306 | - #[cfg(windows)] | |
| 307 | - pub fn encode_d3d11(&mut self, src: &crate::D3d11Texture<'_>, pic: &Av1Picture) -> Result<Vec<u8>, Error> { | |
| 308 | - self.submit_d3d11(src, pic)?; | |
| 309 | - self.enc.flush_last() | |
| 310 | - } | |
| 311 | - | |
| 312 | 305 | fn encode_uploaded(&mut self, pic: &Av1Picture) -> Result<Option<Vec<u8>>, Error> { |
| 313 | 306 | let extent = self.enc.extent; |
| 314 | 307 | |
| @@ -448,39 +441,6 @@ impl Av1EncodeSession { | ||
| 448 | 441 | Ok(out) |
| 449 | 442 | } |
| 450 | 443 | |
| 451 | - /// Encodes one picture synchronously and returns its coded bytes. | |
| 452 | - pub fn encode(&mut self, y: &[u8], uv: &[u8], pic: &Av1Picture) -> Result<Vec<u8>, Error> { | |
| 453 | - self.submit(y, uv, pic)?; | |
| 454 | - self.enc.flush_last() | |
| 455 | - } | |
| 456 | - | |
| 457 | - /// Encodes one picture synchronously and returns its coded bytes. | |
| 458 | - pub fn encode_16(&mut self, y: &[u16], uv: &[u16], pic: &Av1Picture) -> Result<Vec<u8>, Error> { | |
| 459 | - self.submit_16(y, uv, pic)?; | |
| 460 | - self.enc.flush_last() | |
| 461 | - } | |
| 462 | - | |
| 463 | - /// Encodes one picture synchronously and returns its coded bytes. | |
| 464 | - pub fn encode_rgb( | |
| 465 | - &mut self, | |
| 466 | - rgb: &[u8], | |
| 467 | - src_width: u32, | |
| 468 | - src_height: u32, | |
| 469 | - stride_bytes: u32, | |
| 470 | - bgr: bool, | |
| 471 | - pic: &Av1Picture, | |
| 472 | - ) -> Result<Vec<u8>, Error> { | |
| 473 | - self.submit_rgb(rgb, src_width, src_height, stride_bytes, bgr, pic)?; | |
| 474 | - self.enc.flush_last() | |
| 475 | - } | |
| 476 | - | |
| 477 | - #[cfg(target_os = "linux")] | |
| 478 | - /// Encodes one picture synchronously and returns its coded bytes. | |
| 479 | - pub fn encode_dmabuf(&mut self, src: &DmaBuf<'_>, pic: &Av1Picture) -> Result<Vec<u8>, Error> { | |
| 480 | - self.submit_dmabuf(src, pic)?; | |
| 481 | - self.enc.flush_last() | |
| 482 | - } | |
| 483 | - | |
| 484 | 444 | /// Waits for queued pictures and returns their coded bytes in order. |
| 485 | 445 | pub fn flush(&mut self) -> Result<Vec<Vec<u8>>, Error> { |
| 486 | 446 | self.enc.flush() |
shims/vk-video-ffi/src/h264_encode.rsmodified+0 -34
| @@ -399,13 +399,6 @@ impl H264EncodeSession { | ||
| 399 | 399 | self.encode_uploaded(pic) |
| 400 | 400 | } |
| 401 | 401 | |
| 402 | - /// Encodes one picture from a shared D3D11 texture synchronously and returns its coded bytes. | |
| 403 | - #[cfg(windows)] | |
| 404 | - pub fn encode_d3d11(&mut self, src: &crate::D3d11Texture<'_>, pic: &H264Picture) -> Result<Vec<u8>, Error> { | |
| 405 | - self.submit_d3d11(src, pic)?; | |
| 406 | - self.enc.flush_last() | |
| 407 | - } | |
| 408 | - | |
| 409 | 402 | fn encode_uploaded(&mut self, pic: &H264Picture) -> Result<Option<Vec<u8>>, Error> { |
| 410 | 403 | let extent = self.enc.extent; |
| 411 | 404 | |
| @@ -538,33 +531,6 @@ impl H264EncodeSession { | ||
| 538 | 531 | .submit(&begin_slots, &mut applied.rc, &mut chain.rc, &encode) |
| 539 | 532 | } |
| 540 | 533 | |
| 541 | - /// Encodes one picture synchronously and returns its coded bytes. | |
| 542 | - pub fn encode(&mut self, y: &[u8], uv: &[u8], pic: &H264Picture) -> Result<Vec<u8>, Error> { | |
| 543 | - self.submit(y, uv, pic)?; | |
| 544 | - self.enc.flush_last() | |
| 545 | - } | |
| 546 | - | |
| 547 | - /// Encodes one picture synchronously and returns its coded bytes. | |
| 548 | - pub fn encode_rgb( | |
| 549 | - &mut self, | |
| 550 | - rgb: &[u8], | |
| 551 | - src_width: u32, | |
| 552 | - src_height: u32, | |
| 553 | - stride_bytes: u32, | |
| 554 | - bgr: bool, | |
| 555 | - pic: &H264Picture, | |
| 556 | - ) -> Result<Vec<u8>, Error> { | |
| 557 | - self.submit_rgb(rgb, src_width, src_height, stride_bytes, bgr, pic)?; | |
| 558 | - self.enc.flush_last() | |
| 559 | - } | |
| 560 | - | |
| 561 | - #[cfg(target_os = "linux")] | |
| 562 | - /// Encodes one picture synchronously and returns its coded bytes. | |
| 563 | - pub fn encode_dmabuf(&mut self, src: &DmaBuf<'_>, pic: &H264Picture) -> Result<Vec<u8>, Error> { | |
| 564 | - self.submit_dmabuf(src, pic)?; | |
| 565 | - self.enc.flush_last() | |
| 566 | - } | |
| 567 | - | |
| 568 | 534 | /// Waits for queued pictures and returns their coded bytes in order. |
| 569 | 535 | pub fn flush(&mut self) -> Result<Vec<Vec<u8>>, Error> { |
| 570 | 536 | self.enc.flush() |
shims/vk-video-ffi/src/h265_encode.rsmodified+0 -40
| @@ -344,13 +344,6 @@ impl H265EncodeSession { | ||
| 344 | 344 | self.encode_uploaded(pic) |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | - /// Encodes one picture from a shared D3D11 texture synchronously and returns its coded bytes. | |
| 348 | - #[cfg(windows)] | |
| 349 | - pub fn encode_d3d11(&mut self, src: &crate::D3d11Texture<'_>, pic: &H265Picture) -> Result<Vec<u8>, Error> { | |
| 350 | - self.submit_d3d11(src, pic)?; | |
| 351 | - self.enc.flush_last() | |
| 352 | - } | |
| 353 | - | |
| 354 | 347 | fn encode_uploaded(&mut self, pic: &H265Picture) -> Result<Option<Vec<u8>>, Error> { |
| 355 | 348 | let extent = self.enc.extent; |
| 356 | 349 | |
| @@ -462,39 +455,6 @@ impl H265EncodeSession { | ||
| 462 | 455 | .submit(&begin_slots, &mut applied.rc, &mut chain.rc, &encode) |
| 463 | 456 | } |
| 464 | 457 | |
| 465 | - /// Encodes one picture synchronously and returns its coded bytes. | |
| 466 | - pub fn encode(&mut self, y: &[u8], uv: &[u8], pic: &H265Picture) -> Result<Vec<u8>, Error> { | |
| 467 | - self.submit(y, uv, pic)?; | |
| 468 | - self.enc.flush_last() | |
| 469 | - } | |
| 470 | - | |
| 471 | - /// Encodes one picture synchronously and returns its coded bytes. | |
| 472 | - pub fn encode_16(&mut self, y: &[u16], uv: &[u16], pic: &H265Picture) -> Result<Vec<u8>, Error> { | |
| 473 | - self.submit_16(y, uv, pic)?; | |
| 474 | - self.enc.flush_last() | |
| 475 | - } | |
| 476 | - | |
| 477 | - /// Encodes one picture synchronously and returns its coded bytes. | |
| 478 | - pub fn encode_rgb( | |
| 479 | - &mut self, | |
| 480 | - rgb: &[u8], | |
| 481 | - src_width: u32, | |
| 482 | - src_height: u32, | |
| 483 | - stride_bytes: u32, | |
| 484 | - bgr: bool, | |
| 485 | - pic: &H265Picture, | |
| 486 | - ) -> Result<Vec<u8>, Error> { | |
| 487 | - self.submit_rgb(rgb, src_width, src_height, stride_bytes, bgr, pic)?; | |
| 488 | - self.enc.flush_last() | |
| 489 | - } | |
| 490 | - | |
| 491 | - #[cfg(target_os = "linux")] | |
| 492 | - /// Encodes one picture synchronously and returns its coded bytes. | |
| 493 | - pub fn encode_dmabuf(&mut self, src: &DmaBuf<'_>, pic: &H265Picture) -> Result<Vec<u8>, Error> { | |
| 494 | - self.submit_dmabuf(src, pic)?; | |
| 495 | - self.enc.flush_last() | |
| 496 | - } | |
| 497 | - | |
| 498 | 458 | /// Waits for queued pictures and returns their coded bytes in order. |
| 499 | 459 | pub fn flush(&mut self) -> Result<Vec<Vec<u8>>, Error> { |
| 500 | 460 | self.enc.flush() |
shims/vk-video-ffi/src/session.rsmodified+0 -7
| @@ -1444,13 +1444,6 @@ impl Encoder { | ||
| 1444 | 1444 | Ok(out) |
| 1445 | 1445 | } |
| 1446 | 1446 | |
| 1447 | - /// Flushes and returns the last picture, for synchronous use where one picture is queued per call. | |
| 1448 | - pub(crate) fn flush_last(&mut self) -> Result<Vec<u8>, Error> { | |
| 1449 | - self.flush()? | |
| 1450 | - .pop() | |
| 1451 | - .ok_or_else(|| Error::Invalid("no picture encoded".into())) | |
| 1452 | - } | |
| 1453 | - | |
| 1454 | 1447 | fn finish(&mut self, k: usize) -> Result<Vec<u8>, Error> { |
| 1455 | 1448 | let slot = &self.slots[k]; |
| 1456 | 1449 | slot.main.wait()?; |