Commit f6ebe21
committed
feat(macos): wire 4:4:4 BiPlanar capture for ProRes end-to-end
ProRes profiles are intrinsically 10-bit (proxy / lt / standard / hq)
or 12-bit (4444 / 4444 XQ); FFmpeg's prores_videotoolbox supported
input pix_fmt list does not include the 4:2:0 BiPlanar formats (NV12 /
P010) Sunshine has historically delivered for H.264 / HEVC / AV1. The
422 family wants 4:2:2 or higher chroma and the 4444 family wants
4:4:4 natively. Until now, the macOS capture path could only produce
4:2:0 buffers, so the ProRes encoder probe failed at avcodec_open2
with "Couldn't open" regardless of profile selection or colorspace
configuration.
Wire the 4:4:4 BiPlanar capture path end-to-end:
* Add nv24 / p410 to platf::pix_fmt_e and the from_pix_fmt switch.
* Map AV_PIX_FMT_NV24 / AV_PIX_FMT_P410 in video::map_pix_fmt.
* Populate the previously-NONE 4:4:4 pix_fmt slots on the
videotoolbox encoder declaration and add YUV444_SUPPORT to its
flags. H.264 and HEVC VideoToolbox don't gain anything new
functionally — they remain 4:2:0 only on Apple Silicon hardware —
but the 4:4:4 probe runs against them harmlessly and falls
through with their YUV444 capability bit set false, which is
correct.
* Route nv24 / p410 through nv12_zero_device in
display.mm::make_avcodec_encode_device, alongside the existing
nv12 / p010 paths.
* Set the matching CVPixelBufferType
(kCVPixelFormatType_444YpCbCr*BiPlanarVideoRange) per pix_fmt in
nv12_zero_device::init.
Update the ProRes encoder probe in test_prores to use a ProRes-shaped
config:
* dynamicRange = 1 (10-bit pix_fmt slot instead of 8-bit).
* encoderCscMode = 3 (full range, BT.709 instead of BT.601).
* chromaSamplingType = 1 (4:4:4 P410 instead of 4:2:0 P010).
Any ProRes probe that succeeds inherently uses 10-bit input, so
DYNAMIC_RANGE is promoted eagerly here rather than relying on
test_hdr_and_yuv444 below (which gates on PASSED and only sets
DYNAMIC_RANGE itself).
Verified end-to-end on M4 Max: the startup probe now produces
"Found ProRes encoder: prores_videotoolbox [videotoolbox]", where
previously the encoder failed to open at every config permutation
attempted.
This is the runtime-side companion to the build-deps change that
adds prores_videotoolbox to the FFmpeg configure's --enable-encoder
flag (LizardByte/build-deps#693). Without that, the encoder symbol
is missing from libavcodec.a's static codec list and
avcodec_find_encoder_by_name returns null regardless of the wiring
in this commit.1 parent ab3f788 commit f6ebe21
4 files changed
Lines changed: 101 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
| 244 | + | |
| 245 | + | |
244 | 246 | | |
245 | 247 | | |
246 | 248 | | |
| |||
258 | 260 | | |
259 | 261 | | |
260 | 262 | | |
| 263 | + | |
| 264 | + | |
261 | 265 | | |
262 | 266 | | |
263 | 267 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
301 | 301 | | |
302 | 302 | | |
303 | 303 | | |
304 | | - | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
305 | 313 | | |
306 | 314 | | |
307 | 315 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
60 | 83 | | |
61 | 84 | | |
62 | 85 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1124 | 1124 | | |
1125 | 1125 | | |
1126 | 1126 | | |
1127 | | - | |
1128 | | - | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
1129 | 1136 | | |
1130 | 1137 | | |
1131 | 1138 | | |
| |||
1197 | 1204 | | |
1198 | 1205 | | |
1199 | 1206 | | |
1200 | | - | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
1201 | 1214 | | |
1202 | 1215 | | |
1203 | 1216 | | |
| |||
2783 | 2796 | | |
2784 | 2797 | | |
2785 | 2798 | | |
2786 | | - | |
2787 | | - | |
2788 | | - | |
2789 | | - | |
2790 | | - | |
| 2799 | + | |
| 2800 | + | |
| 2801 | + | |
| 2802 | + | |
| 2803 | + | |
| 2804 | + | |
| 2805 | + | |
| 2806 | + | |
| 2807 | + | |
| 2808 | + | |
| 2809 | + | |
| 2810 | + | |
| 2811 | + | |
| 2812 | + | |
| 2813 | + | |
| 2814 | + | |
| 2815 | + | |
| 2816 | + | |
| 2817 | + | |
| 2818 | + | |
| 2819 | + | |
| 2820 | + | |
| 2821 | + | |
| 2822 | + | |
| 2823 | + | |
| 2824 | + | |
| 2825 | + | |
| 2826 | + | |
| 2827 | + | |
| 2828 | + | |
| 2829 | + | |
| 2830 | + | |
| 2831 | + | |
| 2832 | + | |
2791 | 2833 | | |
2792 | 2834 | | |
2793 | | - | |
| 2835 | + | |
2794 | 2836 | | |
2795 | 2837 | | |
2796 | 2838 | | |
| 2839 | + | |
| 2840 | + | |
| 2841 | + | |
| 2842 | + | |
| 2843 | + | |
| 2844 | + | |
| 2845 | + | |
| 2846 | + | |
| 2847 | + | |
2797 | 2848 | | |
2798 | 2849 | | |
2799 | 2850 | | |
| |||
3365 | 3416 | | |
3366 | 3417 | | |
3367 | 3418 | | |
| 3419 | + | |
| 3420 | + | |
| 3421 | + | |
| 3422 | + | |
3368 | 3423 | | |
3369 | 3424 | | |
3370 | 3425 | | |
| |||
0 commit comments