Commit Graph

17 Commits

Author SHA1 Message Date
Andreas Rheinhardt 3e669b24e2 avutil/hwcontext: Allocate AVHWFramesCtx jointly with its internals
This is possible because the lifetime of these structures coincide.
It has the advantage of allowing to remove AVHWFramesInternal
from the public header; given that AVHWFramesInternal.priv is no more,
most accesses to AVHWFramesInternal are no more; indeed, the only
field accessed of it outside of hwcontext.c is the internal frame pool,
making this commit very simple.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-07 08:53:31 -03:00
Andreas Rheinhardt 68f48d5c30 avutil/hwcontext_videotoolbox: Allocate pub and priv frames hwctx together
This is possible because the lifetime of both coincide.
Besides reducing the number of allocations this also simplifies
access to VTFramesContext as one no longer has to
go through AVHWFramesInternal.

Tested-by: Jan Ekström <jeebjp@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-03-05 18:45:36 +01:00
Zhao Zhili bba5a563c8 avutil/hwcontext_vt: add pixel format map for full range YUV420P
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-01-12 10:49:36 +08:00
Zhao Zhili 5d255ba95a avutil/hwcontext_videotoolbox: add frame hwctx to specify color range
VideoToolbox use different identifiers for the same pixel format
with different color range, like

kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange
kCVPixelFormatType_420YpCbCr8BiPlanarFullRange.

Before the patch, vt_pool_alloc() always use limited range, and it
will fail for pixel format AV_PIX_FMT_BGRA since there is no limited
range kCVPixelFormatType_32BGRA.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2024-01-04 17:31:49 +08:00
Zhao Zhili e7aca339ce avutil/hwcontext_videotoolbox: BGRA should be full range
HEVC alpha layer encoding is broken without the patch.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2023-01-11 18:57:20 +08:00
Zhao Zhili c3f00daa99 avutil/hwcontext_videotoolbox: create real buffer pool
vt_get_buffer shouldn't do buffer pool's job.

Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2022-04-29 17:27:37 +08:00
Cameron Gutman 242ed971cb lavu/videotoolbox: add support for memory mapping frames
Signed-off-by: Cameron Gutman <aicommander@gmail.com>
Signed-off-by: Aman Karmani <aman@tmm1.net>
2022-01-06 19:17:42 -08:00
rcombs 5afc5661ac lavu/hwcontext_videotoolbox: use OS-provided mapping routines when available 2021-12-22 18:43:34 -06:00
rcombs b7e1ec7bda lavu/videotoolbox: expose routine to set CVPixelBufferRef metadata 2021-12-22 18:43:17 -06:00
rcombs 69bd95dcd8 lavu/videotoolbox: expose conversion routines for color parameters
Also fixes symbol lookup errors on older macOS when built with a newer SDK,
introduced in 6cab5206b0
2021-12-22 18:42:51 -06:00
rcombs 350eb59f8c videotoolbox: add alpha support 2021-11-28 16:40:58 -06:00
rcombs d2229eca51 lavu/videotoolbox: add 422 and 444 pixel format mappings 2021-11-28 16:40:43 -06:00
Limin Wang 6cab5206b0 avutil/hwcontext_videotoolbox: fix use of unknown builtin '__builtin_available'
OSX version: 10.11.6
Apple LLVM version 8.0.0 (clang-800.0.42.1)
Target: x86_64-apple-darwin15.6.0

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-11-03 21:20:47 +08:00
Aman Karmani 504c60660d avutil/hwcontext_videotoolbox: implement hwupload to convert AVFrame to CVPixelBuffer
Teach AV_HWDEVICE_TYPE_VIDEOTOOLBOX to be able to create AVFrames of type
AV_PIX_FMT_VIDEOTOOLBOX. This can be used to hwupload a regular AVFrame
into its CVPixelBuffer equivalent.

    ffmpeg -init_hw_device videotoolbox -f lavfi -i color=black:640x480 -vf hwupload -c:v h264_videotoolbox -f null -y /dev/null

Signed-off-by: Aman Karmani <aman@tmm1.net>
2021-07-18 12:01:16 -07:00
Akemi 2a9d461abc avcodec/videotoolbox: add support for full range pixel formats
Signed-off-by: Aman Gupta <aman@tmm1.net>
2019-09-04 10:51:20 -07:00
fumoboy007 036b4b0f85 avcodec/videotoolbox: add support for 10bit pixel format
this patch was originally posted on issue #7704 and was slightly
adjusted to check for the availability of the pixel format.
2019-04-16 03:43:06 +03:00
wm4 532b23f079 videotoolbox: add hwcontext support
This adds tons of code for no other benefit than making VideoToolbox
support conform with the new hwaccel API (using hw_device_ctx and
hw_frames_ctx).

Since VideoToolbox decoding does not actually require the user to
allocate frames, the new code does mostly nothing.

One benefit is that ffmpeg_videotoolbox.c can be dropped once generic
hwaccel support for ffmpeg.c is merged from Libav.

Does not consider VDA or VideoToolbox encoding.

Fun fact: the frame transfer functions are copied from vaapi, as the
mapping makes copying generic boilerplate. Mapping itself is not
exported by the VT code, because I don't know how to test.
2017-05-15 11:30:36 +02:00