mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-08-09 23:12:32 +00:00
glz: simplification of do_match and PIXEL_ID
Following commit e8017dd366 here
are some more ifdef simplification.
For PIXEL_ID and PIXEL_DIST macros,
the ifndef LZ_PLT defines are special cases of the LZ_PLT
(#else) defines, when pix_per_byte is 1
Now do_match can accept pix_per_byte param for all different
definitions (implementations).
Signed-off-by: Uri Lublin <uril@redhat.com>
Acked-by: Fabiano Fidêncio <fidencio@redhat.com>
This commit is contained in:
parent
79292edd56
commit
b028c2e38a
@ -128,18 +128,12 @@
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef LZ_PLT
|
||||
#define PIXEL_ID(pix_ptr, seg_ptr) \
|
||||
((pix_ptr) - ((PIXEL *)(seg_ptr)->lines) + (seg_ptr)->pixels_so_far)
|
||||
#define PIXEL_DIST(src_pix_ptr, src_seg_ptr, ref_pix_ptr, ref_seg_ptr, pix_per_byte) \
|
||||
(PIXEL_ID(src_pix_ptr,src_seg_ptr) - PIXEL_ID(ref_pix_ptr, ref_seg_ptr))
|
||||
#else
|
||||
#define PIXEL_ID(pix_ptr, seg_ptr, pix_per_byte) \
|
||||
(((pix_ptr) - ((PIXEL *)(seg_ptr)->lines)) * pix_per_byte + (seg_ptr)->pixels_so_far)
|
||||
|
||||
#define PIXEL_DIST(src_pix_ptr, src_seg_ptr, ref_pix_ptr, ref_seg_ptr, pix_per_byte) \
|
||||
((PIXEL_ID(src_pix_ptr,src_seg_ptr, pix_per_byte) - \
|
||||
PIXEL_ID(ref_pix_ptr, ref_seg_ptr, pix_per_byte)) / pix_per_byte)
|
||||
#endif
|
||||
|
||||
/* returns the length of the match. 0 if no match.
|
||||
if image_distance = 0, pixel_distance is the distance between the matching pixels.
|
||||
@ -149,9 +143,7 @@ static inline size_t FNAME(do_match)(SharedDictionary *dict,
|
||||
const PIXEL *ref_limit,
|
||||
WindowImageSegment *ip_seg, const PIXEL *ip,
|
||||
const PIXEL *ip_limit,
|
||||
#ifdef LZ_PLT
|
||||
int pix_per_byte,
|
||||
#endif
|
||||
size_t *o_image_dist, size_t *o_pix_distance)
|
||||
{
|
||||
int encode_size;
|
||||
@ -262,6 +254,8 @@ static void FNAME(compress_seg)(Encoder *encoder, uint32_t seg_idx, PIXEL *from,
|
||||
int copy = copied;
|
||||
#ifdef LZ_PLT
|
||||
int pix_per_byte = PLT_PIXELS_PER_BYTE[encoder->cur_image.type];
|
||||
#else
|
||||
int pix_per_byte = 1;
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_ENCODE
|
||||
@ -342,9 +336,7 @@ static void FNAME(compress_seg)(Encoder *encoder, uint32_t seg_idx, PIXEL *from,
|
||||
ref_limit = (PIXEL *)ref_seg->lines_end;
|
||||
|
||||
len = FNAME(do_match)(encoder->dict, ref_seg, ref, ref_limit, seg, ip, ip_bound,
|
||||
#ifdef LZ_PLT
|
||||
pix_per_byte,
|
||||
#endif
|
||||
&image_dist, &pix_dist);
|
||||
|
||||
#ifdef CHAINED_HASH
|
||||
|
||||
Loading…
Reference in New Issue
Block a user