Skip to content

Commit

Permalink
Version 0.2.0 (improve pre_processing)
Browse files Browse the repository at this point in the history
  • Loading branch information
rcanut committed Sep 4, 2021
1 parent 84101de commit 1b1d4af
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 37 deletions.
68 changes: 34 additions & 34 deletions encoder/image_processing.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
****************************************************************************
* NHW Image Codec *
* file: image_processing.c *
* version: 0.1.3 *
* last update: $ 06012012 nhw exp $ *
* version: 0.2.0 *
* last update: $ 09042021 nhw exp $ *
* *
****************************************************************************
****************************************************************************
Expand All @@ -12,7 +12,7 @@
* remark: -image processing set *
***************************************************************************/

/* Copyright (C) 2007-2013 NHW Project
/* Copyright (C) 2007-2021 NHW Project
Written by Raphael Canut - nhwcodec_at_gmail.com */
/*
Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -411,7 +411,7 @@ void im_recons_wavelet_band(image_buffer *im)

void pre_processing(image_buffer *im)
{
int i,j,scan,res,res2,count,e=0,a=0,sharpness,sharpn2,n1;
int i,j,scan,res,res2,res3,count,e=0,a=0,sharpness,sharpn2,n1;
short *nhw_process;
char lower_quality_setting_on;

Expand Down Expand Up @@ -557,21 +557,21 @@ void pre_processing(image_buffer *im)
nhw_process[scan-(2*IM_DIM-1)]-nhw_process[scan+(2*IM_DIM+1)];

if (res2>4) im->im_jpeg[scan]++;
else
{

scan--;

res2 = (nhw_process[scan]<<3) -
scan--;

res3 = (nhw_process[scan]<<3) -
nhw_process[scan-1]-nhw_process[scan+1]-
nhw_process[scan-(2*IM_DIM)]-nhw_process[scan+(2*IM_DIM)]-
nhw_process[scan-(2*IM_DIM+1)]-nhw_process[scan+(2*IM_DIM-1)]-
nhw_process[scan-(2*IM_DIM-1)]-nhw_process[scan+(2*IM_DIM+1)];

if (res2>4) im->im_jpeg[scan]++;
if (res3>4) im->im_jpeg[scan]++;

if (res2<-24) im->im_jpeg[scan+1]--;
if (res3<-24) im->im_jpeg[scan]--;

scan++;
}
scan++;

scan+=(2*IM_DIM);

Expand All @@ -594,23 +594,23 @@ void pre_processing(image_buffer *im)
nhw_process[scan-(2*IM_DIM-1)]-nhw_process[scan+(2*IM_DIM+1)];

if (res2<-4) im->im_jpeg[scan]--;
else
{

scan--;
scan--;

res2 = (nhw_process[scan]<<3) -
res3 = (nhw_process[scan]<<3) -
nhw_process[scan-1]-nhw_process[scan+1]-
nhw_process[scan-(2*IM_DIM)]-nhw_process[scan+(2*IM_DIM)]-
nhw_process[scan-(2*IM_DIM+1)]-nhw_process[scan+(2*IM_DIM-1)]-
nhw_process[scan-(2*IM_DIM-1)]-nhw_process[scan+(2*IM_DIM+1)];

if (res2<-4) im->im_jpeg[scan]--;
if (res3<-4) im->im_jpeg[scan]--;

scan++;
}
if (res2>24) im->im_jpeg[scan+1]++;
if (res3>24) im->im_jpeg[scan]++;

scan++;

scan+=(2*IM_DIM);
scan+=(2*IM_DIM);

}
}
Expand All @@ -635,21 +635,21 @@ void pre_processing(image_buffer *im)
nhw_process[scan-(2*IM_DIM-1)]-nhw_process[scan+(2*IM_DIM+1)];

if (res2>4) im->im_jpeg[scan]++;
else
{

scan++;
scan++;

res2 = (nhw_process[scan]<<3) -
res3 = (nhw_process[scan]<<3) -
nhw_process[scan-1]-nhw_process[scan+1]-
nhw_process[scan-(2*IM_DIM)]-nhw_process[scan+(2*IM_DIM)]-
nhw_process[scan-(2*IM_DIM+1)]-nhw_process[scan+(2*IM_DIM-1)]-
nhw_process[scan-(2*IM_DIM-1)]-nhw_process[scan+(2*IM_DIM+1)];

if (res2>4) im->im_jpeg[scan]++;
if (res3>4) im->im_jpeg[scan]++;

scan--;
}
if (res2<-24) im->im_jpeg[scan-1]--;
if (res3<-24) im->im_jpeg[scan]--;

scan--;

scan+=(2*IM_DIM+1);

Expand All @@ -673,21 +673,21 @@ void pre_processing(image_buffer *im)
nhw_process[scan-(2*IM_DIM-1)]-nhw_process[scan+(2*IM_DIM+1)];

if (res2<-4) im->im_jpeg[scan]--;
else
{

scan++;
scan++;

res2 = (nhw_process[scan]<<3) -
res3 = (nhw_process[scan]<<3) -
nhw_process[scan-1]-nhw_process[scan+1]-
nhw_process[scan-(2*IM_DIM)]-nhw_process[scan+(2*IM_DIM)]-
nhw_process[scan-(2*IM_DIM+1)]-nhw_process[scan+(2*IM_DIM-1)]-
nhw_process[scan-(2*IM_DIM-1)]-nhw_process[scan+(2*IM_DIM+1)];

if (res2<-4) im->im_jpeg[scan]--;
if (res3<-4) im->im_jpeg[scan]--;

scan--;
}
if (res2>24) im->im_jpeg[scan-1]++;
if (res3>24) im->im_jpeg[scan]++;

scan--;

scan+=(2*IM_DIM+1);

Expand Down
6 changes: 3 additions & 3 deletions encoder/nhw_encoder.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
****************************************************************************
* NHW Image Codec *
* file: nhw_encoder.c *
* version: 0.1.6 *
* last update: $ 10142020 nhw exp $ *
* version: 0.2.0 *
* last update: $ 09042021 nhw exp $ *
* *
****************************************************************************
****************************************************************************
Expand All @@ -12,7 +12,7 @@
* remark: -simple codec *
***************************************************************************/

/* Copyright (C) 2007-2020 NHW Project
/* Copyright (C) 2007-2021 NHW Project
Written by Raphael Canut - nhwcodec_at_gmail.com */
/*
Redistribution and use in source and binary forms, with or without
Expand Down

0 comments on commit 1b1d4af

Please sign in to comment.