mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-06 15:49:50 +08:00

Adds hwcontext_amf, enabling a shared AMF context for encoders, decoders, and AMF-based filters, without copy to the host memory. Code also was tested in HandBrake. Benefits: - Optimizations for direct video memory access from CPU - Significant performance boost in full AMF pipelines with filters - Integration of GPU filters like VPP, Super Resolution, and Compression Artefact Removal(in future plans) - VCN power management control for decoders. - Ability to specify which VCN instance to use for decoding (like for encoder) - AMD will soon introduce full AMF API for multimedia accelerator MA35D - With AMF API, integration will be much easier: GPU and the accelerator will have the same API - including encoder, decoder, scaler, color converter, Windows and Linux. Learn more: https://www.amd.com/en/products/accelerators/alveo/ma35d.html Changes by versions: v2: Header file cleanup. v3: Removed an unnecessary class. v4: code cleanup and improved error handling v5: Fixes related to HandBrake integration. v6: Sequential filters error and memory leak have been fixed.
45 lines
1.4 KiB
C
45 lines
1.4 KiB
C
/*
|
|
* 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 AVUTIL_HWCONTEXT_AMF_INTERNAL_H
|
|
#define AVUTIL_HWCONTEXT_AMF_INTERNAL_H
|
|
#include <AMF/core/Factory.h>
|
|
#include <AMF/core/Context.h>
|
|
|
|
/**
|
|
* Error handling helper
|
|
*/
|
|
#define AMF_RETURN_IF_FALSE(avctx, exp, ret_value, /*message,*/ ...) \
|
|
if (!(exp)) { \
|
|
av_log(avctx, AV_LOG_ERROR, __VA_ARGS__); \
|
|
return ret_value; \
|
|
}
|
|
|
|
#define AMF_GOTO_FAIL_IF_FALSE(avctx, exp, ret_value, /*message,*/ ...) \
|
|
if (!(exp)) { \
|
|
av_log(avctx, AV_LOG_ERROR, __VA_ARGS__); \
|
|
ret = ret_value; \
|
|
goto fail; \
|
|
}
|
|
|
|
#define AMF_TIME_BASE_Q (AVRational){1, AMF_SECOND}
|
|
|
|
|
|
#endif /* AVUTIL_HWCONTEXT_AMF_INTERNAL_H */
|