Skip to content

Commit

Permalink
version 0.3.0-rc4
Browse files Browse the repository at this point in the history
Improve weight computation for the nhw_kernel
  • Loading branch information
rcanut committed Dec 7, 2023
1 parent 0e28b1d commit 6702b5d
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 12 deletions.
46 changes: 37 additions & 9 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.3.0-rc3 *
* last update: $ 10122023 nhw exp $ *
* version: 0.3.0-rc4 *
* last update: $ 12072023 nhw exp $ *
* *
****************************************************************************
****************************************************************************
Expand Down Expand Up @@ -557,7 +557,7 @@ void im_recons_wavelet_band(image_buffer *im)

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

Expand Down Expand Up @@ -597,7 +597,7 @@ void pre_processing(image_buffer *im)
else if (im->setup->quality_setting==LOW19) n1=60;


for (i=(2*IM_DIM),res3=0,a=0;i<((4*IM_SIZE)-(2*IM_DIM));i+=(2*IM_DIM))
for (i=(2*IM_DIM),res3=0,a=0,t1=0,t2=0;i<((4*IM_SIZE)-(2*IM_DIM));i+=(2*IM_DIM))
{
for (scan=i+1,j=1;j<((2*IM_DIM)-1);j++,scan++)
{
Expand Down Expand Up @@ -632,8 +632,22 @@ void pre_processing(image_buffer *im)
{
nhw_kernel[scan] = res2;

if (res3==1) res3 = 2;
else res3 = 0;
if (!t1)
{
res3 = 0;
t1 = 1;
}
else
{
if (res3==1) res3 = 2;
else
{
res3 = 0;
if (t1==1) t1 = 2;
else if (t1==2) t1 = 3;
else t1 = 0;
}
}
}
}
else nhw_kernel[scan] = res2;
Expand All @@ -643,7 +657,7 @@ void pre_processing(image_buffer *im)
res2 = (((15*res)+count)>>4);

if (res<=sharpn2 && res2>sharpn2 && res2<=(sharpn2+20) && im->setup->quality_setting<=LOW4)
{
{
if (!a)
{
nhw_kernel[scan] = sharpn2+21;
Expand All @@ -654,8 +668,22 @@ void pre_processing(image_buffer *im)
{
nhw_kernel[scan] = res2;

if (a==1) a = 2;
else a = 0;
if (!t2)
{
a = 0;
t2 = 1;
}
else
{
if (a==1) a = 2;
else
{
a = 0;
if (t2==1) t2 = 2;
else if (t2==2) t2 = 3;
else t2 = 0;
}
}
}
}
else nhw_kernel[scan] = res2;
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.3.0-rc3 *
* last update: $ 10122023 nhw exp $ *
* version: 0.3.0-rc4 *
* last update: $ 12072023 nhw exp $ *
* *
****************************************************************************
****************************************************************************
Expand Down Expand Up @@ -50,7 +50,7 @@
#include "codec.h"

#define PROGRAM "nhw-enc"
#define VERSION "0.3.0-rc3"
#define VERSION "0.3.0-rc4"

#define NHW_QUALITY_MIN LOW20
#define NHW_QUALITY_MAX HIGH3
Expand Down

0 comments on commit 6702b5d

Please sign in to comment.