@@ -259,17 +259,15 @@ namespace ojph {
259259 line_buf *tc = comps[comp_num].get_line ();
260260 if (reversible)
261261 {
262- int shift = 1 << (num_bits[comp_num] - 1 );
263- const si32 *sp = line-> i32 + line_offsets [comp_num];
264- si32* dp = tc-> i32 ;
265- if (is_signed[comp_num]) {
266- if (nlt_type3[comp_num])
267- cnvrt_si32_to_si32_nlt_type3 (sp, dp, shift + 1 , comp_width) ;
268- else
269- memcpy (dp, sp, comp_width * sizeof (si32) );
262+ si64 shift = 1LL << (num_bits[comp_num] - 1 );
263+ if (is_signed[comp_num] && nlt_type3 [comp_num])
264+ rev_convert_nlt_type3 (line, line_offsets[comp_num],
265+ tc, 0 , shift + 1 , comp_width);
266+ else {
267+ shift = is_signed[comp_num] ? 0 : -shift ;
268+ rev_convert (line, line_offsets[comp_num], tc, 0 ,
269+ shift, comp_width);
270270 }
271- else
272- cnvrt_si32_to_si32_shftd (sp, dp, -shift, comp_width);
273271 }
274272 else
275273 {
@@ -285,26 +283,25 @@ namespace ojph {
285283 }
286284 else
287285 {
288- int shift = 1 << (num_bits[comp_num] - 1 );
286+ si64 shift = 1LL << (num_bits[comp_num] - 1 );
289287 ui32 comp_width = comp_rects[comp_num].siz .w ;
290288 if (reversible)
291289 {
292- const si32 *sp = line-> i32 + line_offsets [comp_num];
293- si32 *dp = lines [comp_num]. i32 ;
294- if (is_signed[ comp_num]) {
295- if (nlt_type3[comp_num])
296- cnvrt_si32_to_si32_nlt_type3 (sp, dp, shift + 1 , comp_width) ;
297- else
298- memcpy (dp, sp, comp_width * sizeof (si32) );
290+ if (is_signed[comp_num] && nlt_type3 [comp_num])
291+ rev_convert_nlt_type3 (line, line_offsets [comp_num],
292+ lines + comp_num, 0 , shift + 1 , comp_width);
293+ else {
294+ shift = is_signed[comp_num] ? 0 : -shift ;
295+ rev_convert (line, line_offsets[comp_num], lines + comp_num, 0 ,
296+ shift, comp_width);
299297 }
300- else
301- cnvrt_si32_to_si32_shftd (sp, dp, -shift, comp_width);
298+
302299 if (comp_num == 2 )
303300 { // reversible color transform
304- rct_forward (lines[ 0 ]. i32 , lines[ 1 ]. i32 , lines[ 2 ]. i32 ,
305- comps[0 ].get_line ()-> i32 ,
306- comps[1 ].get_line ()-> i32 ,
307- comps[2 ].get_line ()-> i32 , comp_width);
301+ rct_forward (lines + 0 , lines + 1 , lines + 2 ,
302+ comps[0 ].get_line (),
303+ comps[1 ].get_line (),
304+ comps[2 ].get_line (), comp_width);
308305 comps[0 ].push_line ();
309306 comps[1 ].push_line ();
310307 comps[2 ].push_line ();
@@ -350,17 +347,15 @@ namespace ojph {
350347 ui32 comp_width = recon_comp_rects[comp_num].siz .w ;
351348 if (reversible)
352349 {
353- int shift = 1 << (num_bits[comp_num] - 1 );
354- const si32 *sp = src_line-> i32 ;
355- si32* dp = tgt_line-> i32 + line_offsets[comp_num];
356- if (is_signed [comp_num]) {
357- if (nlt_type3[comp_num])
358- cnvrt_si32_to_si32_nlt_type3 (sp, dp, shift + 1 , comp_width) ;
359- else
360- memcpy (dp, sp , comp_width * sizeof (si32) );
350+ si64 shift = 1LL << (num_bits[comp_num] - 1 );
351+ if (is_signed[comp_num] && nlt_type3[comp_num])
352+ rev_convert_nlt_type3 (src_line, 0 , tgt_line,
353+ line_offsets [comp_num], shift + 1 , comp_width);
354+ else {
355+ shift = is_signed[comp_num] ? 0 : shift ;
356+ rev_convert (src_line, 0 , tgt_line,
357+ line_offsets[comp_num], shift , comp_width);
361358 }
362- else
363- cnvrt_si32_to_si32_shftd (sp, dp, +shift, comp_width);
364359 }
365360 else
366361 {
@@ -380,31 +375,31 @@ namespace ojph {
380375 if (comp_num == 0 )
381376 {
382377 if (reversible)
383- rct_backward (comps[0 ].pull_line ()-> i32 , comps[1 ].pull_line ()-> i32 ,
384- comps[2 ].pull_line ()-> i32 , lines[ 0 ]. i32 , lines[ 1 ]. i32 ,
385- lines[ 2 ]. i32 , comp_width);
378+ rct_backward (comps[0 ].pull_line (), comps[1 ].pull_line (),
379+ comps[2 ].pull_line (), lines + 0 , lines + 1 ,
380+ lines + 2 , comp_width);
386381 else
387382 ict_backward (comps[0 ].pull_line ()->f32 , comps[1 ].pull_line ()->f32 ,
388383 comps[2 ].pull_line ()->f32 , lines[0 ].f32 , lines[1 ].f32 ,
389384 lines[2 ].f32 , comp_width);
390385 }
391386 if (reversible)
392387 {
393- int shift = 1 << (num_bits[comp_num] - 1 );
394- const si32 *sp ;
388+ si64 shift = 1LL << (num_bits[comp_num] - 1 );
389+ line_buf* src_line ;
395390 if (comp_num < 3 )
396- sp = lines[ comp_num]. i32 ;
391+ src_line = lines + comp_num;
397392 else
398- sp = comps[comp_num].pull_line ()-> i32 ;
393+ src_line = comps[comp_num].pull_line ();
399394 si32* dp = tgt_line->i32 + line_offsets[comp_num];
400- if (is_signed[comp_num]) {
401- if (nlt_type3[comp_num])
402- cnvrt_si32_to_si32_nlt_type3 (sp, dp, shift + 1 , comp_width);
403- else
404- memcpy (dp, sp, comp_width * sizeof (si32));
395+ if (is_signed[comp_num] && nlt_type3[comp_num])
396+ rev_convert_nlt_type3 (src_line, 0 , tgt_line,
397+ line_offsets[comp_num], shift + 1 , comp_width);
398+ else {
399+ shift = is_signed[comp_num] ? 0 : shift;
400+ rev_convert (src_line, 0 , tgt_line,
401+ line_offsets[comp_num], shift, comp_width);
405402 }
406- else
407- cnvrt_si32_to_si32_shftd (sp, dp, +shift, comp_width);
408403 }
409404 else
410405 {
0 commit comments