aboutsummaryrefslogtreecommitdiffstats
path: root/src/sls.cpp
diff options
context:
space:
mode:
authorStefan Pöschel <github@basicmaster.de>2017-02-11 11:27:23 +0100
committerStefan Pöschel <github@basicmaster.de>2017-02-11 11:33:19 +0100
commit37e4f56b0dc4e42ca55a7744172778bd3958e4b8 (patch)
tree6e89b8e3041b62666cf9343ab864f89cadf44801 /src/sls.cpp
parentd1a9e22b3ed08dffb75f430562530a7b8ab53d87 (diff)
downloadODR-PadEnc-37e4f56b0dc4e42ca55a7744172778bd3958e4b8.tar.gz
ODR-PadEnc-37e4f56b0dc4e42ca55a7744172778bd3958e4b8.tar.bz2
ODR-PadEnc-37e4f56b0dc4e42ca55a7744172778bd3958e4b8.zip
Slight refactorings
- SLSManager: store PADPacketizer ref + fix spacing
Diffstat (limited to 'src/sls.cpp')
-rw-r--r--src/sls.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/sls.cpp b/src/sls.cpp
index 024e664..28b0997 100644
--- a/src/sls.cpp
+++ b/src/sls.cpp
@@ -33,6 +33,7 @@
// --- History -----------------------------------------------------------------
const size_t History::MAXHISTORYLEN = 50; // How many slides to keep in history
+
int History::find(const fingerprint_t& fp) const
{
size_t i;
@@ -47,6 +48,7 @@ int History::find(const fingerprint_t& fp) const
return -1;
}
+
void History::add(fingerprint_t& fp)
{
m_database.push_back(fp);
@@ -56,6 +58,7 @@ void History::add(fingerprint_t& fp)
}
}
+
void History::disp_database()
{
size_t id;
@@ -72,6 +75,7 @@ void History::disp_database()
printf("-----------------\n");
}
+
int History::get_fidx(const char* filepath)
{
fingerprint_t fp;
@@ -117,6 +121,7 @@ MOTHeader::MOTHeader(size_t body_size, int content_type, int content_subtype)
data[6] |= content_subtype & 0xFF;
}
+
void MOTHeader::IncrementHeaderSize(size_t size) {
header_size += size;
@@ -129,6 +134,7 @@ void MOTHeader::IncrementHeaderSize(size_t size) {
data[5] |= (header_size << 7) & 0x80;
}
+
void MOTHeader::AddExtensionFixedSize(int pli, int param_id, const uint8_t* data_field, size_t data_field_len) {
AddParamHeader(pli, param_id);
@@ -138,6 +144,7 @@ void MOTHeader::AddExtensionFixedSize(int pli, int param_id, const uint8_t* data
IncrementHeaderSize(1 + data_field_len);
}
+
void MOTHeader::AddExtensionVarSize(int param_id, const uint8_t* data_field, size_t data_field_len) {
AddParamHeader(0b11, param_id);
@@ -156,6 +163,7 @@ void MOTHeader::AddExtensionVarSize(int param_id, const uint8_t* data_field, siz
IncrementHeaderSize(1 + (ext ? 2 : 1) + data_field_len);
}
+
void MOTHeader::AddExtension(int param_id, const uint8_t* data_field, size_t data_field_len) {
int pli;
@@ -189,7 +197,6 @@ const int SLSManager::MINQUALITY = 40; // Do not allow the image comp
const std::string SLSManager::SLS_PARAMS_SUFFIX = ".sls_params";
-
void SLSManager::warnOnSmallerImage(size_t height, size_t width, const std::string& fname) {
if (height < 240 || width < 320)
fprintf(stderr, "ODR-PadEnc Warning: Image '%s' smaller than recommended size (%zu x %zu < 320 x 240 px)\n", fname.c_str(), width, height);
@@ -278,7 +285,8 @@ size_t SLSManager::resizeImage(MagickWand* m_wand, unsigned char** blob, const s
}
#endif
-int SLSManager::encodeFile(PADPacketizer& pad_packetizer, const std::string& fname, int fidx, bool raw_slides)
+
+int SLSManager::encodeFile(const std::string& fname, int fidx, bool raw_slides)
{
int ret = 0;
int nseg, lastseglen, i, last, curseglen;
@@ -479,8 +487,8 @@ int SLSManager::encodeFile(PADPacketizer& pad_packetizer, const std::string& fna
mscdg = packMscDG(&msc);
dgli = PADPacketizer::CreateDataGroupLengthIndicator(mscdg->data.size());
- pad_packetizer.AddDG(dgli, false);
- pad_packetizer.AddDG(mscdg, false);
+ pad_packetizer->AddDG(dgli, false);
+ pad_packetizer->AddDG(mscdg, false);
for (i = 0; i < nseg; i++) {
curseg = blob + i * MAXSEGLEN;
@@ -497,8 +505,8 @@ int SLSManager::encodeFile(PADPacketizer& pad_packetizer, const std::string& fna
mscdg = packMscDG(&msc);
dgli = PADPacketizer::CreateDataGroupLengthIndicator(mscdg->data.size());
- pad_packetizer.AddDG(dgli, false);
- pad_packetizer.AddDG(mscdg, false);
+ pad_packetizer->AddDG(dgli, false);
+ pad_packetizer->AddDG(mscdg, false);
}
ret = 1;