Skip to content

Commit

Permalink
version 0.2.9.1 - better pre_processing
Browse files Browse the repository at this point in the history
  • Loading branch information
rcanut committed Dec 29, 2022
1 parent 4a5a23d commit f26dd25
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 15 deletions.
45 changes: 33 additions & 12 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.2.9 *
* last update: $ 12202022 nhw exp $ *
* version: 0.2.9.1 *
* last update: $ 12292022 nhw exp $ *
* *
****************************************************************************
****************************************************************************
Expand Down Expand Up @@ -463,7 +463,6 @@ void pre_processing(image_buffer *im)
}
}


for (i=(2*IM_DIM);i<((4*IM_SIZE)-(2*IM_DIM));i+=(2*IM_DIM))
{
for (scan=i+1,j=1;j<((2*IM_DIM)-2);j++,scan++)
Expand Down Expand Up @@ -546,13 +545,13 @@ void pre_processing(image_buffer *im)

if (abs(res)>sharpness && abs(res)<=(sharpness+20) && abs(count)>sharpness && abs(count)<=(sharpness+20) )
{
if (res>0 && count>0)
if (res>0 && count<0)
{
if (res>=count) im->im_jpeg[scan-1]++;else im->im_jpeg[scan]++;
im->im_jpeg[scan-1]++;im->im_jpeg[scan]--;
}
else if (res<0 && count<0)
else if (res<0 && count>0)
{
if (res<=count) im->im_jpeg[scan-1]--;else im->im_jpeg[scan]--;
im->im_jpeg[scan-1]--;im->im_jpeg[scan]++;
}
}
}
Expand Down Expand Up @@ -833,17 +832,39 @@ void pre_processing(image_buffer *im)

if (abs(res)>sharpness && abs(res)<=(sharpness+20) && abs(count)>sharpness && abs(count)<=(sharpness+20) )
{
if (!nhw_sharp_on[scan-1] && !nhw_sharp_on[scan])
if (!nhw_sharp_on[scan-1] && !nhw_sharp_on[scan])
{
if (res>0 && count<0)
if (res>0 && count>0)
{
if (res>=count)
{
im->im_jpeg[scan-1]++;
}
else
{
im->im_jpeg[scan]++;
}
}
else if (res<0 && count<0)
{
im->im_jpeg[scan-1]++;im->im_jpeg[scan]--;
if (res<=count)
{
im->im_jpeg[scan-1]--;
}
else
{
im->im_jpeg[scan]--;
}
}
else if (res<0 && count>0)
else if (j<((2*IM_DIM)-4) && abs(nhw_kernel[scan+1])>sharpness && abs(nhw_kernel[scan+1])<=(sharpness+20))
{
im->im_jpeg[scan-1]--;im->im_jpeg[scan]++;
if ((count>0 && nhw_kernel[scan+1]>0) || (count<0 && nhw_kernel[scan+1]<0)) j--;scan--;
}
}
else if (j<((2*IM_DIM)-4) && abs(nhw_kernel[scan+1])>sharpness && abs(nhw_kernel[scan+1])<=(sharpness+20))
{
if ((count>0 && nhw_kernel[scan+1]>0) || (count<0 && nhw_kernel[scan+1]<0)) j--;scan--;
}
}
else if (abs(res)>(sharpness+56) && abs(count)>(sharpness+56))
{
Expand Down
6 changes: 3 additions & 3 deletions encoder/nhw_encoder_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
****************************************************************************
* NHW Image Codec *
* file: nhw_encoder_cli.c *
* version: 0.2.9 *
* last update: $ 12202022 nhw exp $ *
* version: 0.2.9.1 *
* last update: $ 12292022 nhw exp $ *
* *
****************************************************************************
****************************************************************************
Expand Down Expand Up @@ -50,7 +50,7 @@
#include "codec.h"

#define PROGRAM "nhw-enc"
#define VERSION "0.2.9"
#define VERSION "0.2.9.1"

#define NHW_QUALITY_MIN LOW20
#define NHW_QUALITY_MAX HIGH3
Expand Down

0 comments on commit f26dd25

Please sign in to comment.