MCPcopy Create free account
hub / github.com/WiVRn/WiVRn / split_bitrate

Function split_bitrate

server/encoder/encoder_settings.cpp:47–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45static const double passthrough_bitrate_factor = 0.05;
46
47static void split_bitrate(std::array<wivrn::encoder_settings, 3> & encoders, uint64_t bitrate)
48{
49 assert(bitrate > 0);
50 double total_weight = 0;
51 for (auto [i, encoder]: std::ranges::enumerate_view(encoders))
52 {
53 double w = encoder.width * encoder.height;
54 if (i == 2)
55 w *= passthrough_bitrate_factor;
56 switch (encoder.codec)
57 {
58 case wivrn::h264:
59 w *= 2;
60 break;
61 case wivrn::h265:
62 case wivrn::av1:
63 case wivrn::raw:
64 break;
65 }
66 encoder.bitrate = w;
67 total_weight += w;
68 }
69
70 for (auto & encoder: encoders)
71 {
72 encoder.bitrate_multiplier = encoder.bitrate / total_weight;
73 encoder.bitrate = encoder.bitrate_multiplier * bitrate;
74 }
75}
76
77void print_encoders(const std::array<wivrn::encoder_settings, 3> & encoders)
78{

Callers 1

get_encoder_settingsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected