(RJPEG) reorder structs, alignment

This commit is contained in:
twinaphex 2020-08-16 00:08:50 +02:00
parent ff42f3348a
commit 3d2efdd2ef
1 changed files with 33 additions and 38 deletions

View File

@ -141,17 +141,15 @@ struct rjpeg
typedef struct
{
uint32_t img_x;
uint32_t img_y;
int img_n;
int img_out_n;
int buflen;
uint8_t buffer_start[128];
uint8_t *img_buffer;
uint8_t *img_buffer_end;
uint8_t *img_buffer_original;
int img_n;
int img_out_n;
int buflen;
uint32_t img_x;
uint32_t img_y;
uint8_t buffer_start[128];
} rjpeg_context;
static INLINE uint8_t rjpeg_get8(rjpeg_context *s)
@ -171,31 +169,32 @@ static INLINE uint8_t rjpeg_get8(rjpeg_context *s)
typedef struct
{
uint8_t fast[1 << FAST_BITS];
/* weirdly, repacking this into AoS is a 10% speed loss, instead of a win */
uint16_t code[256];
uint8_t values[256];
uint8_t size[257];
unsigned int maxcode[18];
int delta[17]; /* old 'firstsymbol' - old 'firstcode' */
/* weirdly, repacking this into AoS is a 10% speed loss, instead of a win */
uint16_t code[256];
uint8_t fast[1 << FAST_BITS];
uint8_t values[256];
uint8_t size[257];
} rjpeg_huffman;
typedef struct
{
rjpeg_context *s;
rjpeg_huffman huff_dc[4];
rjpeg_huffman huff_ac[4];
uint8_t dequant[4][64];
int16_t fast_ac[4][1 << FAST_BITS];
/* sizes for components, interleaved MCUs */
int img_h_max, img_v_max;
int img_mcu_x, img_mcu_y;
int img_mcu_w, img_mcu_h;
/* kernels */
void (*idct_block_kernel)(uint8_t *out, int out_stride, short data[64]);
void (*YCbCr_to_RGB_kernel)(uint8_t *out, const uint8_t *y, const uint8_t *pcb,
const uint8_t *pcr, int count, int step);
uint8_t *(*resample_row_hv_2_kernel)(uint8_t *out, uint8_t *in_near,
uint8_t *in_far, int w, int hs);
/* definition of jpeg image component */
struct
{
uint8_t *data;
void *raw_data, *raw_coeff;
uint8_t *linebuf;
short *coeff; /* progressive only */
int id;
int h,v;
int tq;
@ -203,35 +202,31 @@ typedef struct
int dc_pred;
int x,y,w2,h2;
uint8_t *data;
void *raw_data, *raw_coeff;
uint8_t *linebuf;
short *coeff; /* progressive only */
int coeff_w; /* number of 8x8 coefficient blocks */
int coeff_h; /* number of 8x8 coefficient blocks */
} img_comp[4];
uint32_t code_buffer; /* jpeg entropy-coded buffer */
int code_bits; /* number of valid bits */
unsigned char marker; /* marker seen while filling entropy buffer */
int nomore; /* flag if we saw a marker so must stop */
/* sizes for components, interleaved MCUs */
int img_h_max, img_v_max;
int img_mcu_x, img_mcu_y;
int img_mcu_w, img_mcu_h;
int code_bits; /* number of valid bits */
int nomore; /* flag if we saw a marker so must stop */
int progressive;
int spec_start;
int spec_end;
int succ_high;
int succ_low;
int eob_run;
int scan_n, order[4];
int restart_interval, todo;
/* kernels */
void (*idct_block_kernel)(uint8_t *out, int out_stride, short data[64]);
void (*YCbCr_to_RGB_kernel)(uint8_t *out, const uint8_t *y, const uint8_t *pcb,
const uint8_t *pcr, int count, int step);
uint8_t *(*resample_row_hv_2_kernel)(uint8_t *out, uint8_t *in_near,
uint8_t *in_far, int w, int hs);
uint32_t code_buffer; /* jpeg entropy-coded buffer */
rjpeg_huffman huff_dc[4]; /* unsigned int alignment */
rjpeg_huffman huff_ac[4]; /* unsigned int alignment */
int16_t fast_ac[4][1 << FAST_BITS];
unsigned char marker; /* marker seen while filling entropy buffer */
uint8_t dequant[4][64];
} rjpeg_jpeg;
#define RJPEG_F2F(x) ((int) (((x) * 4096 + 0.5)))