MCPcopy Create free account
hub / github.com/SatDump/SatDump / process

Method process

plugins/bitview_app/tools/diff_decode.h:49–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47 }
48
49 void process(std::shared_ptr<BitContainer> &container, float &process_progress)
50 {
51 uint8_t *ptr = container->get_ptr();
52 size_t size = container->get_ptr_size();
53
54 char name[1000];
55 tmpnam(name);
56 std::string tmpfile = name;
57 std::ofstream file_out(tmpfile, std::ios::binary);
58 diff::NRZMDiff nrzm_decoder;
59
60 uint8_t tmp_buf[8192];
61
62 size_t current_ptr = 0;
63 while (current_ptr < size)
64 {
65 size_t csize = std::min<size_t>(8192, size - current_ptr);
66
67 memcpy(tmp_buf, ptr + current_ptr, csize);
68 current_ptr += csize;
69
70 nrzm_decoder.decode(tmp_buf, csize);
71
72 if (diff_mode == 1)
73 for (int i = 0; i < csize; i++)
74 tmp_buf[i] ^= 0xFF;
75
76 file_out.write((char *)tmp_buf, csize);
77
78 process_progress = double(current_ptr) / double(size);
79 }
80
81 file_out.close();
82
83 std::shared_ptr<satdump::BitContainer> newbitc = std::make_shared<satdump::BitContainer>(container->getName() + (diff_mode == 1 ? " NRZ-S" : " NRZ-M"), tmpfile);
84 newbitc->d_bitperiod = container->d_bitperiod;
85 newbitc->init_bitperiod();
86 newbitc->d_is_temporary = true;
87
88 container->all_bit_containers.push_back(newbitc);
89 }
90 };
91}

Callers

nothing calls this directly

Calls 7

get_ptrMethod · 0.80
get_ptr_sizeMethod · 0.80
init_bitperiodMethod · 0.80
decodeMethod · 0.45
writeMethod · 0.45
closeMethod · 0.45
getNameMethod · 0.45

Tested by

no test coverage detected