dcraw: handle fujifilm lossy compression
port from libraw handling of fujifilm lossy compression.
This commit is contained in:
@@ -109,16 +109,24 @@ protected:
|
||||
unsigned black, cblack[4102], maximum, mix_green, raw_color, zero_is_bad;
|
||||
unsigned zero_after_ff, is_raw, dng_version, is_foveon, data_error;
|
||||
unsigned tile_width, tile_length, gpsdata[32], load_flags, row_padding;
|
||||
bool xtransCompressed = false;
|
||||
|
||||
struct fuji_q_table
|
||||
{
|
||||
int8_t *q_table; /* quantization table */
|
||||
int raw_bits;
|
||||
int total_values;
|
||||
int max_grad; // sdp val
|
||||
int q_grad_mult; // quant_gradient multiplier
|
||||
int q_base;
|
||||
};
|
||||
|
||||
struct fuji_compressed_params
|
||||
{
|
||||
char *q_table; /* quantization table */
|
||||
int q_point[5]; /* quantization points */
|
||||
struct fuji_q_table qt[4];
|
||||
void *buf;
|
||||
int max_bits;
|
||||
int min_value;
|
||||
int raw_bits;
|
||||
int total_values;
|
||||
int maxDiff;
|
||||
int max_value;
|
||||
ushort line_width;
|
||||
};
|
||||
|
||||
@@ -135,6 +143,13 @@ protected:
|
||||
_ltotal
|
||||
};
|
||||
|
||||
// tables of gradients for single sample level
|
||||
struct fuji_grads
|
||||
{
|
||||
int_pair grads[41];
|
||||
int_pair lossy_grads[3][5];
|
||||
};
|
||||
|
||||
struct fuji_compressed_block {
|
||||
int cur_bit; // current bit being read (from left to right)
|
||||
int cur_pos; // current position in a buffer
|
||||
@@ -144,13 +159,13 @@ protected:
|
||||
uchar *cur_buf; // currently read block
|
||||
int fillbytes; // Counter to add extra byte for block size N*16
|
||||
rtengine::IMFILE *input;
|
||||
struct int_pair grad_even[3][41]; // tables of gradients
|
||||
struct int_pair grad_odd[3][41];
|
||||
fuji_grads even[3]; // tables of even gradients
|
||||
fuji_grads odd[3]; // tables of odd gradients
|
||||
ushort *linealloc;
|
||||
ushort *linebuf[_ltotal];
|
||||
};
|
||||
|
||||
int fuji_total_lines, fuji_total_blocks, fuji_block_width, fuji_bits, fuji_raw_type;
|
||||
int fuji_total_lines, fuji_total_blocks, fuji_block_width, fuji_bits, fuji_raw_type, fuji_lossless;
|
||||
|
||||
ushort raw_height, raw_width, height, width, top_margin, left_margin;
|
||||
ushort shrink, iheight, iwidth, fuji_width, thumb_width, thumb_height;
|
||||
@@ -374,6 +389,8 @@ void adobe_copy_pixel (unsigned row, unsigned col, ushort **rp);
|
||||
void lossless_dng_load_raw();
|
||||
void packed_dng_load_raw();
|
||||
void deflate_dng_load_raw();
|
||||
void init_fuji_main_qtable(fuji_compressed_params *params, uchar q_base);
|
||||
void init_fuji_main_grads(const fuji_compressed_params *params, fuji_compressed_block *info);
|
||||
void init_fuji_compr(struct fuji_compressed_params* info);
|
||||
void fuji_fill_buffer(struct fuji_compressed_block *info);
|
||||
void init_fuji_block(struct fuji_compressed_block* info, const struct fuji_compressed_params *params, INT64 raw_offset, unsigned dsize);
|
||||
@@ -381,8 +398,8 @@ void copy_line_to_xtrans(struct fuji_compressed_block* info, int cur_line, int c
|
||||
void copy_line_to_bayer(struct fuji_compressed_block* info, int cur_line, int cur_block, int cur_block_width);
|
||||
void fuji_zerobits(struct fuji_compressed_block* info, int *count);
|
||||
void fuji_read_code(struct fuji_compressed_block* info, int *data, int bits_to_read);
|
||||
int fuji_decode_sample_even(struct fuji_compressed_block* info, const struct fuji_compressed_params * params, ushort* line_buf, int pos, struct int_pair* grads);
|
||||
int fuji_decode_sample_odd(struct fuji_compressed_block* info, const struct fuji_compressed_params * params, ushort* line_buf, int pos, struct int_pair* grads);
|
||||
int fuji_decode_sample_even(struct fuji_compressed_block* info, const struct fuji_compressed_params* params, ushort* line_buf, int pos, struct fuji_grads* grad_params);
|
||||
int fuji_decode_sample_odd(struct fuji_compressed_block* info, const struct fuji_compressed_params* params, ushort* line_buf, int pos, struct fuji_grads* grad_params);
|
||||
void fuji_decode_interpolation_even(int line_width, ushort* line_buf, int pos);
|
||||
void fuji_extend_generic(ushort *linebuf[_ltotal], int line_width, int start, int end);
|
||||
void fuji_extend_red(ushort *linebuf[_ltotal], int line_width);
|
||||
@@ -390,9 +407,9 @@ void fuji_extend_green(ushort *linebuf[_ltotal], int line_width);
|
||||
void fuji_extend_blue(ushort *linebuf[_ltotal], int line_width);
|
||||
void xtrans_decode_block(struct fuji_compressed_block* info, const struct fuji_compressed_params *params);
|
||||
void fuji_bayer_decode_block(struct fuji_compressed_block* info, const struct fuji_compressed_params *params);
|
||||
void fuji_decode_strip(const struct fuji_compressed_params* info_common, int cur_block, INT64 raw_offset, unsigned dsize);
|
||||
void fuji_decode_strip (fuji_compressed_params* params, int cur_block, INT64 raw_offset, unsigned dsize, uchar *q_bases);
|
||||
void fuji_compressed_load_raw();
|
||||
void fuji_decode_loop(const struct fuji_compressed_params* common_info, int count, INT64* raw_block_offsets, unsigned *block_sizes);
|
||||
void fuji_decode_loop(fuji_compressed_params* common_info, int count, INT64* raw_block_offsets, unsigned *block_sizes, uchar *q_bases);
|
||||
void parse_fuji_compressed_header();
|
||||
void fuji_14bit_load_raw();
|
||||
void pentax_load_raw();
|
||||
|
Reference in New Issue
Block a user