MCPcopy Create free account
hub / github.com/OpenShot/libopenshot / SelectPixelFormat

Method SelectPixelFormat

examples/VulkanBenchmark.cpp:592–609  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

590
591private:
592 static enum AVPixelFormat SelectPixelFormat(AVCodecContext* codec_context, const enum AVPixelFormat* pix_fmts) {
593 const auto* self = static_cast<GenericDecodeReader*>(codec_context->opaque);
594 const AVPixelFormat preferred_hw =
595 self && self->decode_kind_ == DecodeKind::Cuda ? AV_PIX_FMT_CUDA :
596 self && self->decode_kind_ == DecodeKind::Vaapi ? AV_PIX_FMT_VAAPI :
597 self && self->decode_kind_ == DecodeKind::Vulkan ? AV_PIX_FMT_VULKAN :
598 AV_PIX_FMT_NONE;
599 for (const enum AVPixelFormat* format = pix_fmts; *format != AV_PIX_FMT_NONE; ++format) {
600 if (*format == preferred_hw)
601 return *format;
602 }
603 for (const enum AVPixelFormat* format = pix_fmts; *format != AV_PIX_FMT_NONE; ++format) {
604 const AVPixFmtDescriptor* desc = av_pix_fmt_desc_get(*format);
605 if (desc && !(desc->flags & AV_PIX_FMT_FLAG_HWACCEL))
606 return *format;
607 }
608 return pix_fmts[0];
609 }
610
611 const BenchmarkOptions& options_;
612 DecodeKind decode_kind_;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected