Skip to content

Commit

Permalink
Use the correct filename for memory chunk locations
Browse files Browse the repository at this point in the history
  • Loading branch information
jrsnen committed Feb 2, 2022
1 parent 8aece72 commit 29c03f5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions util/test_file_creation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ int main(int argc, char** argv)
output_file = input_file.substr(0, lastindex);
}

std::string mem_file = get_chunk_filename(input_file);

// add hevc file ending
output_file = output_file + ".hevc";

Expand All @@ -45,6 +43,8 @@ int main(int argc, char** argv)
output_file = "out_" + output_file;
}

std::string mem_file = get_chunk_filename(output_file);

int width = atoi(argv[2]);
int height = atoi(argv[3]);

Expand Down
8 changes: 4 additions & 4 deletions util/util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@ void get_chunk_sizes(std::string filename, std::vector<uint64_t>& chunk_sizes)
inputFile.close();
}

std::string get_chunk_filename(std::string& input_filename)
std::string get_chunk_filename(std::string& encoded_filename)
{
std::string mem_file = "";
std::string ending = "";
// remove any possible file extensions and add hevc
size_t lastindex = input_filename.find_last_of(".");
size_t lastindex = encoded_filename.find_last_of(".");

if (lastindex != std::string::npos)
{
ending = input_filename.substr(lastindex + 1);
mem_file = input_filename.substr(0, lastindex);
ending = encoded_filename.substr(lastindex + 1);
mem_file = encoded_filename.substr(0, lastindex);
}

return mem_file + ".m" + ending;
Expand Down
2 changes: 1 addition & 1 deletion util/util.hh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ void get_chunk_sizes(std::string filename, std::vector<uint64_t>& chunk_sizes);

std::string get_chunk_filename(std::string& input_filename);

void* get_mem(std::string filename, size_t& len);
void* get_mem(std::string encoded_filename, size_t& len);

int get_next_frame_start(uint8_t* data, uint32_t offset, uint32_t data_len, uint8_t& start_len);

Expand Down

0 comments on commit 29c03f5

Please sign in to comment.