edith_codecs
Clone
https://git.tahinli.com/Tahinli/edith_codecs.git
0 watching0 forksRust370.3 MiB8dbd683Tahinli3 months ago856 commits
| 1 | //! H.264 software decoder and encoder. |
| 2 | //! |
| 3 | //! Decoder scope: I, P and B slices under both entropy coders (CAVLC and |
| 4 | //! CABAC) of 8-bit 4:2:0 progressive streams — intra prediction, inter |
| 5 | //! prediction with the full decoded picture buffer of clause 8.2, weighted |
| 6 | //! prediction, and the in-loop deblocking filter — decoded bit-exactly against |
| 7 | //! the JVT conformance suite. Frames come out in display order. Everything |
| 8 | //! outside that scope returns a named [`Error::Unsupported`] — never wrong |
| 9 | //! output. |
| 10 | //! |
| 11 | //! Implemented from Rec. ITU-T H.264 (V15, 08/2024) only; no third-party |
| 12 | //! decoder source was consulted. |
| 13 | //! |
| 14 | //! Two entry surfaces over one decode core: [`Decoder`] takes NAL units, which |
| 15 | //! is what a bitstream tool has, and [`H264Decoder`] implements |
| 16 | //! [`ec_core::registry::Decoder`] over packets — including `avcC` extradata and |
| 17 | //! length-prefixed NAL units — which is what a demuxer hands over. |
| 18 | //! |
| 19 | //! ```no_run |
| 20 | //! use ec_core::registry::{CodecId, CodecParameters, Decoder}; |
| 21 | //! use ec_core::{Packet, TimeBase}; |
| 22 | //! use ec_h264::H264Decoder; |
| 23 | //! |
| 24 | //! # fn main() -> ec_core::Result<()> { |
| 25 | //! let annex_b: Vec<u8> = std::fs::read("stream.264")?; |
| 26 | //! let mut decoder = H264Decoder::new(CodecParameters::new(CodecId::H264))?; |
| 27 | //! decoder.send_packet(&Packet::new(0, TimeBase::new(1, 25), annex_b))?; |
| 28 | //! let frame = decoder.receive_frame()?; // the first decoded picture, I420 |
| 29 | //! # let _ = frame; |
| 30 | //! # Ok(()) |
| 31 | //! # } |
| 32 | //! ``` |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | pub use BitAccount; |
| 53 | pub use H264Decoder; |
| 54 | pub use ; |
| 55 | pub use ; |
| 56 | pub use ; |