From ecece4021f569d29cff2b9321ef271ace9d6b37c Mon Sep 17 00:00:00 2001 From: falsycat Date: Tue, 6 Sep 2022 20:09:31 +0900 Subject: [PATCH] add 'uvfix' option to conv/bidx_video --- conv/bidx_video.cc | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/conv/bidx_video.cc b/conv/bidx_video.cc index 03e0c43..493b2b1 100644 --- a/conv/bidx_video.cc +++ b/conv/bidx_video.cc @@ -37,6 +37,10 @@ ValueFlag utime { parser, "10", "duration of each feature (frame)", {"utime"}, 10, }; +Flag uvfix { + parser, "uvfix", "fix UV values in feature", {"uvfix"}, +}; + Positional dst { parser, "path", "destination video file path", }; @@ -51,8 +55,7 @@ std::vector> indices; // util -static std::vector> ReadIndices( - std::istream&) noexcept; +static std::vector> ReadIndices(std::istream&) noexcept; static void Embed(int32_t t, Frame& dst, const Frame& base) { const auto bw = args::get(param::bw); @@ -76,11 +79,13 @@ static void Embed(int32_t t, Frame& dst, const Frame& base) { } } - for (int32_t y = 0; y < hbh; ++y) { - for (int32_t x = 0; x < hbw; ++x) { - const auto off = (by*hbh+y)*base.hw + (bx*hbw+x); - dst.U[off] = base.U[off]; - dst.V[off] = base.V[off]; + if (param::uvfix) { + for (int32_t y = 0; y < hbh; ++y) { + for (int32_t x = 0; x < hbw; ++x) { + const auto off = (by*hbh+y)*base.hw + (bx*hbw+x); + dst.U[off] = base.U[off]; + dst.V[off] = base.V[off]; + } } } }