mirror of
https://github.com/outbackdingo/UltraGrid.git
synced 2026-04-07 02:05:11 +00:00
vcomp/lavc: remove codec_params
After recent changes, the map was accessed exclusively with get_codec_params so squash the data there.
This commit is contained in:
@@ -192,57 +192,45 @@ static void print_codec_supp_pix_fmts(const enum AVPixelFormat *first);
|
|||||||
void usage(bool full);
|
void usage(bool full);
|
||||||
static void cleanup(struct state_video_compress_libav *s);
|
static void cleanup(struct state_video_compress_libav *s);
|
||||||
|
|
||||||
static map<codec_t, codec_params_t> codec_params = {
|
const char *get_vp9_encoder(bool /* rgb */) {
|
||||||
{ H264, codec_params_t{
|
#ifdef __x86_64__
|
||||||
|
return __builtin_cpu_supports("avx2") ? nullptr : "libaom-av1";
|
||||||
|
#else
|
||||||
|
return nullptr;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
codec_params_t
|
||||||
|
get_codec_params(codec_t ug_codec)
|
||||||
|
{
|
||||||
|
switch (ug_codec) {
|
||||||
|
case H264: return {
|
||||||
[](bool is_rgb) { return is_rgb ? "libx264rgb" : "libx264"; },
|
[](bool is_rgb) { return is_rgb ? "libx264rgb" : "libx264"; },
|
||||||
0.07 * 2 /* for H.264: 1 - low motion, 2 - medium motion, 4 - high motion */
|
0.07 * 2 /* for H.264: 1 - low motion, 2 - medium motion, 4 - high motion */
|
||||||
* 2, // take into consideration that our H.264 is less effective due to specific preset/tune
|
* 2, // take into consideration that our H.264 is less effective due to specific preset/tune
|
||||||
// note - not used for libx264, which uses CRF by default
|
// note - not used for libx264, which uses CRF by default
|
||||||
setparam_h264_h265_av1,
|
setparam_h264_h265_av1,
|
||||||
100
|
100
|
||||||
}},
|
};
|
||||||
{ H265, codec_params_t{
|
case H265: return {
|
||||||
[](bool) { return "libx265"; },
|
[](bool) { return "libx265"; },
|
||||||
0.04 * 2 * 2, // note - not used for libx265, which uses CRF by default
|
0.04 * 2 * 2, // note - not used for libx265, which uses CRF by default
|
||||||
setparam_h264_h265_av1,
|
setparam_h264_h265_av1,
|
||||||
101
|
101
|
||||||
}},
|
};
|
||||||
{ JPEG, codec_params_t{
|
case JPEG:
|
||||||
nullptr,
|
return { nullptr, 1.2, setparam_jpeg, 102 };
|
||||||
1.2,
|
case VP8:
|
||||||
setparam_jpeg,
|
return { nullptr, 0.4, setparam_vp8_vp9, 103 };
|
||||||
102
|
case VP9:
|
||||||
}},
|
return { get_vp9_encoder, 0.4, setparam_vp8_vp9, 104 };
|
||||||
{ VP8, codec_params_t{
|
case AV1: return {
|
||||||
nullptr,
|
|
||||||
0.4,
|
|
||||||
setparam_vp8_vp9,
|
|
||||||
103
|
|
||||||
}},
|
|
||||||
{ VP9, codec_params_t{
|
|
||||||
[](bool) {
|
|
||||||
return
|
|
||||||
#ifdef __x86_64__
|
|
||||||
!__builtin_cpu_supports("avx2") ? "libvpx-vp9" :
|
|
||||||
#endif
|
|
||||||
nullptr; },
|
|
||||||
0.4,
|
|
||||||
setparam_vp8_vp9,
|
|
||||||
104
|
|
||||||
}},
|
|
||||||
{ AV1, codec_params_t{
|
|
||||||
[](bool) { return is_arm_mac() ? "libaom-av1" : "libsvtav1"; },
|
[](bool) { return is_arm_mac() ? "libaom-av1" : "libsvtav1"; },
|
||||||
0.1,
|
0.1,
|
||||||
setparam_h264_h265_av1,
|
setparam_h264_h265_av1,
|
||||||
600
|
600
|
||||||
}},
|
};
|
||||||
};
|
default:
|
||||||
codec_params_t
|
break;
|
||||||
get_codec_params(codec_t ug_codec)
|
|
||||||
{
|
|
||||||
auto it = codec_params.find(ug_codec);
|
|
||||||
if (it != codec_params.end()) {
|
|
||||||
return it->second;
|
|
||||||
}
|
}
|
||||||
int capabilities_priority = 500 + (int) ug_codec;
|
int capabilities_priority = 500 + (int) ug_codec;
|
||||||
double avg_bpp = 0;
|
double avg_bpp = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user