14 namespace itk::itkpix::endec::dummy {
21 log.
trace(
"dummy.OutputCallback()");
25 log.
trace(
"out_init()");
29 log.
trace(
"out_next(nbits: {})", nbits);
33 log.
trace(
"out_done(nbits: {})", nbits);
37 log.
trace(
"out_data(data: 0x{:016x})", data);
41 log.
error(
"on_error(code: {})", error.
code);
51 using OutputCallback = T;
53 EncCore(
Options opt, OutputCallback& cb_out) : opt(opt), cb_out(cb_out) {
54 log.
trace(
"dummy.EncCore(opt, cb_out)");
57 inline void initialize() {
58 log.
trace(
"initialize()");
60 inline void finalize() {
61 log.
trace(
"finalize()");
64 inline void evt_init(uint8_t tag) {
65 log.
trace(
"evt_init(tag: 0x{:02x})", tag);
69 inline void evt_next(uint8_t tag) {
70 log.
trace(
"evt_next(tag: 0x{:02x})", tag);
74 inline void evt_done() {
75 log.
trace(
"evt_done()");
78 inline void add_hit(uint16_t col, uint16_t row, uint16_t tot) {
79 log.
trace(
"add_hit(col: {}, row: {}, tot: {})", col, row, tot);
80 cb_out.out_data(uint64_t(col) << 32 | row << 16 | tot);
82 inline void add_hmap(uint8_t qcol, uint8_t qrow, uint16_t hmap, uint64_t tots) {
83 log.
trace(
"add_hmap(qcol: {}, qrow: {}, hmap: 0x{:04x}, tots: 0x{:x})", qcol, qrow, hmap, tots);
84 cb_out.out_data(uint64_t(qcol) << 32 | qrow << 16 | hmap);
85 cb_out.out_data(tots);
87 inline void add_qcore(uint8_t qcol, uint8_t qrow, uint64_t qtot) {
88 log.
trace(
"add_qcore(qcol: {}, qrow: {}, tots: 0x{:016x})", qcol, qrow, qtot);
89 cb_out.out_data(qcol << 16 | qrow);
90 cb_out.out_data(qtot);
94 OutputCallback& cb_out;
Definition: enccore.hpp:49
Definition: enccore.hpp:18
void out_init() override
Create a new stream and start a new event.
Definition: enccore.hpp:24
void out_next(uint8_t nbits) override
Complete the event and start the next one.
Definition: enccore.hpp:28
uint8_t on_error(OutputError error) override
Callback on encoding error.
Definition: enccore.hpp:40
void out_done(uint8_t nbits) override
Complete the event and finalize the stream.
Definition: enccore.hpp:32
void out_data(uint64_t data) override
Output 64-bit data word for current event.
Definition: enccore.hpp:36
Callback interface for output.
Definition: outcallback.hpp:39
Definition: enccore.hpp:121
Logger class definition, wrapper around CoreLogger, adds templated methods for different logging leve...
Definition: logger.hpp:108
void error(fmt::format_string< Args... > fmt, Args &&...args)
Logs a message with error level.
Definition: logger.hpp:164
void trace(fmt::format_string< Args... > fmt, Args &&...args)
Logs a message with trace level.
Definition: logger.hpp:132
Templates for ITkPix Encoder Core.
Common encoder/decoder options.
Definition: options.hpp:10
Callback on event decoding error.
Definition: outcallback.hpp:15
error_t code
error code
Definition: outcallback.hpp:27