Skip to content

Commit

Permalink
Fix indentation (2)
Browse files Browse the repository at this point in the history
  • Loading branch information
eisneinechse committed Jun 15, 2020
1 parent 3dfcea1 commit 056a72f
Showing 1 changed file with 38 additions and 38 deletions.
76 changes: 38 additions & 38 deletions src/FFmpegWriter.cpp
Expand Up @@ -542,12 +542,12 @@ void FFmpegWriter::SetOption(StreamType stream, std::string name, std::string va
}
else if (strstr(info.vcodec.c_str(), "rav1e") != NULL) {
// Set number of tiles to a fixed value
// TODO Let user choose number of tiles
// TODO Let user choose number of tiles
av_opt_set_int(c->priv_data, "qp", std::min(std::stoi(value),255), 0);
}
else if (strstr(info.vcodec.c_str(), "aom") != NULL) {
// Set number of tiles to a fixed value
// TODO Let user choose number of tiles
// TODO Let user choose number of tiles
// libaom doesn't have qp only crf
av_opt_set_int(c->priv_data, "crf", std::min(std::stoi(value),63), 0);
}
Expand Down Expand Up @@ -1207,10 +1207,10 @@ AVStream *FFmpegWriter::add_video_stream() {
#endif

/* Init video encoder options */
if (info.video_bit_rate >= 1000
if (info.video_bit_rate >= 1000
#if (LIBAVCODEC_VERSION_MAJOR >= 58)
&& c->codec_id != AV_CODEC_ID_AV1
#endif
#endif
) {
c->bit_rate = info.video_bit_rate;
if (info.video_bit_rate >= 1500000) {
Expand All @@ -1226,40 +1226,40 @@ AVStream *FFmpegWriter::add_video_stream() {
#if (LIBAVCODEC_VERSION_MAJOR >= 58)
case AV_CODEC_ID_AV1 :
// TODO: Set `crf` or `qp` according to bitrate, as bitrate is not supported by these encoders yet.
if (info.video_bit_rate >= 1000) {
c->bit_rate = 0;
if (strstr(info.vcodec.c_str(), "aom") != NULL) {
int calculated_quality = 35;
if (info.video_bit_rate < 500000) calculated_quality = 50;
if (info.video_bit_rate > 5000000) calculated_quality = 10;
av_opt_set_int(c->priv_data, "crf", calculated_quality, 0);
info.video_bit_rate = calculated_quality;
} else {
int calculated_quality = 50;
if (info.video_bit_rate < 500000) calculated_quality = 60;
if (info.video_bit_rate > 5000000) calculated_quality = 15;
av_opt_set_int(c->priv_data, "qp", calculated_quality, 0);
info.video_bit_rate = calculated_quality;
} // medium
}
if (strstr(info.vcodec.c_str(), "svt_av1") != NULL) {
av_opt_set_int(c->priv_data, "preset", 6, 0);
av_opt_set_int(c->priv_data, "forced-idr",1,0);
}
else if (strstr(info.vcodec.c_str(), "rav1e") != NULL) {
av_opt_set_int(c->priv_data, "speed", 7, 0);
av_opt_set_int(c->priv_data, "tile-rows", 2, 0);
av_opt_set_int(c->priv_data, "tile-columns", 4, 0);
}
else if (strstr(info.vcodec.c_str(), "aom") != NULL) {
// Set number of tiles to a fixed value
// TODO: Allow user to chose their own number of tiles
av_opt_set_int(c->priv_data, "tile-rows", 1, 0); // log2 of number of rows
av_opt_set_int(c->priv_data, "tile-columns", 2, 0); // log2 of number of columns
av_opt_set_int(c->priv_data, "row-mt", 1, 0); // use multiple cores
av_opt_set_int(c->priv_data, "cpu-used", 3, 0); // default is 1, usable is 4
}
//break;
if (info.video_bit_rate >= 1000) {
c->bit_rate = 0;
if (strstr(info.vcodec.c_str(), "aom") != NULL) {
int calculated_quality = 35;
if (info.video_bit_rate < 500000) calculated_quality = 50;
if (info.video_bit_rate > 5000000) calculated_quality = 10;
av_opt_set_int(c->priv_data, "crf", calculated_quality, 0);
info.video_bit_rate = calculated_quality;
} else {
int calculated_quality = 50;
if (info.video_bit_rate < 500000) calculated_quality = 60;
if (info.video_bit_rate > 5000000) calculated_quality = 15;
av_opt_set_int(c->priv_data, "qp", calculated_quality, 0);
info.video_bit_rate = calculated_quality;
} // medium
}
if (strstr(info.vcodec.c_str(), "svt_av1") != NULL) {
av_opt_set_int(c->priv_data, "preset", 6, 0);
av_opt_set_int(c->priv_data, "forced-idr",1,0);
}
else if (strstr(info.vcodec.c_str(), "rav1e") != NULL) {
av_opt_set_int(c->priv_data, "speed", 7, 0);
av_opt_set_int(c->priv_data, "tile-rows", 2, 0);
av_opt_set_int(c->priv_data, "tile-columns", 4, 0);
}
else if (strstr(info.vcodec.c_str(), "aom") != NULL) {
// Set number of tiles to a fixed value
// TODO: Allow user to chose their own number of tiles
av_opt_set_int(c->priv_data, "tile-rows", 1, 0); // log2 of number of rows
av_opt_set_int(c->priv_data, "tile-columns", 2, 0); // log2 of number of columns
av_opt_set_int(c->priv_data, "row-mt", 1, 0); // use multiple cores
av_opt_set_int(c->priv_data, "cpu-used", 3, 0); // default is 1, usable is 4
}
//break;
#endif
case AV_CODEC_ID_VP9 :
case AV_CODEC_ID_HEVC :
Expand Down

0 comments on commit 056a72f

Please sign in to comment.