edith_codecs
Clone
https://git.tahinli.com/Tahinli/edith_codecs.git
0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits
| 1 | //! Frame-level structures and the raw (uncompressed) frame tag |
| 2 | //! (RFC 6386 §9.1). |
| 3 | |
| 4 | use ; |
| 5 | |
| 6 | /// Key frame or interframe — the 1-bit frame type from the frame tag. |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | /// The 3-byte frame tag every frame starts with (RFC 6386 §9.1 item 1-4): |
| 16 | /// 1 bit type, 3 bits version, 1 bit show_frame, 19 bits first-partition |
| 17 | /// size — all read out of one little-endian 24-bit word. |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | /// Bytes occupied by the 3-byte frame tag. |
| 33 | pub const FRAME_TAG_SZ: usize = 3; |
| 34 | |
| 35 | /// Bytes occupied by the key frame's start code + size fields (§9.1). |
| 36 | pub const KEYFRAME_HEADER_SZ: usize = 7; |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | /// Key-frame dimensions and scaling flags (RFC 6386 §9.1). |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | /// Parse the key-frame start code (`9d 01 2a`) and dimensions that follow |
| 72 | /// the frame tag. `data` starts at the frame tag. |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | /// Number of 16×16 macroblock columns/rows covering `width × height` |
| 105 | /// pixels (the encoded frame is padded up to whole macroblocks). |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 |