MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / get_pixel_format

Function get_pixel_format

libavcodec/h264_slice.c:788–923  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

786}
787
788static enum AVPixelFormat get_pixel_format(H264Context *h, int force_callback)
789{
790#define HWACCEL_MAX (CONFIG_H264_DXVA2_HWACCEL + \
791 (CONFIG_H264_D3D11VA_HWACCEL * 2) + \
792 CONFIG_H264_D3D12VA_HWACCEL + \
793 CONFIG_H264_NVDEC_HWACCEL + \
794 CONFIG_H264_VAAPI_HWACCEL + \
795 CONFIG_H264_VIDEOTOOLBOX_HWACCEL + \
796 CONFIG_H264_VDPAU_HWACCEL + \
797 CONFIG_H264_VULKAN_HWACCEL)
798 enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmt = pix_fmts;
799
800 switch (h->ps.sps->bit_depth_luma) {
801 case 9:
802 if (CHROMA444(h)) {
803 if (h->avctx->colorspace == AVCOL_SPC_RGB) {
804 *fmt++ = AV_PIX_FMT_GBRP9;
805 } else
806 *fmt++ = AV_PIX_FMT_YUV444P9;
807 } else if (CHROMA422(h))
808 *fmt++ = AV_PIX_FMT_YUV422P9;
809 else
810 *fmt++ = AV_PIX_FMT_YUV420P9;
811 break;
812 case 10:
813#if CONFIG_H264_VIDEOTOOLBOX_HWACCEL
814 if (h->avctx->colorspace != AVCOL_SPC_RGB)
815 *fmt++ = AV_PIX_FMT_VIDEOTOOLBOX;
816#endif
817#if CONFIG_H264_VULKAN_HWACCEL
818 *fmt++ = AV_PIX_FMT_VULKAN;
819#endif
820#if CONFIG_H264_NVDEC_HWACCEL
821 *fmt++ = AV_PIX_FMT_CUDA;
822#endif
823 if (CHROMA444(h)) {
824 if (h->avctx->colorspace == AVCOL_SPC_RGB) {
825 *fmt++ = AV_PIX_FMT_GBRP10;
826 } else
827 *fmt++ = AV_PIX_FMT_YUV444P10;
828 } else if (CHROMA422(h))
829 *fmt++ = AV_PIX_FMT_YUV422P10;
830 else {
831#if CONFIG_H264_VAAPI_HWACCEL
832 // Just add as candidate. Whether VAProfileH264High10 usable or
833 // not is decided by vaapi_decode_make_config() defined in FFmpeg
834 // and vaQueryCodingProfile() defined in libva.
835 *fmt++ = AV_PIX_FMT_VAAPI;
836#endif
837 *fmt++ = AV_PIX_FMT_YUV420P10;
838 }
839 break;
840 case 12:
841#if CONFIG_H264_VULKAN_HWACCEL
842 *fmt++ = AV_PIX_FMT_VULKAN;
843#endif
844 if (CHROMA444(h)) {
845 if (h->avctx->colorspace == AVCOL_SPC_RGB) {

Callers 1

h264_init_psFunction · 0.70

Calls 2

av_logFunction · 0.85
ff_get_formatFunction · 0.85

Tested by

no test coverage detected