Skip to content

Commit 48dce30

Browse files
committed
utils/misc: rm get_map_val_or_default
There is just a single occurence of that template so it is not worth keeping it.
1 parent dad23cd commit 48dce30

3 files changed

Lines changed: 5 additions & 11 deletions

File tree

src/hd-rum-translator/hd-rum-recompress.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
#include <cassert>
4444
#include <cinttypes>
4545
#include <chrono>
46+
#include <map> // for map
4647
#include <memory>
4748
#include <thread>
4849
#include <string>

src/utils/misc.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,6 @@ struct fourcc_s fourcc_to_string(uint32_t fourcc);
9898
#ifdef __cplusplus
9999
uint32_t parse_uint32(const char *value_str) noexcept(false);
100100

101-
#include <map>
102-
template<typename key, typename T>
103-
inline T get_map_val_or_default(std::map<key, T> const& map, key const& k, T const& def) {
104-
if (auto && it = map.find(k); it != map.end()) {
105-
return it->second;
106-
}
107-
return def;
108-
}
109-
110101
template<auto delete_fcn>
111102
struct deleter_from_fcn{ template<typename T> void operator()(T handle) const { delete_fcn(handle); }};
112103

src/video_compress/libavcodec.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2085,8 +2085,10 @@ static void configure_vaapi(AVCodecContext * /* codec_ctx */, struct setparam_pa
20852085

20862086
static void configure_aom_av1(AVCodecContext *codec_ctx, struct setparam_param *param)
20872087
{
2088-
auto && usage = get_map_val_or_default<string, string>(param->lavc_opts, "usage", "realtime");
2089-
check_av_opt_set<const char *>(codec_ctx->priv_data, "usage", usage.c_str());
2088+
auto it = param->lavc_opts.find("usage");
2089+
const char *usage =
2090+
it != param->lavc_opts.end() ? it->second.c_str() : "realtime";
2091+
check_av_opt_set<const char *>(codec_ctx->priv_data, "usage", usage);
20902092
check_av_opt_set<const char *>(codec_ctx->priv_data, "tiles", "8x8");
20912093
}
20922094

0 commit comments

Comments
 (0)