[FFmpeg-cvslog] ffmpeg: remove ffmpeg_videotoolbox

2021-11-28 Thread rcombs
ffmpeg | branch: master | rcombs  | Sat Nov 13 15:39:44 2021 
-0600| [4b54818981d2783af161c2ff670b658afbdda503] | committer: rcombs

ffmpeg: remove ffmpeg_videotoolbox

This was almost completely redundant. The only functionality that's no longer
available after this removal is the videotoolbox_pixfmt arg, which has been
obsolete for several years.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4b54818981d2783af161c2ff670b658afbdda503
---

 fftools/Makefile  |   4 -
 fftools/ffmpeg.c  |  37 +
 fftools/ffmpeg.h  |  10 ---
 fftools/ffmpeg_opt.c  |  28 +--
 fftools/ffmpeg_videotoolbox.c | 177 --
 5 files changed, 7 insertions(+), 249 deletions(-)

diff --git a/fftools/Makefile b/fftools/Makefile
index 5234932ab0..da420786eb 100644
--- a/fftools/Makefile
+++ b/fftools/Makefile
@@ -10,10 +10,6 @@ ALLAVPROGS   = $(AVBASENAMES:%=%$(PROGSSUF)$(EXESUF))
 ALLAVPROGS_G = $(AVBASENAMES:%=%$(PROGSSUF)_g$(EXESUF))
 
 OBJS-ffmpeg+= fftools/ffmpeg_opt.o 
fftools/ffmpeg_filter.o fftools/ffmpeg_hw.o
-ifndef CONFIG_VIDEOTOOLBOX
-OBJS-ffmpeg-$(CONFIG_VDA)  += fftools/ffmpeg_videotoolbox.o
-endif
-OBJS-ffmpeg-$(CONFIG_VIDEOTOOLBOX) += fftools/ffmpeg_videotoolbox.o
 
 define DOFFTOOL
 OBJS-$(1) += fftools/cmdutils.o fftools/$(1).o $(OBJS-$(1)-yes)
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index c838e2604c..25360423b5 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -2858,12 +2858,7 @@ static enum AVPixelFormat get_format(AVCodecContext *s, 
const enum AVPixelFormat
 break;
 }
 }
-if (config) {
-if (config->device_type != ist->hwaccel_device_type) {
-// Different hwaccel offered, ignore.
-continue;
-}
-
+if (config && config->device_type == ist->hwaccel_device_type) {
 ret = hwaccel_decode_init(s);
 if (ret < 0) {
 if (ist->hwaccel_id == HWACCEL_GENERIC) {
@@ -2876,36 +2871,10 @@ static enum AVPixelFormat get_format(AVCodecContext *s, 
const enum AVPixelFormat
 }
 continue;
 }
-} else {
-const HWAccel *hwaccel = NULL;
-int i;
-for (i = 0; hwaccels[i].name; i++) {
-if (hwaccels[i].pix_fmt == *p) {
-hwaccel = &hwaccels[i];
-break;
-}
-}
-if (!hwaccel) {
-// No hwaccel supporting this pixfmt.
-continue;
-}
-if (hwaccel->id != ist->hwaccel_id) {
-// Does not match requested hwaccel.
-continue;
-}
 
-ret = hwaccel->init(s);
-if (ret < 0) {
-av_log(NULL, AV_LOG_FATAL,
-   "%s hwaccel requested for input stream #%d:%d, "
-   "but cannot be initialized.\n", hwaccel->name,
-   ist->file_index, ist->st->index);
-return AV_PIX_FMT_NONE;
-}
+ist->hwaccel_pix_fmt = *p;
+break;
 }
-
-ist->hwaccel_pix_fmt = *p;
-break;
 }
 
 return *p;
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index 1728010f56..21c63415d6 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -60,16 +60,8 @@ enum HWAccelID {
 HWACCEL_NONE = 0,
 HWACCEL_AUTO,
 HWACCEL_GENERIC,
-HWACCEL_VIDEOTOOLBOX,
 };
 
-typedef struct HWAccel {
-const char *name;
-int (*init)(AVCodecContext *s);
-enum HWAccelID id;
-enum AVPixelFormat pix_fmt;
-} HWAccel;
-
 typedef struct HWDevice {
 const char *name;
 enum AVHWDeviceType type;
@@ -626,7 +618,6 @@ extern int stdin_interaction;
 extern int frame_bits_per_raw_sample;
 extern AVIOContext *progress_avio;
 extern float max_error_rate;
-extern char *videotoolbox_pixfmt;
 
 extern char *filter_nbthreads;
 extern int filter_complex_nbthreads;
@@ -636,7 +627,6 @@ extern int auto_conversion_filters;
 extern const AVIOInterruptCB int_cb;
 
 extern const OptionDef options[];
-extern const HWAccel hwaccels[];
 #if CONFIG_QSV
 extern char *qsv_device;
 #endif
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index feed772452..debd13f3bd 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -134,12 +134,6 @@ static const char *const opt_name_enc_time_bases[] 
   = {"enc_time_base"
 }\
 }
 
-const HWAccel hwaccels[] = {
-#if CONFIG_VIDEOTOOLBOX
-{ "videotoolbox", videotoolbox_init, HWACCEL_VIDEOTOOLBOX, 
AV_PIX_FMT_VIDEOTOOLBOX },
-#endif
-{ 0 },
-};
 HWDevice *filter_hw_device;
 
 char *vstats_filename;
@@ -931,21 +925,10 @@ static void add_input_streams(OptionsContext *o, 
AVFormatContext *ic)
 else if (!strcmp(hwaccel, "auto"))
 ist->hwaccel_id = HWACCEL_AUTO;
 

[FFmpeg-cvslog] lavu/pixfmt: add high-bit-depth semi-planar 4:2:2/4:4:4 formats

2021-11-28 Thread rcombs
ffmpeg | branch: master | rcombs  | Fri Nov 12 23:50:17 2021 
-0600| [b2cd1fb2ec64d04841d6c06fddf6e1d6e4ecfb34] | committer: rcombs

lavu/pixfmt: add high-bit-depth semi-planar 4:2:2/4:4:4 formats

These are used by VideoToolbox hardware decoders.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b2cd1fb2ec64d04841d6c06fddf6e1d6e4ecfb34
---

 doc/APIchanges   |  3 ++
 libavutil/pixdesc.c  | 96 
 libavutil/pixfmt.h   | 18 
 tests/ref/fate/imgutils  |  8 
 tests/ref/fate/sws-pixdesc-query | 44 ++
 5 files changed, 169 insertions(+)

diff --git a/doc/APIchanges b/doc/APIchanges
index 565f7e091e..bc9f4e38da 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,6 +14,9 @@ libavutil: 2021-04-27
 
 API changes, most recent first:
 
+2021-11-22 - xx - lavu 57.9.100 - pixfmt.h
+  Add AV_PIX_FMT_P210, AV_PIX_FMT_P410, AV_PIX_FMT_P216, and AV_PIX_FMT_P416.
+
 2021-11-17 - xx - lavf 57.9.100 - frame.h
   Add AV_FRAME_DATA_DOVI_RPU_BUFFER.
 
diff --git a/libavutil/pixdesc.c b/libavutil/pixdesc.c
index 69cb198646..727d7540b3 100644
--- a/libavutil/pixdesc.c
+++ b/libavutil/pixdesc.c
@@ -2393,6 +2393,102 @@ static const AVPixFmtDescriptor 
av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
 .name = "vulkan",
 .flags = AV_PIX_FMT_FLAG_HWACCEL,
 },
+[AV_PIX_FMT_P210BE] = {
+.name = "p210be",
+.nb_components = 3,
+.log2_chroma_w = 1,
+.log2_chroma_h = 0,
+.comp = {
+{ 0, 2, 0, 6, 10 },/* Y */
+{ 1, 4, 0, 6, 10 },/* U */
+{ 1, 4, 2, 6, 10 },/* V */
+},
+.flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
+},
+[AV_PIX_FMT_P210LE] = {
+.name = "p210le",
+.nb_components = 3,
+.log2_chroma_w = 1,
+.log2_chroma_h = 0,
+.comp = {
+{ 0, 2, 0, 6, 10 },/* Y */
+{ 1, 4, 0, 6, 10 },/* U */
+{ 1, 4, 2, 6, 10 },/* V */
+},
+.flags = AV_PIX_FMT_FLAG_PLANAR,
+},
+[AV_PIX_FMT_P410BE] = {
+.name = "p410be",
+.nb_components = 3,
+.log2_chroma_w = 0,
+.log2_chroma_h = 0,
+.comp = {
+{ 0, 2, 0, 6, 10 },/* Y */
+{ 1, 4, 0, 6, 10 },/* U */
+{ 1, 4, 2, 6, 10 },/* V */
+},
+.flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
+},
+[AV_PIX_FMT_P410LE] = {
+.name = "p410le",
+.nb_components = 3,
+.log2_chroma_w = 0,
+.log2_chroma_h = 0,
+.comp = {
+{ 0, 2, 0, 6, 10 },/* Y */
+{ 1, 4, 0, 6, 10 },/* U */
+{ 1, 4, 2, 6, 10 },/* V */
+},
+.flags = AV_PIX_FMT_FLAG_PLANAR,
+},
+[AV_PIX_FMT_P216BE] = {
+.name = "p216be",
+.nb_components = 3,
+.log2_chroma_w = 1,
+.log2_chroma_h = 0,
+.comp = {
+{ 0, 2, 0, 0, 16 },/* Y */
+{ 1, 4, 0, 0, 16 },/* U */
+{ 1, 4, 2, 0, 16 },/* V */
+},
+.flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
+},
+[AV_PIX_FMT_P216LE] = {
+.name = "p216le",
+.nb_components = 3,
+.log2_chroma_w = 1,
+.log2_chroma_h = 0,
+.comp = {
+{ 0, 2, 0, 0, 16 },/* Y */
+{ 1, 4, 0, 0, 16 },/* U */
+{ 1, 4, 2, 0, 16 },/* V */
+},
+.flags = AV_PIX_FMT_FLAG_PLANAR,
+},
+[AV_PIX_FMT_P416BE] = {
+.name = "p416be",
+.nb_components = 3,
+.log2_chroma_w = 0,
+.log2_chroma_h = 0,
+.comp = {
+{ 0, 2, 0, 0, 16 },/* Y */
+{ 1, 4, 0, 0, 16 },/* U */
+{ 1, 4, 2, 0, 16 },/* V */
+},
+.flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
+},
+[AV_PIX_FMT_P416LE] = {
+.name = "p416le",
+.nb_components = 3,
+.log2_chroma_w = 0,
+.log2_chroma_h = 0,
+.comp = {
+{ 0, 2, 0, 0, 16 },/* Y */
+{ 1, 4, 0, 0, 16 },/* U */
+{ 1, 4, 2, 0, 16 },/* V */
+},
+.flags = AV_PIX_FMT_FLAG_PLANAR,
+},
 };
 
 static const char * const color_range_names[] = {
diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 53bdecfcb7..02e355eb4d 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -352,6 +352,19 @@ enum AVPixelFormat {
 AV_PIX_FMT_X2RGB10BE, ///< packed RGB 10:10:10, 30bpp, (msb)2X 10R 10G 
10B(lsb), big-endian, X=unused/undefined
 AV_PIX_FMT_X2BGR10LE, ///< packed BGR 10:10:10, 30bpp, (msb)2X 10B 10G 
10R(lsb), little-endian, X=unused/undefined
 AV_PIX_FMT_X2BGR10BE, ///< packed BGR 10:10:10, 30bpp, (msb)2X 10B 10G 
10R(l

[FFmpeg-cvslog] lavu/videotoolbox: add 422 and 444 pixel format mappings

2021-11-28 Thread rcombs
ffmpeg | branch: master | rcombs  | Sat Nov 13 00:30:28 2021 
-0600| [d2229eca5138a9974212f9ef4e7a2eb3d4e04025] | committer: rcombs

lavu/videotoolbox: add 422 and 444 pixel format mappings

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d2229eca5138a9974212f9ef4e7a2eb3d4e04025
---

 configure  | 12 +++
 libavutil/hwcontext_videotoolbox.c | 44 ++
 2 files changed, 56 insertions(+)

diff --git a/configure b/configure
index 4af36bf80a..d7f9429ecd 100755
--- a/configure
+++ b/configure
@@ -2338,6 +2338,12 @@ TYPES_LIST="
 kCMVideoCodecType_HEVC
 kCMVideoCodecType_HEVCWithAlpha
 kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange
+kCVPixelFormatType_422YpCbCr8BiPlanarVideoRange
+kCVPixelFormatType_422YpCbCr10BiPlanarVideoRange
+kCVPixelFormatType_422YpCbCr16BiPlanarVideoRange
+kCVPixelFormatType_444YpCbCr8BiPlanarVideoRange
+kCVPixelFormatType_444YpCbCr10BiPlanarVideoRange
+kCVPixelFormatType_444YpCbCr16BiPlanarVideoRange
 kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ
 kCVImageBufferTransferFunction_ITU_R_2100_HLG
 kCVImageBufferTransferFunction_Linear
@@ -6291,6 +6297,12 @@ enabled videotoolbox && {
 check_func_headers CoreMedia/CMFormatDescription.h kCMVideoCodecType_HEVC 
"-framework CoreMedia"
 check_func_headers CoreMedia/CMFormatDescription.h 
kCMVideoCodecType_HEVCWithAlpha "-framework CoreMedia"
 check_func_headers CoreVideo/CVPixelBuffer.h 
kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange "-framework CoreVideo"
+check_func_headers CoreVideo/CVPixelBuffer.h 
kCVPixelFormatType_422YpCbCr8BiPlanarVideoRange "-framework CoreVideo"
+check_func_headers CoreVideo/CVPixelBuffer.h 
kCVPixelFormatType_422YpCbCr10BiPlanarVideoRange "-framework CoreVideo"
+check_func_headers CoreVideo/CVPixelBuffer.h 
kCVPixelFormatType_422YpCbCr16BiPlanarVideoRange "-framework CoreVideo"
+check_func_headers CoreVideo/CVPixelBuffer.h 
kCVPixelFormatType_444YpCbCr8BiPlanarVideoRange "-framework CoreVideo"
+check_func_headers CoreVideo/CVPixelBuffer.h 
kCVPixelFormatType_444YpCbCr10BiPlanarVideoRange "-framework CoreVideo"
+check_func_headers CoreVideo/CVPixelBuffer.h 
kCVPixelFormatType_444YpCbCr16BiPlanarVideoRange "-framework CoreVideo"
 check_func_headers CoreVideo/CVImageBuffer.h 
kCVImageBufferTransferFunction_SMPTE_ST_2084_PQ "-framework CoreVideo"
 check_func_headers CoreVideo/CVImageBuffer.h 
kCVImageBufferTransferFunction_ITU_R_2100_HLG "-framework CoreVideo"
 check_func_headers CoreVideo/CVImageBuffer.h 
kCVImageBufferTransferFunction_Linear "-framework CoreVideo"
diff --git a/libavutil/hwcontext_videotoolbox.c 
b/libavutil/hwcontext_videotoolbox.c
index 25f4e17715..f7a1299cc3 100644
--- a/libavutil/hwcontext_videotoolbox.c
+++ b/libavutil/hwcontext_videotoolbox.c
@@ -53,13 +53,57 @@ static const struct {
 { kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange, false, AV_PIX_FMT_P010 
},
 { kCVPixelFormatType_420YpCbCr10BiPlanarFullRange,  true,  AV_PIX_FMT_P010 
},
 #endif
+#if HAVE_KCVPIXELFORMATTYPE_422YPCBCR8BIPLANARVIDEORANGE
+{ kCVPixelFormatType_422YpCbCr8BiPlanarVideoRange,  false, AV_PIX_FMT_NV16 
},
+{ kCVPixelFormatType_422YpCbCr8BiPlanarFullRange,   true,  AV_PIX_FMT_NV16 
},
+#endif
+#if HAVE_KCVPIXELFORMATTYPE_422YPCBCR10BIPLANARVIDEORANGE
+{ kCVPixelFormatType_422YpCbCr10BiPlanarVideoRange, false, AV_PIX_FMT_P210 
},
+{ kCVPixelFormatType_422YpCbCr10BiPlanarFullRange,  true,  AV_PIX_FMT_P210 
},
+#endif
+#if HAVE_KCVPIXELFORMATTYPE_422YPCBCR16BIPLANARVIDEORANGE
+{ kCVPixelFormatType_422YpCbCr16BiPlanarVideoRange, false, AV_PIX_FMT_P216 
},
+#endif
+#if HAVE_KCVPIXELFORMATTYPE_444YPCBCR8BIPLANARVIDEORANGE
+{ kCVPixelFormatType_444YpCbCr8BiPlanarVideoRange,  false, AV_PIX_FMT_NV24 
},
+{ kCVPixelFormatType_444YpCbCr8BiPlanarFullRange,   true,  AV_PIX_FMT_NV24 
},
+#endif
+#if HAVE_KCVPIXELFORMATTYPE_444YPCBCR10BIPLANARVIDEORANGE
+{ kCVPixelFormatType_444YpCbCr10BiPlanarVideoRange, false, AV_PIX_FMT_P410 
},
+{ kCVPixelFormatType_444YpCbCr10BiPlanarFullRange,  true,  AV_PIX_FMT_P410 
},
+#endif
+#if HAVE_KCVPIXELFORMATTYPE_444YPCBCR16BIPLANARVIDEORANGE
+{ kCVPixelFormatType_444YpCbCr16BiPlanarVideoRange, false, AV_PIX_FMT_P416 
},
+#endif
 };
 
 static const enum AVPixelFormat supported_formats[] = {
+#ifdef kCFCoreFoundationVersionNumber10_7
 AV_PIX_FMT_NV12,
+#endif
 AV_PIX_FMT_YUV420P,
 AV_PIX_FMT_UYVY422,
+#if HAVE_KCVPIXELFORMATTYPE_420YPCBCR10BIPLANARVIDEORANGE
 AV_PIX_FMT_P010,
+#endif
+#if HAVE_KCVPIXELFORMATTYPE_422YPCBCR8BIPLANARVIDEORANGE
+AV_PIX_FMT_NV16,
+#endif
+#if HAVE_KCVPIXELFORMATTYPE_422YPCBCR10BIPLANARVIDEORANGE
+AV_PIX_FMT_P210,
+#endif
+#if HAVE_KCVPIXELFORMATTYPE_422YPCBCR16BIPLANARVIDEORANGE
+AV_PIX_FMT_P216,
+#endif
+#if HAVE_KCVPIXELFORMATTYPE_444YPCBCR8BIPLANARVIDEORANGE
+AV_PIX_FMT_NV24,
+#endif
+#if HAVE_KCVPIXELFORMATTYPE_444YPCBCR

[FFmpeg-cvslog] swscale: add P210/P410/P216/P416 input

2021-11-28 Thread rcombs
ffmpeg | branch: master | rcombs  | Sat Nov 13 13:34:21 2021 
-0600| [f0204de47d30e40b3f954fa0a15d76a48bcb5afd] | committer: rcombs

swscale: add P210/P410/P216/P416 input

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f0204de47d30e40b3f954fa0a15d76a48bcb5afd
---

 libswscale/input.c   | 16 
 libswscale/utils.c   |  8 
 libswscale/version.h |  2 +-
 3 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/libswscale/input.c b/libswscale/input.c
index 1351ea5bd4..6acc39f89f 100644
--- a/libswscale/input.c
+++ b/libswscale/input.c
@@ -1238,15 +1238,23 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
 c->chrToYV12 = read_ayuv64le_UV_c;
 break;
 case AV_PIX_FMT_P010LE:
+case AV_PIX_FMT_P210LE:
+case AV_PIX_FMT_P410LE:
 c->chrToYV12 = p010LEToUV_c;
 break;
 case AV_PIX_FMT_P010BE:
+case AV_PIX_FMT_P210BE:
+case AV_PIX_FMT_P410BE:
 c->chrToYV12 = p010BEToUV_c;
 break;
 case AV_PIX_FMT_P016LE:
+case AV_PIX_FMT_P216LE:
+case AV_PIX_FMT_P416LE:
 c->chrToYV12 = p016LEToUV_c;
 break;
 case AV_PIX_FMT_P016BE:
+case AV_PIX_FMT_P216BE:
+case AV_PIX_FMT_P416BE:
 c->chrToYV12 = p016BEToUV_c;
 break;
 case AV_PIX_FMT_Y210LE:
@@ -1519,6 +1527,8 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
 case AV_PIX_FMT_GRAY16LE:
 
 case AV_PIX_FMT_P016LE:
+case AV_PIX_FMT_P216LE:
+case AV_PIX_FMT_P416LE:
 c->lumToYV12 = bswap16Y_c;
 break;
 case AV_PIX_FMT_YUVA420P9LE:
@@ -1561,6 +1571,8 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
 case AV_PIX_FMT_GRAY16BE:
 
 case AV_PIX_FMT_P016BE:
+case AV_PIX_FMT_P216BE:
+case AV_PIX_FMT_P416BE:
 c->lumToYV12 = bswap16Y_c;
 break;
 case AV_PIX_FMT_YUVA420P9BE:
@@ -1687,9 +1699,13 @@ av_cold void ff_sws_init_input_funcs(SwsContext *c)
 c->lumToYV12 = bgr64LEToY_c;
 break;
 case AV_PIX_FMT_P010LE:
+case AV_PIX_FMT_P210LE:
+case AV_PIX_FMT_P410LE:
 c->lumToYV12 = p010LEToY_c;
 break;
 case AV_PIX_FMT_P010BE:
+case AV_PIX_FMT_P210BE:
+case AV_PIX_FMT_P410BE:
 c->lumToYV12 = p010BEToY_c;
 break;
 case AV_PIX_FMT_GRAYF32LE:
diff --git a/libswscale/utils.c b/libswscale/utils.c
index c726922527..ae92ac9fbc 100644
--- a/libswscale/utils.c
+++ b/libswscale/utils.c
@@ -268,6 +268,14 @@ static const FormatEntry format_entries[] = {
 [AV_PIX_FMT_Y210LE]  = { 1, 0 },
 [AV_PIX_FMT_X2RGB10LE]   = { 1, 1 },
 [AV_PIX_FMT_X2BGR10LE]   = { 1, 1 },
+[AV_PIX_FMT_P210BE]  = { 1, 0 },
+[AV_PIX_FMT_P210LE]  = { 1, 0 },
+[AV_PIX_FMT_P410BE]  = { 1, 0 },
+[AV_PIX_FMT_P410LE]  = { 1, 0 },
+[AV_PIX_FMT_P216BE]  = { 1, 0 },
+[AV_PIX_FMT_P216LE]  = { 1, 0 },
+[AV_PIX_FMT_P416BE]  = { 1, 0 },
+[AV_PIX_FMT_P416LE]  = { 1, 0 },
 };
 
 int sws_isSupportedInput(enum AVPixelFormat pix_fmt)
diff --git a/libswscale/version.h b/libswscale/version.h
index 0d3b7cf363..15ad54319c 100644
--- a/libswscale/version.h
+++ b/libswscale/version.h
@@ -28,7 +28,7 @@
 
 #define LIBSWSCALE_VERSION_MAJOR   6
 #define LIBSWSCALE_VERSION_MINOR   1
-#define LIBSWSCALE_VERSION_MICRO 100
+#define LIBSWSCALE_VERSION_MICRO 101
 
 #define LIBSWSCALE_VERSION_INT  AV_VERSION_INT(LIBSWSCALE_VERSION_MAJOR, \
LIBSWSCALE_VERSION_MINOR, \

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] lavc/videotoolbox: escape 0x00000[0-3]s in avcC PSs

2021-11-28 Thread rcombs
ffmpeg | branch: master | rcombs  | Sat Nov 13 00:56:33 2021 
-0600| [79e51d6c0f0200c37d8d1f81bd55ea5f405c03fb] | committer: rcombs

lavc/videotoolbox: escape 0x0[0-3]s in avcC PSs

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=79e51d6c0f0200c37d8d1f81bd55ea5f405c03fb
---

 libavcodec/videotoolbox.c | 53 ---
 1 file changed, 45 insertions(+), 8 deletions(-)

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index 49e726a75f..bd6e769207 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -140,14 +140,51 @@ int ff_videotoolbox_alloc_frame(AVCodecContext *avctx, 
AVFrame *frame)
 
 #define AV_W8(p, v) *(p) = (v)
 
+static int escape_ps(uint8_t* dst, const uint8_t* src, int src_size)
+{
+int i;
+int size = src_size;
+uint8_t* p = dst;
+
+for (i = 0; i < src_size; i++) {
+if (i + 2 < src_size &&
+src[i] == 0x00 &&
+src[i + 1] == 0x00 &&
+src[i + 2] <= 0x03) {
+if (dst) {
+*p++ = src[i++];
+*p++ = src[i++];
+*p++ = 0x03;
+} else {
+i += 2;
+}
+size++;
+}
+if (dst)
+*p++ = src[i];
+}
+
+if (dst)
+av_assert0((p - dst) == size);
+
+return size;
+}
+
 CFDataRef ff_videotoolbox_avcc_extradata_create(AVCodecContext *avctx)
 {
 VTContext *vtctx = avctx->internal->hwaccel_priv_data;
 H264Context *h = avctx->priv_data;
 CFDataRef data = NULL;
 uint8_t *p;
-int vt_extradata_size = 6 + 2 + h->ps.sps->data_size + 3 + 
h->ps.pps->data_size;
-uint8_t *vt_extradata = av_malloc(vt_extradata_size);
+int sps_size = escape_ps(NULL, h->ps.sps->data, h->ps.sps->data_size);
+int pps_size = escape_ps(NULL, h->ps.pps->data, h->ps.pps->data_size);
+int vt_extradata_size;
+uint8_t *vt_extradata;
+int i;
+
+vt_extradata_size = 6 + 2 + sps_size + 3 + pps_size;
+vt_extradata = av_malloc(vt_extradata_size);
+
 if (!vt_extradata)
 return NULL;
 
@@ -159,14 +196,14 @@ CFDataRef 
ff_videotoolbox_avcc_extradata_create(AVCodecContext *avctx)
 AV_W8(p + 3, h->ps.sps->data[3]); /* level */
 AV_W8(p + 4, 0xff); /* 6 bits reserved (11) + 2 bits nal size length - 
3 (11) */
 AV_W8(p + 5, 0xe1); /* 3 bits reserved (111) + 5 bits number of sps 
(1) */
-AV_WB16(p + 6, h->ps.sps->data_size);
-memcpy(p + 8, h->ps.sps->data, h->ps.sps->data_size);
-p += 8 + h->ps.sps->data_size;
+AV_WB16(p + 6, sps_size);
+p += 8;
+p += escape_ps(p, h->ps.sps->data, h->ps.sps->data_size);
 AV_W8(p + 0, 1); /* number of pps */
-AV_WB16(p + 1, h->ps.pps->data_size);
-memcpy(p + 3, h->ps.pps->data, h->ps.pps->data_size);
+AV_WB16(p + 1, pps_size);
+p += 3;
+p += escape_ps(p, h->ps.pps->data, h->ps.pps->data_size);
 
-p += 3 + h->ps.pps->data_size;
 av_assert0(p - vt_extradata == vt_extradata_size);
 
 // save sps header (profile/level) used to create decoder session,

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] lavc/videotoolbox: fix format computation

2021-11-28 Thread rcombs
ffmpeg | branch: master | rcombs  | Sat Nov 13 01:00:08 2021 
-0600| [b0c07f293883c5c37b5b1dbfabfca0d695250a60] | committer: rcombs

lavc/videotoolbox: fix format computation

Use sw_pix_fmt instead of pix_fmt (consistent with other hwaccels)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b0c07f293883c5c37b5b1dbfabfca0d695250a60
---

 libavcodec/videotoolbox.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index bd6e769207..010f553e57 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -1059,7 +1059,7 @@ static int videotoolbox_uninit(AVCodecContext *avctx)
 }
 
 static enum AVPixelFormat videotoolbox_best_pixel_format(AVCodecContext 
*avctx) {
-const AVPixFmtDescriptor *descriptor = av_pix_fmt_desc_get(avctx->pix_fmt);
+const AVPixFmtDescriptor *descriptor = 
av_pix_fmt_desc_get(avctx->sw_pix_fmt);
 if (!descriptor)
 return AV_PIX_FMT_NV12; // same as av_videotoolbox_alloc_context()
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] lavc/videotoolbox: select 4:2:2 and 4:4:4 formats when applicable

2021-11-28 Thread rcombs
ffmpeg | branch: master | rcombs  | Sat Nov 13 01:02:26 2021 
-0600| [f0952f87bcfd905f21ce6cefa8e14a127fb00c8a] | committer: rcombs

lavc/videotoolbox: select 4:2:2 and 4:4:4 formats when applicable

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f0952f87bcfd905f21ce6cefa8e14a127fb00c8a
---

 libavcodec/videotoolbox.c | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index 010f553e57..57b37bf3bf 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -1064,9 +1064,35 @@ static enum AVPixelFormat 
videotoolbox_best_pixel_format(AVCodecContext *avctx)
 return AV_PIX_FMT_NV12; // same as av_videotoolbox_alloc_context()
 
 int depth = descriptor->comp[0].depth;
+
+#if HAVE_KCVPIXELFORMATTYPE_444YPCBCR16BIPLANARVIDEORANGE
+if (depth > 10)
+return descriptor->log2_chroma_w == 0 ? AV_PIX_FMT_P416 : 
AV_PIX_FMT_P216;
+#endif
+
+#if HAVE_KCVPIXELFORMATTYPE_444YPCBCR10BIPLANARVIDEORANGE
+if (descriptor->log2_chroma_w == 0) {
+#if HAVE_KCVPIXELFORMATTYPE_444YPCBCR8BIPLANARVIDEORANGE
+if (depth <= 8)
+return AV_PIX_FMT_NV24;
+#endif
+return AV_PIX_FMT_P410;
+}
+#endif
+#if HAVE_KCVPIXELFORMATTYPE_422YPCBCR10BIPLANARVIDEORANGE
+if (descriptor->log2_chroma_h == 0) {
+#if HAVE_KCVPIXELFORMATTYPE_422YPCBCR8BIPLANARVIDEORANGE
+if (depth <= 8)
+return AV_PIX_FMT_NV16;
+#endif
+return AV_PIX_FMT_P210;
+}
+#endif
+#if HAVE_KCVPIXELFORMATTYPE_420YPCBCR10BIPLANARVIDEORANGE
 if (depth > 8) {
 return AV_PIX_FMT_P010;
 }
+#endif
 
 return AV_PIX_FMT_NV12;
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] lavc/hevcdec: support all color formats in videotoolbox hwaccel

2021-11-28 Thread rcombs
ffmpeg | branch: master | rcombs  | Sat Nov 13 01:06:29 2021 
-0600| [2c89443e84dc957a606e382d5b0ca118e1f68ce6] | committer: rcombs

lavc/hevcdec: support all color formats in videotoolbox hwaccel

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2c89443e84dc957a606e382d5b0ca118e1f68ce6
---

 libavcodec/hevcdec.c | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 3e19f4ebed..46d9edf8eb 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -451,16 +451,25 @@ static enum AVPixelFormat get_format(HEVCContext *s, 
const HEVCSPS *sps)
 #endif
 #if CONFIG_HEVC_NVDEC_HWACCEL
 *fmt++ = AV_PIX_FMT_CUDA;
+#endif
+#if CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL
+*fmt++ = AV_PIX_FMT_VIDEOTOOLBOX;
 #endif
 break;
 case AV_PIX_FMT_YUV422P:
 case AV_PIX_FMT_YUV422P10LE:
 #if CONFIG_HEVC_VAAPI_HWACCEL
*fmt++ = AV_PIX_FMT_VAAPI;
+#endif
+#if CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL
+*fmt++ = AV_PIX_FMT_VIDEOTOOLBOX;
 #endif
 break;
-case AV_PIX_FMT_YUV420P12:
 case AV_PIX_FMT_YUV444P10:
+#if CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL
+*fmt++ = AV_PIX_FMT_VIDEOTOOLBOX;
+#endif
+case AV_PIX_FMT_YUV420P12:
 case AV_PIX_FMT_YUV444P12:
 #if CONFIG_HEVC_VDPAU_HWACCEL
 *fmt++ = AV_PIX_FMT_VDPAU;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] lavc/h264dec: support all color formats in videotoolbox hwaccel

2021-11-28 Thread rcombs
ffmpeg | branch: master | rcombs  | Sat Nov 13 01:04:21 2021 
-0600| [caad1146e25fc5c601b949601b0a13d5a2a08c19] | committer: rcombs

lavc/h264dec: support all color formats in videotoolbox hwaccel

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=caad1146e25fc5c601b949601b0a13d5a2a08c19
---

 libavcodec/h264_slice.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 89ea16a57f..4467882775 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -811,6 +811,10 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, 
int force_callback)
 *fmt++ = AV_PIX_FMT_YUV420P9;
 break;
 case 10:
+#if CONFIG_H264_VIDEOTOOLBOX_HWACCEL
+if (h->avctx->colorspace != AVCOL_SPC_RGB)
+*fmt++ = AV_PIX_FMT_VIDEOTOOLBOX;
+#endif
 if (CHROMA444(h)) {
 if (h->avctx->colorspace == AVCOL_SPC_RGB) {
 *fmt++ = AV_PIX_FMT_GBRP10;
@@ -849,6 +853,10 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, 
int force_callback)
 #endif
 #if CONFIG_H264_NVDEC_HWACCEL
 *fmt++ = AV_PIX_FMT_CUDA;
+#endif
+#if CONFIG_H264_VIDEOTOOLBOX_HWACCEL
+if (h->avctx->colorspace != AVCOL_SPC_RGB)
+*fmt++ = AV_PIX_FMT_VIDEOTOOLBOX;
 #endif
 if (CHROMA444(h)) {
 if (h->avctx->colorspace == AVCOL_SPC_RGB)
@@ -872,9 +880,6 @@ static enum AVPixelFormat get_pixel_format(H264Context *h, 
int force_callback)
 #endif
 #if CONFIG_H264_VAAPI_HWACCEL
 *fmt++ = AV_PIX_FMT_VAAPI;
-#endif
-#if CONFIG_H264_VIDEOTOOLBOX_HWACCEL
-*fmt++ = AV_PIX_FMT_VIDEOTOOLBOX;
 #endif
 if (h->avctx->codec->pix_fmts)
 choices = h->avctx->codec->pix_fmts;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] lavc/videotoolbox: expose some functions as lavc-internal

2021-11-28 Thread rcombs
ffmpeg | branch: master | rcombs  | Sat Nov 13 02:31:52 2021 
-0600| [530c4a7ea95102a806db0ba3d6fcd773fe02806b] | committer: rcombs

lavc/videotoolbox: expose some functions as lavc-internal

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=530c4a7ea95102a806db0ba3d6fcd773fe02806b
---

 libavcodec/videotoolbox.c | 146 +-
 libavcodec/vt_internal.h  |  10 
 2 files changed, 78 insertions(+), 78 deletions(-)

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index 57b37bf3bf..3022cd1cbf 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -61,9 +61,9 @@ static void videotoolbox_buffer_release(void *opaque, uint8_t 
*data)
 av_free(data);
 }
 
-static int videotoolbox_buffer_copy(VTContext *vtctx,
-const uint8_t *buffer,
-uint32_t size)
+int ff_videotoolbox_buffer_copy(VTContext *vtctx,
+const uint8_t *buffer,
+uint32_t size)
 {
 void *tmp;
 
@@ -376,7 +376,7 @@ int ff_videotoolbox_h264_start_frame(AVCodecContext *avctx,
 H264Context *h = avctx->priv_data;
 
 if (h->is_avc == 1) {
-return videotoolbox_buffer_copy(vtctx, buffer, size);
+return ff_videotoolbox_buffer_copy(vtctx, buffer, size);
 }
 
 return 0;
@@ -440,18 +440,6 @@ int ff_videotoolbox_h264_decode_slice(AVCodecContext 
*avctx,
 return videotoolbox_common_decode_slice(avctx, buffer, size);
 }
 
-int ff_videotoolbox_uninit(AVCodecContext *avctx)
-{
-VTContext *vtctx = avctx->internal->hwaccel_priv_data;
-if (vtctx) {
-av_freep(&vtctx->bitstream);
-if (vtctx->frame)
-CVPixelBufferRelease(vtctx->frame);
-}
-
-return 0;
-}
-
 #if CONFIG_VIDEOTOOLBOX
 // Return the AVVideotoolboxContext that matters currently. Where it comes from
 // depends on the API used.
@@ -467,6 +455,43 @@ static AVVideotoolboxContext 
*videotoolbox_get_context(AVCodecContext *avctx)
 return avctx->hwaccel_context;
 }
 
+static void videotoolbox_stop(AVCodecContext *avctx)
+{
+AVVideotoolboxContext *videotoolbox = videotoolbox_get_context(avctx);
+if (!videotoolbox)
+return;
+
+if (videotoolbox->cm_fmt_desc) {
+CFRelease(videotoolbox->cm_fmt_desc);
+videotoolbox->cm_fmt_desc = NULL;
+}
+
+if (videotoolbox->session) {
+VTDecompressionSessionInvalidate(videotoolbox->session);
+CFRelease(videotoolbox->session);
+videotoolbox->session = NULL;
+}
+}
+
+int ff_videotoolbox_uninit(AVCodecContext *avctx)
+{
+VTContext *vtctx = avctx->internal->hwaccel_priv_data;
+if (!vtctx)
+return 0;
+
+av_freep(&vtctx->bitstream);
+if (vtctx->frame)
+CVPixelBufferRelease(vtctx->frame);
+
+if (vtctx->vt_ctx)
+videotoolbox_stop(avctx);
+
+av_buffer_unref(&vtctx->cached_hw_frames_ctx);
+av_freep(&vtctx->vt_ctx);
+
+return 0;
+}
+
 static int videotoolbox_buffer_create(AVCodecContext *avctx, AVFrame *frame)
 {
 VTContext *vtctx = avctx->internal->hwaccel_priv_data;
@@ -903,24 +928,6 @@ static int videotoolbox_start(AVCodecContext *avctx)
 }
 }
 
-static void videotoolbox_stop(AVCodecContext *avctx)
-{
-AVVideotoolboxContext *videotoolbox = videotoolbox_get_context(avctx);
-if (!videotoolbox)
-return;
-
-if (videotoolbox->cm_fmt_desc) {
-CFRelease(videotoolbox->cm_fmt_desc);
-videotoolbox->cm_fmt_desc = NULL;
-}
-
-if (videotoolbox->session) {
-VTDecompressionSessionInvalidate(videotoolbox->session);
-CFRelease(videotoolbox->session);
-videotoolbox->session = NULL;
-}
-}
-
 static const char *videotoolbox_error_string(OSStatus status)
 {
 switch (status) {
@@ -934,7 +941,7 @@ static const char *videotoolbox_error_string(OSStatus 
status)
 return "unknown";
 }
 
-static int videotoolbox_common_end_frame(AVCodecContext *avctx, AVFrame *frame)
+int ff_videotoolbox_common_end_frame(AVCodecContext *avctx, AVFrame *frame)
 {
 OSStatus status;
 AVVideotoolboxContext *videotoolbox = videotoolbox_get_context(avctx);
@@ -973,7 +980,7 @@ static int videotoolbox_h264_end_frame(AVCodecContext 
*avctx)
 H264Context *h = avctx->priv_data;
 AVFrame *frame = h->cur_pic_ptr->f;
 VTContext *vtctx = avctx->internal->hwaccel_priv_data;
-int ret = videotoolbox_common_end_frame(avctx, frame);
+int ret = ff_videotoolbox_common_end_frame(avctx, frame);
 vtctx->bitstream_size = 0;
 return ret;
 }
@@ -1012,7 +1019,7 @@ static int videotoolbox_hevc_end_frame(AVCodecContext 
*avctx)
 h->output_frame->crop_top = 0;
 h->output_frame->crop_bottom = 0;
 
-int ret = videotoolbox_common_end_frame(avctx, frame);
+int ret = ff_videotoolbox_common_end_frame(avctx, frame);
 vtctx->bitstream_size = 0;
 return ret;
 }
@@ -1023,7 +1030,7 @@ static int videotoo

[FFmpeg-cvslog] lavc/videotoolbox: call VTRegisterSupplementalVideoDecoderIfAvailable

2021-11-28 Thread rcombs
ffmpeg | branch: master | rcombs  | Sat Nov 13 02:33:08 2021 
-0600| [e3c6cc96cf2f0b2c22dee80a53a01a5fe4fea009] | committer: rcombs

lavc/videotoolbox: call VTRegisterSupplementalVideoDecoderIfAvailable

This is required for VP9 to work.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e3c6cc96cf2f0b2c22dee80a53a01a5fe4fea009
---

 libavcodec/videotoolbox.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index 3022cd1cbf..a11d494915 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -32,6 +32,7 @@
 #include "h264dec.h"
 #include "hevcdec.h"
 #include "mpegvideo.h"
+#include 
 #include 
 
 #ifndef kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder
@@ -866,6 +867,12 @@ static int videotoolbox_start(AVCodecContext *avctx)
 break;
 }
 
+#ifdef __MAC_10_11
+if (__builtin_available(macOS 10.11, *)) {
+
VTRegisterSupplementalVideoDecoderIfAvailable(videotoolbox->cm_codec_type);
+}
+#endif
+
 decoder_spec = 
videotoolbox_decoder_config_create(videotoolbox->cm_codec_type, avctx);
 
 if (!decoder_spec) {

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] lavc/videotoolbox: add VP9 hardware acceleration

2021-11-28 Thread rcombs
ffmpeg | branch: master | rcombs  | Sat Nov 13 02:43:06 2021 
-0600| [a41a2efc85f8c88caec10040ee437562f9d0b947] | committer: rcombs

lavc/videotoolbox: add VP9 hardware acceleration

On M1 Max, this supports profiles 0 and 2, but not 1 and 3.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a41a2efc85f8c88caec10040ee437562f9d0b947
---

 Changelog |   1 +
 configure |   4 ++
 libavcodec/Makefile   |   1 +
 libavcodec/hwaccels.h |   1 +
 libavcodec/videotoolbox.c |  17 -
 libavcodec/videotoolbox_vp9.c | 140 ++
 libavcodec/vp9.c  |   9 ++-
 libavcodec/vt_internal.h  |   1 +
 8 files changed, 171 insertions(+), 3 deletions(-)

diff --git a/Changelog b/Changelog
index a66231b4d8..a520b832b2 100644
--- a/Changelog
+++ b/Changelog
@@ -33,6 +33,7 @@ version :
 - colorspectrum source video filter
 - RTP packetizer for uncompressed video (RFC 4175)
 - bitpacked encoder
+- VideoToolbox VP9 hwaccel
 
 
 version 4.4:
diff --git a/configure b/configure
index d7f9429ecd..07b168af72 100755
--- a/configure
+++ b/configure
@@ -2337,6 +2337,7 @@ TOOLCHAIN_FEATURES="
 TYPES_LIST="
 kCMVideoCodecType_HEVC
 kCMVideoCodecType_HEVCWithAlpha
+kCMVideoCodecType_VP9
 kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange
 kCVPixelFormatType_422YpCbCr8BiPlanarVideoRange
 kCVPixelFormatType_422YpCbCr10BiPlanarVideoRange
@@ -3092,6 +3093,8 @@ vp9_vaapi_hwaccel_deps="vaapi 
VADecPictureParameterBufferVP9_bit_depth"
 vp9_vaapi_hwaccel_select="vp9_decoder"
 vp9_vdpau_hwaccel_deps="vdpau VdpPictureInfoVP9"
 vp9_vdpau_hwaccel_select="vp9_decoder"
+vp9_videotoolbox_hwaccel_deps="videotoolbox"
+vp9_videotoolbox_hwaccel_select="vp9_decoder"
 wmv3_d3d11va_hwaccel_select="vc1_d3d11va_hwaccel"
 wmv3_d3d11va2_hwaccel_select="vc1_d3d11va2_hwaccel"
 wmv3_dxva2_hwaccel_select="vc1_dxva2_hwaccel"
@@ -6296,6 +6299,7 @@ enabled videotoolbox && {
 check_lib coreservices CoreServices/CoreServices.h UTGetOSTypeFromString 
"-framework CoreServices"
 check_func_headers CoreMedia/CMFormatDescription.h kCMVideoCodecType_HEVC 
"-framework CoreMedia"
 check_func_headers CoreMedia/CMFormatDescription.h 
kCMVideoCodecType_HEVCWithAlpha "-framework CoreMedia"
+check_func_headers CoreMedia/CMFormatDescription.h kCMVideoCodecType_VP9 
"-framework CoreMedia"
 check_func_headers CoreVideo/CVPixelBuffer.h 
kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange "-framework CoreVideo"
 check_func_headers CoreVideo/CVPixelBuffer.h 
kCVPixelFormatType_422YpCbCr8BiPlanarVideoRange "-framework CoreVideo"
 check_func_headers CoreVideo/CVPixelBuffer.h 
kCVPixelFormatType_422YpCbCr10BiPlanarVideoRange "-framework CoreVideo"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 6be90cd5c0..4122a9b144 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -976,6 +976,7 @@ OBJS-$(CONFIG_VP9_DXVA2_HWACCEL)  += dxva2_vp9.o
 OBJS-$(CONFIG_VP9_NVDEC_HWACCEL)  += nvdec_vp9.o
 OBJS-$(CONFIG_VP9_VAAPI_HWACCEL)  += vaapi_vp9.o
 OBJS-$(CONFIG_VP9_VDPAU_HWACCEL)  += vdpau_vp9.o
+OBJS-$(CONFIG_VP9_VIDEOTOOLBOX_HWACCEL)   += videotoolbox_vp9.o
 OBJS-$(CONFIG_VP8_QSV_HWACCEL)+= qsvdec.o
 
 # libavformat dependencies
diff --git a/libavcodec/hwaccels.h b/libavcodec/hwaccels.h
index 8e54cf73f9..65e778f3e4 100644
--- a/libavcodec/hwaccels.h
+++ b/libavcodec/hwaccels.h
@@ -74,6 +74,7 @@ extern const AVHWAccel ff_vp9_dxva2_hwaccel;
 extern const AVHWAccel ff_vp9_nvdec_hwaccel;
 extern const AVHWAccel ff_vp9_vaapi_hwaccel;
 extern const AVHWAccel ff_vp9_vdpau_hwaccel;
+extern const AVHWAccel ff_vp9_videotoolbox_hwaccel;
 extern const AVHWAccel ff_wmv3_d3d11va_hwaccel;
 extern const AVHWAccel ff_wmv3_d3d11va2_hwaccel;
 extern const AVHWAccel ff_wmv3_dxva2_hwaccel;
diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index a11d494915..5f08488a6b 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -33,6 +33,7 @@
 #include "hevcdec.h"
 #include "mpegvideo.h"
 #include 
+#include 
 #include 
 
 #ifndef kVTVideoDecoderSpecification_RequireHardwareAcceleratedVideoDecoder
@@ -46,6 +47,10 @@
 enum { kCMVideoCodecType_HEVC = 'hvc1' };
 #endif
 
+#if !HAVE_KCMVIDEOCODECTYPE_VP9
+enum { kCMVideoCodecType_VP9 = 'vp09' };
+#endif
+
 #define VIDEOTOOLBOX_ESDS_EXTRADATA_PADDING  12
 
 typedef struct VTHWFrame {
@@ -816,6 +821,11 @@ static CFDictionaryRef 
videotoolbox_decoder_config_create(CMVideoCodecType codec
 if (data)
 CFDictionarySetValue(avc_info, CFSTR("hvcC"), data);
 break;
+case kCMVideoCodecType_VP9 :
+data = ff_videotoolbox_vpcc_extradata_create(avctx);
+if (data)
+CFDictionarySetValue(avc_info, CFSTR("vpcC"), data);
+break;
 default:
 break;
 }
@@ -863,12 +873,15 @@ static int videotoolbox_start(AVCodecContext *avctx)
 case AV_CODEC_ID_MPEG4 :
 vid

[FFmpeg-cvslog] videotoolbox: add alpha support

2021-11-28 Thread rcombs
ffmpeg | branch: master | rcombs  | Sat Nov 13 14:21:23 2021 
-0600| [350eb59f8c25372067b7e338b45cce97fe892e4f] | committer: rcombs

videotoolbox: add alpha support

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=350eb59f8c25372067b7e338b45cce97fe892e4f
---

 libavcodec/videotoolbox.c  | 3 +++
 libavutil/hwcontext_videotoolbox.c | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index 5f08488a6b..542fe9316a 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -1075,6 +1075,9 @@ static enum AVPixelFormat 
videotoolbox_best_pixel_format(AVCodecContext *avctx)
 
 int depth = descriptor->comp[0].depth;
 
+if (descriptor->flags & AV_PIX_FMT_FLAG_ALPHA)
+return AV_PIX_FMT_AYUV64;
+
 #if HAVE_KCVPIXELFORMATTYPE_444YPCBCR16BIPLANARVIDEORANGE
 if (depth > 10)
 return descriptor->log2_chroma_w == 0 ? AV_PIX_FMT_P416 : 
AV_PIX_FMT_P216;
diff --git a/libavutil/hwcontext_videotoolbox.c 
b/libavutil/hwcontext_videotoolbox.c
index f7a1299cc3..e9567bbf44 100644
--- a/libavutil/hwcontext_videotoolbox.c
+++ b/libavutil/hwcontext_videotoolbox.c
@@ -48,6 +48,7 @@ static const struct {
 #ifdef kCFCoreFoundationVersionNumber10_7
 { kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange,  false, AV_PIX_FMT_NV12 
},
 { kCVPixelFormatType_420YpCbCr8BiPlanarFullRange,   true,  AV_PIX_FMT_NV12 
},
+{ kCVPixelFormatType_AYpCbCr16, false, 
AV_PIX_FMT_AYUV64 },
 #endif
 #if HAVE_KCVPIXELFORMATTYPE_420YPCBCR10BIPLANARVIDEORANGE
 { kCVPixelFormatType_420YpCbCr10BiPlanarVideoRange, false, AV_PIX_FMT_P010 
},
@@ -80,6 +81,7 @@ static const struct {
 static const enum AVPixelFormat supported_formats[] = {
 #ifdef kCFCoreFoundationVersionNumber10_7
 AV_PIX_FMT_NV12,
+AV_PIX_FMT_AYUV64,
 #endif
 AV_PIX_FMT_YUV420P,
 AV_PIX_FMT_UYVY422,

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] lavc/proresdec: add scaffolding for hwdec support

2021-11-28 Thread rcombs
ffmpeg | branch: master | rcombs  | Sat Nov 13 13:37:26 2021 
-0600| [805bf2ebc94b6a0583fa6ea8cfd4a797c8f20850] | committer: rcombs

lavc/proresdec: add scaffolding for hwdec support

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=805bf2ebc94b6a0583fa6ea8cfd4a797c8f20850
---

 libavcodec/proresdec.h  |  1 +
 libavcodec/proresdec2.c | 48 
 2 files changed, 41 insertions(+), 8 deletions(-)

diff --git a/libavcodec/proresdec.h b/libavcodec/proresdec.h
index 06e41dd09a..1e48752e6f 100644
--- a/libavcodec/proresdec.h
+++ b/libavcodec/proresdec.h
@@ -52,6 +52,7 @@ typedef struct {
 int first_field;
 int alpha_info;
 void (*unpack_alpha)(GetBitContext *gb, uint16_t *dst, int num_coeffs, 
const int num_bits);
+enum AVPixelFormat pix_fmt;
 } ProresContext;
 
 #endif /* AVCODEC_PRORESDEC_H */
diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec2.c
index 7750620b22..5b1d7da693 100644
--- a/libavcodec/proresdec2.c
+++ b/libavcodec/proresdec2.c
@@ -187,6 +187,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
 permute(ctx->progressive_scan, ff_prores_progressive_scan, 
idct_permutation);
 permute(ctx->interlaced_scan, ff_prores_interlaced_scan, idct_permutation);
 
+ctx->pix_fmt = AV_PIX_FMT_NONE;
+
 if (avctx->bits_per_raw_sample == 10){
 ctx->unpack_alpha = unpack_alpha_10;
 } else if (avctx->bits_per_raw_sample == 12){
@@ -204,6 +206,7 @@ static int decode_frame_header(ProresContext *ctx, const 
uint8_t *buf,
 int hdr_size, width, height, flags;
 int version;
 const uint8_t *ptr;
+enum AVPixelFormat pix_fmt;
 
 hdr_size = AV_RB16(buf);
 ff_dlog(avctx, "header size %d\n", hdr_size);
@@ -252,18 +255,34 @@ static int decode_frame_header(ProresContext *ctx, const 
uint8_t *buf,
 
 if (ctx->alpha_info) {
 if (avctx->bits_per_raw_sample == 10) {
-avctx->pix_fmt = (buf[12] & 0xC0) == 0xC0 ? AV_PIX_FMT_YUVA444P10 
: AV_PIX_FMT_YUVA422P10;
+pix_fmt = (buf[12] & 0xC0) == 0xC0 ? AV_PIX_FMT_YUVA444P10 : 
AV_PIX_FMT_YUVA422P10;
 } else { /* 12b */
-avctx->pix_fmt = (buf[12] & 0xC0) == 0xC0 ? AV_PIX_FMT_YUVA444P12 
: AV_PIX_FMT_YUVA422P12;
+pix_fmt = (buf[12] & 0xC0) == 0xC0 ? AV_PIX_FMT_YUVA444P12 : 
AV_PIX_FMT_YUVA422P12;
 }
 } else {
 if (avctx->bits_per_raw_sample == 10) {
-avctx->pix_fmt = (buf[12] & 0xC0) == 0xC0 ? AV_PIX_FMT_YUV444P10 : 
AV_PIX_FMT_YUV422P10;
+pix_fmt = (buf[12] & 0xC0) == 0xC0 ? AV_PIX_FMT_YUV444P10 : 
AV_PIX_FMT_YUV422P10;
 } else { /* 12b */
-avctx->pix_fmt = (buf[12] & 0xC0) == 0xC0 ? AV_PIX_FMT_YUV444P12 : 
AV_PIX_FMT_YUV422P12;
+pix_fmt = (buf[12] & 0xC0) == 0xC0 ? AV_PIX_FMT_YUV444P12 : 
AV_PIX_FMT_YUV422P12;
 }
 }
 
+if (pix_fmt != ctx->pix_fmt) {
+#define HWACCEL_MAX 0
+enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmtp = pix_fmts;
+int ret;
+
+ctx->pix_fmt = pix_fmt;
+
+*fmtp++ = ctx->pix_fmt;
+*fmtp = AV_PIX_FMT_NONE;
+
+if ((ret = ff_thread_get_format(avctx, pix_fmts)) < 0)
+return ret;
+
+avctx->pix_fmt = ret;
+}
+
 avctx->color_primaries = buf[14];
 avctx->color_trc   = buf[15];
 avctx->colorspace  = buf[16];
@@ -782,6 +801,22 @@ static int decode_frame(AVCodecContext *avctx, void *data, 
int *got_frame,
 buf += frame_hdr_size;
 buf_size -= frame_hdr_size;
 
+if ((ret = ff_thread_get_buffer(avctx, &tframe, 0)) < 0)
+return ret;
+
+if (avctx->hwaccel) {
+ret = avctx->hwaccel->start_frame(avctx, NULL, 0);
+if (ret < 0)
+return ret;
+ret = avctx->hwaccel->decode_slice(avctx, avpkt->data, avpkt->size);
+if (ret < 0)
+return ret;
+ret = avctx->hwaccel->end_frame(avctx);
+if (ret < 0)
+return ret;
+goto finish;
+}
+
  decode_picture:
 pic_size = decode_picture_header(avctx, buf, buf_size);
 if (pic_size < 0) {
@@ -789,10 +824,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, 
int *got_frame,
 return pic_size;
 }
 
-if (ctx->first_field)
-if ((ret = ff_thread_get_buffer(avctx, &tframe, 0)) < 0)
-return ret;
-
 if ((ret = decode_picture(avctx)) < 0) {
 av_log(avctx, AV_LOG_ERROR, "error decoding picture\n");
 return ret;
@@ -806,6 +837,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, 
int *got_frame,
 goto decode_picture;
 }
 
+finish:
 *got_frame  = 1;
 
 return avpkt->size;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] lavc/proresdec: add videotoolbox hwaccel

2021-11-28 Thread rcombs
ffmpeg | branch: master | rcombs  | Sat Nov 13 13:38:04 2021 
-0600| [da0179b262a5e30e3c35fa2f522356ade68dc08e] | committer: rcombs

lavc/proresdec: add videotoolbox hwaccel

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=da0179b262a5e30e3c35fa2f522356ade68dc08e
---

 Changelog |  1 +
 configure |  2 ++
 libavcodec/hwaccels.h |  1 +
 libavcodec/proresdec2.c   | 12 +++-
 libavcodec/videotoolbox.c | 74 ++-
 5 files changed, 88 insertions(+), 2 deletions(-)

diff --git a/Changelog b/Changelog
index a520b832b2..56faa7f9f5 100644
--- a/Changelog
+++ b/Changelog
@@ -34,6 +34,7 @@ version :
 - RTP packetizer for uncompressed video (RFC 4175)
 - bitpacked encoder
 - VideoToolbox VP9 hwaccel
+- VideoToolbox ProRes hwaccel
 
 
 version 4.4:
diff --git a/configure b/configure
index 07b168af72..d8b5be8bbb 100755
--- a/configure
+++ b/configure
@@ -3065,6 +3065,8 @@ mpeg4_vdpau_hwaccel_deps="vdpau"
 mpeg4_vdpau_hwaccel_select="mpeg4_decoder"
 mpeg4_videotoolbox_hwaccel_deps="videotoolbox"
 mpeg4_videotoolbox_hwaccel_select="mpeg4_decoder"
+prores_videotoolbox_hwaccel_deps="videotoolbox"
+prores_videotoolbox_hwaccel_select="prores_decoder"
 vc1_d3d11va_hwaccel_deps="d3d11va"
 vc1_d3d11va_hwaccel_select="vc1_decoder"
 vc1_d3d11va2_hwaccel_deps="d3d11va"
diff --git a/libavcodec/hwaccels.h b/libavcodec/hwaccels.h
index 65e778f3e4..1e7b464950 100644
--- a/libavcodec/hwaccels.h
+++ b/libavcodec/hwaccels.h
@@ -60,6 +60,7 @@ extern const AVHWAccel ff_mpeg4_nvdec_hwaccel;
 extern const AVHWAccel ff_mpeg4_vaapi_hwaccel;
 extern const AVHWAccel ff_mpeg4_vdpau_hwaccel;
 extern const AVHWAccel ff_mpeg4_videotoolbox_hwaccel;
+extern const AVHWAccel ff_prores_videotoolbox_hwaccel;
 extern const AVHWAccel ff_vc1_d3d11va_hwaccel;
 extern const AVHWAccel ff_vc1_d3d11va2_hwaccel;
 extern const AVHWAccel ff_vc1_dxva2_hwaccel;
diff --git a/libavcodec/proresdec2.c b/libavcodec/proresdec2.c
index 5b1d7da693..719194f21e 100644
--- a/libavcodec/proresdec2.c
+++ b/libavcodec/proresdec2.c
@@ -33,6 +33,7 @@
 
 #include "avcodec.h"
 #include "get_bits.h"
+#include "hwconfig.h"
 #include "idctdsp.h"
 #include "internal.h"
 #include "profiles.h"
@@ -268,12 +269,15 @@ static int decode_frame_header(ProresContext *ctx, const 
uint8_t *buf,
 }
 
 if (pix_fmt != ctx->pix_fmt) {
-#define HWACCEL_MAX 0
+#define HWACCEL_MAX (CONFIG_PRORES_VIDEOTOOLBOX_HWACCEL)
 enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmtp = pix_fmts;
 int ret;
 
 ctx->pix_fmt = pix_fmt;
 
+#if CONFIG_PRORES_VIDEOTOOLBOX_HWACCEL
+*fmtp++ = AV_PIX_FMT_VIDEOTOOLBOX;
+#endif
 *fmtp++ = ctx->pix_fmt;
 *fmtp = AV_PIX_FMT_NONE;
 
@@ -864,4 +868,10 @@ const AVCodec ff_prores_decoder = {
 .capabilities   = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_SLICE_THREADS | 
AV_CODEC_CAP_FRAME_THREADS,
 .profiles   = NULL_IF_CONFIG_SMALL(ff_prores_profiles),
 .caps_internal  = FF_CODEC_CAP_INIT_THREADSAFE,
+.hw_configs = (const AVCodecHWConfigInternal *const []) {
+#if CONFIG_PRORES_VIDEOTOOLBOX_HWACCEL
+HWACCEL_VIDEOTOOLBOX(prores),
+#endif
+NULL
+},
 };
diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index 542fe9316a..40d231acc1 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -32,6 +32,7 @@
 #include "h264dec.h"
 #include "hevcdec.h"
 #include "mpegvideo.h"
+#include "proresdec.h"
 #include 
 #include 
 #include 
@@ -186,7 +187,6 @@ CFDataRef 
ff_videotoolbox_avcc_extradata_create(AVCodecContext *avctx)
 int pps_size = escape_ps(NULL, h->ps.pps->data, h->ps.pps->data_size);
 int vt_extradata_size;
 uint8_t *vt_extradata;
-int i;
 
 vt_extradata_size = 6 + 2 + sps_size + 3 + pps_size;
 vt_extradata = av_malloc(vt_extradata_size);
@@ -873,6 +873,31 @@ static int videotoolbox_start(AVCodecContext *avctx)
 case AV_CODEC_ID_MPEG4 :
 videotoolbox->cm_codec_type = kCMVideoCodecType_MPEG4Video;
 break;
+case AV_CODEC_ID_PRORES :
+switch (avctx->codec_tag) {
+case MKTAG('a','p','c','o'):
+videotoolbox->cm_codec_type = 
kCMVideoCodecType_AppleProRes422Proxy;
+break;
+case MKTAG('a','p','c','s'):
+videotoolbox->cm_codec_type = kCMVideoCodecType_AppleProRes422LT;
+break;
+case MKTAG('a','p','c','n'):
+videotoolbox->cm_codec_type = kCMVideoCodecType_AppleProRes422;
+break;
+case MKTAG('a','p','c','h'):
+videotoolbox->cm_codec_type = kCMVideoCodecType_AppleProRes422HQ;
+break;
+case MKTAG('a','p','4','h'):
+videotoolbox->cm_codec_type = kCMVideoCodecType_AppleProRes;
+break;
+case MKTAG('a','p','4','x'):
+videotoolbox->cm_codec_type = kCMVideoCodecType_AppleProResXQ;
+break;
+default:
+videotoolbox->cm_codec_type = 

[FFmpeg-cvslog] lavc: bump minor version for new VT hwaccels

2021-11-28 Thread rcombs
ffmpeg | branch: master | rcombs  | Sat Nov 13 17:46:31 2021 
-0600| [4cedf44aae273df937daf81b7b798539e880b20f] | committer: rcombs

lavc: bump minor version for new VT hwaccels

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4cedf44aae273df937daf81b7b798539e880b20f
---

 libavcodec/version.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/version.h b/libavcodec/version.h
index 58e3322e9a..8a0b94f5aa 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,8 +28,8 @@
 #include "libavutil/version.h"
 
 #define LIBAVCODEC_VERSION_MAJOR  59
-#define LIBAVCODEC_VERSION_MINOR  13
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MINOR  14
+#define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] lavc/videotoolbox: fix build on pre-10.14 SDKs

2021-11-28 Thread rcombs
ffmpeg | branch: master | rcombs  | Sun Nov 28 17:15:34 2021 
-0600| [c7e527f7f395f23d6b41e54c21cd50b110f83f82] | committer: rcombs

lavc/videotoolbox: fix build on pre-10.14 SDKs

Also fixes handling of future codec tags (needed to bswap)

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c7e527f7f395f23d6b41e54c21cd50b110f83f82
---

 libavcodec/videotoolbox.c | 26 +++---
 1 file changed, 7 insertions(+), 19 deletions(-)

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index 40d231acc1..d2907aee56 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -875,27 +875,15 @@ static int videotoolbox_start(AVCodecContext *avctx)
 break;
 case AV_CODEC_ID_PRORES :
 switch (avctx->codec_tag) {
-case MKTAG('a','p','c','o'):
-videotoolbox->cm_codec_type = 
kCMVideoCodecType_AppleProRes422Proxy;
-break;
-case MKTAG('a','p','c','s'):
-videotoolbox->cm_codec_type = kCMVideoCodecType_AppleProRes422LT;
-break;
-case MKTAG('a','p','c','n'):
-videotoolbox->cm_codec_type = kCMVideoCodecType_AppleProRes422;
-break;
-case MKTAG('a','p','c','h'):
-videotoolbox->cm_codec_type = kCMVideoCodecType_AppleProRes422HQ;
-break;
-case MKTAG('a','p','4','h'):
-videotoolbox->cm_codec_type = kCMVideoCodecType_AppleProRes;
-break;
-case MKTAG('a','p','4','x'):
-videotoolbox->cm_codec_type = kCMVideoCodecType_AppleProResXQ;
-break;
 default:
-videotoolbox->cm_codec_type = avctx->codec_tag;
 av_log(avctx, AV_LOG_WARNING, "Unknown prores profile %d\n", 
avctx->codec_tag);
+case MKTAG('a','p','c','o'): // kCMVideoCodecType_AppleProRes422Proxy
+case MKTAG('a','p','c','s'): // kCMVideoCodecType_AppleProRes422LT
+case MKTAG('a','p','c','n'): // kCMVideoCodecType_AppleProRes422
+case MKTAG('a','p','c','h'): // kCMVideoCodecType_AppleProRes422HQ
+case MKTAG('a','p','4','h'): // kCMVideoCodecType_AppleProRes
+case MKTAG('a','p','4','x'): // kCMVideoCodecType_AppleProResXQ
+videotoolbox->cm_codec_type = av_bswap32(avctx->codec_tag);
 }
 break;
 case AV_CODEC_ID_VP9 :

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-cvslog] avcodec/videotoolbox: silence some -Wimplicit-fallthrough warnings

2021-11-28 Thread James Almer
ffmpeg | branch: master | James Almer  | Sun Nov 28 20:23:26 
2021 -0300| [0d924d6e5a4272149bd5ea87d63cbb6e67732345] | committer: James Almer

avcodec/videotoolbox: silence some -Wimplicit-fallthrough warnings

Signed-off-by: James Almer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0d924d6e5a4272149bd5ea87d63cbb6e67732345
---

 libavcodec/videotoolbox.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/videotoolbox.c b/libavcodec/videotoolbox.c
index d2907aee56..284da97541 100644
--- a/libavcodec/videotoolbox.c
+++ b/libavcodec/videotoolbox.c
@@ -877,6 +877,7 @@ static int videotoolbox_start(AVCodecContext *avctx)
 switch (avctx->codec_tag) {
 default:
 av_log(avctx, AV_LOG_WARNING, "Unknown prores profile %d\n", 
avctx->codec_tag);
+// fall-through
 case MKTAG('a','p','c','o'): // kCMVideoCodecType_AppleProRes422Proxy
 case MKTAG('a','p','c','s'): // kCMVideoCodecType_AppleProRes422LT
 case MKTAG('a','p','c','n'): // kCMVideoCodecType_AppleProRes422
@@ -884,6 +885,7 @@ static int videotoolbox_start(AVCodecContext *avctx)
 case MKTAG('a','p','4','h'): // kCMVideoCodecType_AppleProRes
 case MKTAG('a','p','4','x'): // kCMVideoCodecType_AppleProResXQ
 videotoolbox->cm_codec_type = av_bswap32(avctx->codec_tag);
+break;
 }
 break;
 case AV_CODEC_ID_VP9 :

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".