summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gtk/src/hb-backend.c8
-rw-r--r--libhb/denoise.c83
-rw-r--r--macosx/Controller.m12
-rwxr-xr-xscripts/manicure.rb6
-rw-r--r--test/test.c9
-rw-r--r--win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs6
6 files changed, 71 insertions, 53 deletions
diff --git a/gtk/src/hb-backend.c b/gtk/src/hb-backend.c
index ec6379eb2..686fa3fdb 100644
--- a/gtk/src/hb-backend.c
+++ b/gtk/src/hb-backend.c
@@ -217,11 +217,11 @@ combo_opts_t deint_opts =
static options_map_t d_denoise_opts[] =
{
- {N_("Off"), "off", 0, ""},
+ {N_("Off"), "off", 0, ""},
{N_("Custom"), "custom", 1, ""},
- {N_("Weak"), "weak", 2, "2:1:2:3"},
- {N_("Medium"), "medium", 3, "3:2:2:3"},
- {N_("Strong"), "strong", 4, "7:7:5:5"},
+ {N_("Weak"), "weak", 2, "2:1:1:2:3:3"},
+ {N_("Medium"), "medium", 3, "3:2:2:2:3:3"},
+ {N_("Strong"), "strong", 4, "7:7:7:5:5:5"},
};
combo_opts_t denoise_opts =
{
diff --git a/libhb/denoise.c b/libhb/denoise.c
index bf083a53d..626bf18ad 100644
--- a/libhb/denoise.c
+++ b/libhb/denoise.c
@@ -30,7 +30,7 @@
struct hb_filter_private_s
{
- short hqdn3d_coef[4][512*16];
+ short hqdn3d_coef[6][512*16];
unsigned short * hqdn3d_line;
unsigned short * hqdn3d_frame[3];
};
@@ -221,55 +221,71 @@ static int hb_denoise_init( hb_filter_object_t * filter,
filter->private_data = calloc( sizeof(struct hb_filter_private_s), 1 );
hb_filter_private_t * pv = filter->private_data;
- double spatial_luma, temporal_luma, spatial_chroma, temporal_chroma;
+ double spatial_luma, spatial_chroma_b, spatial_chroma_r;
+ double temporal_luma, temporal_chroma_b, temporal_chroma_r;
if( filter->settings )
{
- switch( sscanf( filter->settings, "%lf:%lf:%lf:%lf",
- &spatial_luma, &spatial_chroma,
- &temporal_luma, &temporal_chroma ) )
+ switch( sscanf( filter->settings, "%lf:%lf:%lf:%lf:%lf:%lf",
+ &spatial_luma, &spatial_chroma_b, &spatial_chroma_r,
+ &temporal_luma, &temporal_chroma_b, &temporal_chroma_r ) )
{
case 0:
- spatial_luma = HQDN3D_SPATIAL_LUMA_DEFAULT;
-
- spatial_chroma = HQDN3D_SPATIAL_CHROMA_DEFAULT;
-
- temporal_luma = HQDN3D_TEMPORAL_LUMA_DEFAULT;
-
- temporal_chroma = temporal_luma *
- spatial_chroma / spatial_luma;
+ spatial_luma = HQDN3D_SPATIAL_LUMA_DEFAULT;
+ spatial_chroma_b = HQDN3D_SPATIAL_CHROMA_DEFAULT;
+ spatial_chroma_r = spatial_chroma_b;
+ temporal_luma = HQDN3D_TEMPORAL_LUMA_DEFAULT;
+ temporal_chroma_b = temporal_luma *
+ spatial_chroma_b / spatial_luma;
+ temporal_chroma_r = temporal_chroma_b;
break;
case 1:
- spatial_chroma = HQDN3D_SPATIAL_CHROMA_DEFAULT *
- spatial_luma / HQDN3D_SPATIAL_LUMA_DEFAULT;
-
- temporal_luma = HQDN3D_TEMPORAL_LUMA_DEFAULT *
- spatial_luma / HQDN3D_SPATIAL_LUMA_DEFAULT;
-
- temporal_chroma = temporal_luma *
- spatial_chroma / spatial_luma;
+ spatial_chroma_b = HQDN3D_SPATIAL_CHROMA_DEFAULT *
+ spatial_luma / HQDN3D_SPATIAL_LUMA_DEFAULT;
+ spatial_chroma_r = spatial_chroma_b;
+ temporal_luma = HQDN3D_TEMPORAL_LUMA_DEFAULT *
+ spatial_luma / HQDN3D_SPATIAL_LUMA_DEFAULT;
+ temporal_chroma_b = temporal_luma *
+ spatial_chroma_b / spatial_luma;
+ temporal_chroma_r = temporal_chroma_b;
break;
case 2:
- temporal_luma = HQDN3D_TEMPORAL_LUMA_DEFAULT *
- spatial_luma / HQDN3D_SPATIAL_LUMA_DEFAULT;
-
- temporal_chroma = temporal_luma *
- spatial_chroma / spatial_luma;
+ spatial_chroma_r = spatial_chroma_b;
+ temporal_luma = HQDN3D_TEMPORAL_LUMA_DEFAULT *
+ spatial_luma / HQDN3D_SPATIAL_LUMA_DEFAULT;
+ temporal_chroma_b = temporal_luma *
+ spatial_chroma_b / spatial_luma;
+ temporal_chroma_r = temporal_chroma_b;
break;
case 3:
- temporal_chroma = temporal_luma *
- spatial_chroma / spatial_luma;
+ temporal_luma = HQDN3D_TEMPORAL_LUMA_DEFAULT *
+ spatial_luma / HQDN3D_SPATIAL_LUMA_DEFAULT;
+ temporal_chroma_b = temporal_luma *
+ spatial_chroma_b / spatial_luma;
+ temporal_chroma_r = temporal_chroma_b;
+ break;
+
+ case 4:
+ temporal_chroma_b = temporal_luma *
+ spatial_chroma_b / spatial_luma;
+ temporal_chroma_r = temporal_chroma_b;
+ break;
+
+ case 5:
+ temporal_chroma_r = temporal_chroma_b;
break;
}
}
hqdn3d_precalc_coef( pv->hqdn3d_coef[0], spatial_luma );
hqdn3d_precalc_coef( pv->hqdn3d_coef[1], temporal_luma );
- hqdn3d_precalc_coef( pv->hqdn3d_coef[2], spatial_chroma );
- hqdn3d_precalc_coef( pv->hqdn3d_coef[3], temporal_chroma );
+ hqdn3d_precalc_coef( pv->hqdn3d_coef[2], spatial_chroma_b );
+ hqdn3d_precalc_coef( pv->hqdn3d_coef[3], temporal_chroma_b );
+ hqdn3d_precalc_coef( pv->hqdn3d_coef[4], spatial_chroma_r );
+ hqdn3d_precalc_coef( pv->hqdn3d_coef[5], temporal_chroma_r );
return 0;
}
@@ -329,18 +345,19 @@ static int hb_denoise_work( hb_filter_object_t * filter,
pv->hqdn3d_line = malloc( in->plane[0].stride * sizeof(unsigned short) );
}
- int c;
+ int c, coef_index;
for ( c = 0; c < 3; c++ )
{
+ coef_index = c * 2;
hqdn3d_denoise( in->plane[c].data,
out->plane[c].data,
pv->hqdn3d_line,
&pv->hqdn3d_frame[c],
in->plane[c].stride,
in->plane[c].height,
- pv->hqdn3d_coef[c?2:0],
- pv->hqdn3d_coef[c?3:1] );
+ pv->hqdn3d_coef[coef_index],
+ pv->hqdn3d_coef[coef_index+1] );
}
out->s = in->s;
diff --git a/macosx/Controller.m b/macosx/Controller.m
index 637448890..2bda63caf 100644
--- a/macosx/Controller.m
+++ b/macosx/Controller.m
@@ -3780,15 +3780,15 @@ bool one_burned = FALSE;
}
else if ([fPictureController denoise] == 2) // Weak in popup
{
- hb_add_filter( job, filter, "2:1:2:3" );
+ hb_add_filter( job, filter, "2:1:1:2:3:3" );
}
else if ([fPictureController denoise] == 3) // Medium in popup
{
- hb_add_filter( job, filter, "3:2:2:3" );
+ hb_add_filter( job, filter, "3:2:2:2:3:3" );
}
else if ([fPictureController denoise] == 4) // Strong in popup
{
- hb_add_filter( job, filter, "7:7:5:5" );
+ hb_add_filter( job, filter, "7:7:7:5:5:5" );
}
@@ -4340,15 +4340,15 @@ bool one_burned = FALSE;
}
else if ([[queueToApply objectForKey:@"PictureDenoise"] intValue] == 2) // Weak in popup
{
- hb_add_filter( job, filter, "2:1:2:3" );
+ hb_add_filter( job, filter, "2:1:1:2:3:3" );
}
else if ([[queueToApply objectForKey:@"PictureDenoise"] intValue] == 3) // Medium in popup
{
- hb_add_filter( job, filter, "3:2:2:3" );
+ hb_add_filter( job, filter, "3:2:2:2:3:3" );
}
else if ([[queueToApply objectForKey:@"PictureDenoise"] intValue] == 4) // Strong in popup
{
- hb_add_filter( job, filter, "7:7:5:5" );
+ hb_add_filter( job, filter, "7:7:7:5:5:5" );
}
diff --git a/scripts/manicure.rb b/scripts/manicure.rb
index 83b991dd9..5cbc9d906 100755
--- a/scripts/manicure.rb
+++ b/scripts/manicure.rb
@@ -1439,11 +1439,11 @@ class Display
when 1
commandString << "denoise_opt = \"" << hash["PictureDenoiseCustom"].to_s << "\";\n "
when 2
- commandString << "denoise_opt = \"2:1:2:3\";\n "
+ commandString << "denoise_opt = \"2:1:1:2:3:3\";\n "
when 3
- commandString << "denoise_opt = \"3:2:2:3\";\n "
+ commandString << "denoise_opt = \"3:2:2:2:3:3\";\n "
when 4
- commandString << "denoise_opt = \"7:7:5:5\";\n "
+ commandString << "denoise_opt = \"7:7:7:5:5:5\";\n "
end
if hash["PictureDecomb"].to_i != 0
diff --git a/test/test.c b/test/test.c
index d4c739b6d..826528172 100644
--- a/test/test.c
+++ b/test/test.c
@@ -3507,7 +3507,8 @@ if (hb_qsv_available())
" -8, --denoise Denoise video with hqdn3d filter\n"
" <weak/medium/strong> or omitted (default settings)\n"
" or\n"
- " <SL:SC:TL:TC> (default 4:3:6:4.5)\n"
+ " <SL:SCb:SCr:TL:TCb:TCr>\n"
+ " (default: 4:3:3:6:4.5:4.5)\n"
" -7, --deblock Deblock video with pp7 filter\n"
" <QP:M> (default 5:2)\n"
" --rotate Flips images axes\n"
@@ -4105,15 +4106,15 @@ static int ParseOptions( int argc, char ** argv )
{
if (!( strcmp( optarg, "weak" ) ))
{
- denoise_opt = "2:1:2:3";
+ denoise_opt = "2:1:1:2:3:3";
}
else if (!( strcmp( optarg, "medium" ) ))
{
- denoise_opt = "3:2:2:3";
+ denoise_opt = "3:2:2:2:3:3";
}
else if (!( strcmp( optarg, "strong" ) ))
{
- denoise_opt = "7:7:5:5";
+ denoise_opt = "7:7:7:5:5:5";
}
else
{
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs
index e06d9dc5d..c84d43cf2 100644
--- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs
+++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs
@@ -1190,13 +1190,13 @@ namespace HandBrake.Interop
switch (profile.Denoise)
{
case Denoise.Weak:
- settings = "2:1:2:3";
+ settings = "2:1:1:2:3:3";
break;
case Denoise.Medium:
- settings = "3:2:2:3";
+ settings = "3:2:2:2:3:3";
break;
case Denoise.Strong:
- settings = "7:7:5:5";
+ settings = "7:7:7:5:5:5";
break;
case Denoise.Custom:
settings = profile.CustomDenoise;