1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-30 22:51:16 +01:00

Code cleanup

This commit is contained in:
Martin Tůma 2024-05-22 21:02:26 +02:00
parent 09d0b281c2
commit c425be3741
2 changed files with 12 additions and 10 deletions

View File

@ -16,15 +16,15 @@ static const quint8 Z[] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
}; };
static const int J[] = { static const quint8 J[] = {
0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,
4, 4, 5, 5, 6, 6, 7, 7, 8, 9, 10, 11, 12, 13, 14, 15 4, 4, 5, 5, 6, 6, 7, 7, 8, 9, 10, 11, 12, 13, 14, 15
}; };
JLS::JLS(quint16 diff, quint16 factor) JLS::JLS(quint16 maxval, quint16 near)
{ {
_maxval = diff; _maxval = maxval;
_near = factor; _near = near;
_range = ((_maxval + _near * 2) / (_near * 2 + 1)) + 1; _range = ((_maxval + _near * 2) / (_near * 2 + 1)) + 1;
_qbpp = ceil(log2(_range)); _qbpp = ceil(log2(_range));
@ -189,16 +189,18 @@ bool JLS::readLine(BitStream &bs)
else else
_b[1] = -((1 - _b[1]) >> 1); _b[1] = -((1 - _b[1]) >> 1);
_n[1] = 0x21; _n[1] = 0x21;
} else { } else
_n[1] = _n[1] + 1; _n[1] = _n[1] + 1;
}
if (_b[1] <= -_n[1]) { if (_b[1] <= -_n[1]) {
_b[1] = _b[1] + _n[1]; _b[1] = _b[1] + _n[1];
if (_b[1] <= -_n[1]) if (_b[1] <= -_n[1])
_b[1] = 1 - _n[1]; _b[1] = 1 - _n[1];
} else if (_b[1] > 0) } else if (_b[1] > 0) {
_b[1] = ((_b[1] - _n[1]) >> 0xf) & (_b[1] - _n[1]); _b[1] = _b[1] - _n[1];
if (_b[1] > 0)
_b[1] = 0;
}
Rc = Rb; Rc = Rb;
Rb = _last[col + 1]; Rb = _last[col + 1];

View File

@ -2,15 +2,15 @@
#define IMG_JLS_H #define IMG_JLS_H
#include <QVector> #include <QVector>
#include "bitstream.h"
#include "map/matrix.h" #include "map/matrix.h"
#include "subfile.h"
namespace IMG { namespace IMG {
class JLS class JLS
{ {
public: public:
JLS(quint16 diff, quint16 factor); JLS(quint16 maxval, quint16 near);
bool decode(const SubFile *file, SubFile::Handle &hdl, Matrix<qint16> &img); bool decode(const SubFile *file, SubFile::Handle &hdl, Matrix<qint16> &img);