2021-12-16 22:04:07 +02:00
|
|
|
/*
|
|
|
|
* This file is part of FFmpeg.
|
|
|
|
*
|
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* FFmpeg is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with FFmpeg; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef AVFILTER_METAL_UTILS_H
|
|
|
|
#define AVFILTER_METAL_UTILS_H
|
|
|
|
|
|
|
|
#include <Metal/Metal.h>
|
2021-12-21 10:38:18 +02:00
|
|
|
|
|
|
|
#include <AvailabilityMacros.h>
|
|
|
|
|
|
|
|
// CoreVideo accidentally(?) preprocessor-gates Metal functionality
|
|
|
|
// on MAC_OS_X_VERSION_MIN_REQUIRED >= 101100 (FB9816002).
|
|
|
|
// There doesn't seem to be any particular reason for this,
|
|
|
|
// so here we temporarily redefine it to at least that value
|
|
|
|
// so CV will give us CVMetalTextureRef and the related functions.
|
|
|
|
|
|
|
|
#if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && (MAC_OS_X_VERSION_MIN_REQUIRED < 101100)
|
|
|
|
#define ORIG_MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_MIN_REQUIRED
|
|
|
|
#undef MAC_OS_X_VERSION_MIN_REQUIRED
|
|
|
|
#define MAC_OS_X_VERSION_MIN_REQUIRED 101100
|
|
|
|
#endif
|
|
|
|
|
2021-12-16 22:04:07 +02:00
|
|
|
#include <CoreVideo/CoreVideo.h>
|
|
|
|
|
2021-12-21 10:38:18 +02:00
|
|
|
#ifdef ORIG_MAC_OS_X_VERSION_MIN_REQUIRED
|
|
|
|
#undef MAC_OS_X_VERSION_MIN_REQUIRED
|
|
|
|
#define MAC_OS_X_VERSION_MIN_REQUIRED ORIG_MAC_OS_X_VERSION_MIN_REQUIRED
|
|
|
|
#undef ORIG_MAC_OS_X_VERSION_MIN_REQUIRED
|
|
|
|
#endif
|
|
|
|
|
2021-12-16 22:04:07 +02:00
|
|
|
void ff_metal_compute_encoder_dispatch(id<MTLDevice> device,
|
|
|
|
id<MTLComputePipelineState> pipeline,
|
|
|
|
id<MTLComputeCommandEncoder> encoder,
|
2021-12-21 10:38:18 +02:00
|
|
|
NSUInteger width, NSUInteger height)
|
|
|
|
API_AVAILABLE(macos(10.11), ios(8.0));
|
2021-12-16 22:04:07 +02:00
|
|
|
|
|
|
|
CVMetalTextureRef ff_metal_texture_from_pixbuf(void *avclass,
|
|
|
|
CVMetalTextureCacheRef textureCache,
|
|
|
|
CVPixelBufferRef pixbuf,
|
|
|
|
int plane,
|
2021-12-21 10:38:18 +02:00
|
|
|
MTLPixelFormat format)
|
|
|
|
API_AVAILABLE(macos(10.11), ios(8.0));
|
|
|
|
|
2021-12-16 22:04:07 +02:00
|
|
|
#endif /* AVFILTER_METAL_UTILS_H */
|