1
0

Compare commits

...

2 Commits

Author SHA1 Message Date
053a53c6fb update readme 2025-10-09 03:47:12 +02:00
1bad6d2aab remove scaling 2025-10-09 03:46:59 +02:00
4 changed files with 13 additions and 15 deletions

View File

@ -13,12 +13,12 @@ Shaders for Avidemux with OpenGL support
- New method based on sensor size and focal length - New method based on sensor size and focal length
- Accurate frame widening - Accurate frame widening
- Fisheye aware subsampling - Fisheye aware subsampling
- Rec.709 colorspace conversion _(requires to patch and rebuild Avidemux)_ - Rec.709 colorspace conversion
#### Content #### Content
- avidemux.patch - avidemux.patch
A patch to use GL_NEAREST instead of GL_LINEAR for the luminance channel (the shader is implementing bilinear interpolation with colorspace conversion). Optional patch to use GL_NEAREST instead of GL_LINEAR for the luminance channel (the shader is implementing bilinear interpolation with colorspace conversion).
- unfish_gopro_8:7.py - unfish_gopro_8:7.py
Script to compute the parameters Script to compute the parameters
@ -44,3 +44,9 @@ _For commercial OS's, figure out the paths yourself, then edit the preset to fix
- Select "Custom/preset_gopro_8:7" in the menu - Select "Custom/preset_gopro_8:7" in the menu
- Modify and/or add filters - Modify and/or add filters
- Save the video - Save the video
#### Shader options
- #define color_conversion: comment out to disable gamma correction for the luminance channel
- #define texture_filtering: comment out to disable custom bilinear filtering for the luminance channel
- #define rotate_180: uncomment to rotate the image by 180 degrees

View File

@ -103,7 +103,7 @@ adm.addVideoFilter(
"shaderLoader", "shaderFile=/opt/rk/avidemux/unfish_gopro_8:7.glsl") "shaderLoader", "shaderFile=/opt/rk/avidemux/unfish_gopro_8:7.glsl")
adm.addVideoFilter( adm.addVideoFilter(
"swscale", "swscale",
"width=2832", "width=2468",
"height=2160", "height=2160",
"algo=2", "algo=2",
"sourceAR=0", "sourceAR=0",

View File

@ -20,7 +20,7 @@
#define color_conversion #define color_conversion
#define texture_filtering #define texture_filtering
//#define rotate_180 #define rotate_180
//#define debug_borders //#define debug_borders
#undef highp // defined by Qt-OpenGl #undef highp // defined by Qt-OpenGl
@ -37,7 +37,6 @@ uniform float pts;
// parameters // parameters
const vec2 sensor_size = vec2(5.949440, 5.205760); const vec2 sensor_size = vec2(5.949440, 5.205760);
const vec2 rectilinear_scale = vec2(1.147370, 1.0);
const float equidistant_focal_length = 2.920000; const float equidistant_focal_length = 2.920000;
const float rectilinear_focal_length = 2.102263; const float rectilinear_focal_length = 2.102263;
@ -56,7 +55,7 @@ vec2 sensor_to_texture;
void initialize() { void initialize() {
texture_center = myResolution * 0.5; texture_center = myResolution * 0.5;
texture_to_sensor = (sensor_size / myResolution) * rectilinear_scale; texture_to_sensor = (sensor_size / myResolution);
#ifdef rotate_180 #ifdef rotate_180
texture_to_sensor *= -1.0; texture_to_sensor *= -1.0;
#endif #endif

View File

@ -87,26 +87,19 @@ print("linear fov : horizontal = %7.3f, vertical = %7.3f, diagonal = %7.3f (deg
print("\n--- shader parameters ---\n") print("\n--- shader parameters ---\n")
output_size_horizontal = 2.0 * rectilinear_radius(gopro_fov_horizontal * 0.5)
output_size_vertical = gopro_size_vertical
output_scale_horizontal = output_size_horizontal / gopro_size_horizontal
print("""// parameters\n print("""// parameters\n
const vec2 sensor_size = vec2(%.6f, %.6f); const vec2 sensor_size = vec2(%.6f, %.6f);
const vec2 rectilinear_scale = vec2(%.6f, 1.0);
const float equidistant_focal_length = %.6f; const float equidistant_focal_length = %.6f;
const float rectilinear_focal_length = %.6f;""" % ( const float rectilinear_focal_length = %.6f;""" % (
gopro_size_horizontal, gopro_size_vertical, gopro_size_horizontal, gopro_size_vertical,
output_scale_horizontal,
gopro_focal_length, gopro_focal_length,
rectilinear_focal_length_vertical) rectilinear_focal_length_vertical)
) )
print("\n--- filters parameters ---\n") print("\n--- output size ---\n")
def print_output_array(array_vertical): def print_output_array(array_vertical):
array_horizontal = (array_vertical / gopro_array_vertical) * gopro_array_horizontal * output_scale_horizontal array_horizontal = (array_vertical / gopro_array_vertical) * gopro_array_horizontal
print("resize: width = %d, height = %d" % ( print("resize: width = %d, height = %d" % (
round(array_horizontal / 4.0) * 4, round(array_horizontal / 4.0) * 4,
array_vertical)) array_vertical))