From a6dd9dfa8887fc7db6abbbb52a1be9339216fcea Mon Sep 17 00:00:00 2001 From: falsycat Date: Fri, 9 Sep 2022 11:26:01 +0900 Subject: [PATCH] rename fidx -> bidx --- conv/CMakeLists.txt | 8 ++++---- conv/{fidx_stego.cc => bidx_stego.cc} | 28 +++++++++++++-------------- conv/{fcode_fidx.cc => fcode_bidx.cc} | 2 +- conv/stego_fprob.cc | 14 +++++++------- 4 files changed, 26 insertions(+), 26 deletions(-) rename conv/{fidx_stego.cc => bidx_stego.cc} (93%) rename conv/{fcode_fidx.cc => fcode_bidx.cc} (96%) diff --git a/conv/CMakeLists.txt b/conv/CMakeLists.txt index 6601db0..8833b49 100644 --- a/conv/CMakeLists.txt +++ b/conv/CMakeLists.txt @@ -1,11 +1,11 @@ add_executable(dcode_fcode common.hh dcode_fcode.cc) target_link_libraries(dcode_fcode PRIVATE args) -add_executable(fcode_fidx common.hh fcode_fidx.cc) -target_link_libraries(fcode_fidx PRIVATE args) +add_executable(fcode_bidx common.hh fcode_bidx.cc) +target_link_libraries(fcode_bidx PRIVATE args) -add_executable(fidx_stego common.hh fidx_stego.cc) -target_link_libraries(fidx_stego PRIVATE args minimp4 openh264) +add_executable(bidx_stego common.hh bidx_stego.cc) +target_link_libraries(bidx_stego PRIVATE args minimp4 openh264) add_executable(stego_fprob common.hh stego_fprob.cc) target_link_libraries(stego_fprob PRIVATE args minimp4 openh264) diff --git a/conv/fidx_stego.cc b/conv/bidx_stego.cc similarity index 93% rename from conv/fidx_stego.cc rename to conv/bidx_stego.cc index 0218f68..6bef6c3 100644 --- a/conv/fidx_stego.cc +++ b/conv/bidx_stego.cc @@ -21,7 +21,7 @@ namespace param { using namespace ::args; ArgumentParser parser { - "converter: feature indices + host -> stego" + "converter: block indices + host -> stego" }; HelpFlag help { parser, "help", "display this menu", {'h', "help"}, @@ -147,19 +147,19 @@ static void Exec() { } } Enforce(ti < dem.track_count, "no video track"); - const auto& t = dem.track[ti]; + const auto& tra = dem.track[ti]; // calc params - const auto tscale = t.timescale; + const auto tscale = tra.timescale; const auto dur = - (static_cast(t.duration_hi) << 32) | - static_cast(t.duration_lo); + (static_cast(tra.duration_hi) << 32) | + static_cast(tra.duration_lo); const auto dursec = static_cast(dur)/static_cast(tscale); - const float fps = static_cast(t.sample_count)/dursec; + const float fps = static_cast(tra.sample_count)/dursec; const auto fps9 = static_cast(90000/fps); - const int32_t w = t.SampleDescription.video.width; - const int32_t h = t.SampleDescription.video.height; + const int32_t w = tra.SampleDescription.video.width; + const int32_t h = tra.SampleDescription.video.height; // init encoder ISVCEncoder* enc; @@ -218,8 +218,8 @@ static void Exec() { // decode frame Frame bf = {}; - int32_t fidx = 0; - for (size_t si = 0; si < t.sample_count; ++si) { + int32_t t = 0; + for (size_t si = 0; si < tra.sample_count; ++si) { unsigned fsz, time, dur; const auto off = MP4D_frame_offset(&dem, ti, si, &fsz, &time, &dur); @@ -249,8 +249,8 @@ static void Exec() { if (frame.iBufferStatus) { // alter the frame if it's not the first Frame cf = {yuv, frame}; - if (fidx%ut > 0) { - Embed(fidx/ut, cf, bf); + if (t%ut > 0) { + Embed(t/ut, cf, bf); } // encode @@ -274,10 +274,10 @@ static void Exec() { } // save the frame if it's the first - if (fidx%ut == 0) { + if (t%ut == 0) { bf = std::move(cf); } - ++fidx; + ++t; } i += sz; } diff --git a/conv/fcode_fidx.cc b/conv/fcode_bidx.cc similarity index 96% rename from conv/fcode_fidx.cc rename to conv/fcode_bidx.cc index c1bd540..b9fb03c 100644 --- a/conv/fcode_fidx.cc +++ b/conv/fcode_bidx.cc @@ -11,7 +11,7 @@ namespace param { using namespace ::args; ArgumentParser parser { - "converter: feature codes -> feature indices" + "converter: feature codes -> block indices" }; HelpFlag help { parser, "help", "display this menu", {'h', "help"}, diff --git a/conv/stego_fprob.cc b/conv/stego_fprob.cc index 45815cd..6cff87a 100644 --- a/conv/stego_fprob.cc +++ b/conv/stego_fprob.cc @@ -232,13 +232,13 @@ static void Exec() { // find video track int ti; for (ti = 0; ti < dem.track_count; ++ti) { - const auto& t = dem.track[ti]; - if (t.handler_type == MP4D_HANDLER_TYPE_VIDE) { + const auto& tra = dem.track[ti]; + if (tra.handler_type == MP4D_HANDLER_TYPE_VIDE) { break; } } Enforce(ti < dem.track_count, "no video track"); - const auto& t = dem.track[ti]; + const auto& tra = dem.track[ti]; // consume SPS std::vector nal; @@ -265,8 +265,8 @@ static void Exec() { // decode frame Frame pf = {}; - size_t fidx = 0; - for (size_t si = 0; si < t.sample_count; ++si) { + size_t t = 0; + for (size_t si = 0; si < tra.sample_count; ++si) { unsigned fsz, time, dur; const auto off = MP4D_frame_offset(&dem, ti, si, &fsz, &time, &dur); @@ -294,13 +294,13 @@ static void Exec() { Frame cf = {yuv, frame}; if (cf.w == 0 || cf.h == 0) continue; - const auto utf = fidx%ut; + const auto utf = t%ut; if (utf > 0) { EachFrame(utf, cf, pf); } pf = std::move(cf); - ++fidx; + ++t; } } }