rename fidx -> bidx

This commit is contained in:
falsycat 2022-09-09 11:26:01 +09:00
parent 73af0a3069
commit a6dd9dfa88
4 changed files with 26 additions and 26 deletions

View File

@ -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)

View File

@ -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<uint64_t>(t.duration_hi) << 32) |
static_cast<uint64_t>(t.duration_lo);
(static_cast<uint64_t>(tra.duration_hi) << 32) |
static_cast<uint64_t>(tra.duration_lo);
const auto dursec = static_cast<float>(dur)/static_cast<float>(tscale);
const float fps = static_cast<float>(t.sample_count)/dursec;
const float fps = static_cast<float>(tra.sample_count)/dursec;
const auto fps9 = static_cast<int>(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;
}

View File

@ -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"},

View File

@ -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<uint8_t> 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;
}
}
}