keep original format and scale pixels instead
This commit is contained in:
@ -9,6 +9,7 @@ import math
|
|||||||
|
|
||||||
frame_width = 8
|
frame_width = 8
|
||||||
frame_height = 7
|
frame_height = 7
|
||||||
|
input_ratio = frame_width / frame_height
|
||||||
|
|
||||||
input_vertical_fov = 108.0
|
input_vertical_fov = 108.0
|
||||||
input_diagonal_fov = 156.0
|
input_diagonal_fov = 156.0
|
||||||
@ -20,14 +21,14 @@ output_horizontal_length = math.sqrt((input_diagonal_length ** 2) / (input_verti
|
|||||||
output_diagonal_length = math.hypot(output_horizontal_length, input_vertical_length)
|
output_diagonal_length = math.hypot(output_horizontal_length, input_vertical_length)
|
||||||
output_diagonal_fov = math.degrees(math.atan(output_diagonal_length)) * 2.0
|
output_diagonal_fov = math.degrees(math.atan(output_diagonal_length)) * 2.0
|
||||||
|
|
||||||
output_ratio = output_horizontal_length / input_vertical_length
|
output_ratio = 1.0 / (output_horizontal_length / input_vertical_length)
|
||||||
|
|
||||||
print("Output FOV = %f" % output_diagonal_fov)
|
print("Output FOV = %f" % output_diagonal_fov)
|
||||||
print("Output Ratio = %f" % output_ratio)
|
print("Output Ratio = %f" % output_ratio)
|
||||||
print("= Resolutions =====================")
|
print("= Resolutions =====================")
|
||||||
|
|
||||||
def width_rounded_8(height):
|
def width_rounded_8(height):
|
||||||
width = int(round(height * output_ratio))
|
width = int(round(height * input_ratio))
|
||||||
return ((width + 4) // 8) * 8
|
return ((width + 4) // 8) * 8
|
||||||
|
|
||||||
print("QHD = %i x 540" % width_rounded_8(540))
|
print("QHD = %i x 540" % width_rounded_8(540))
|
||||||
|
@ -91,7 +91,7 @@ adm.addVideoFilter(
|
|||||||
"shaderFile=/opt/rk/avidemux/unfish_gopro_8:7.glsl")
|
"shaderFile=/opt/rk/avidemux/unfish_gopro_8:7.glsl")
|
||||||
adm.addVideoFilter(
|
adm.addVideoFilter(
|
||||||
"swscale",
|
"swscale",
|
||||||
"width=3312",
|
"width=2472",
|
||||||
"height=2160",
|
"height=2160",
|
||||||
"algo=1",
|
"algo=1",
|
||||||
"sourceAR=0",
|
"sourceAR=0",
|
||||||
|
@ -91,7 +91,7 @@ adm.addVideoFilter(
|
|||||||
"shaderFile=/opt/rk/avidemux/unfish_gopro_8:7.glsl")
|
"shaderFile=/opt/rk/avidemux/unfish_gopro_8:7.glsl")
|
||||||
adm.addVideoFilter(
|
adm.addVideoFilter(
|
||||||
"swscale",
|
"swscale",
|
||||||
"width=1656",
|
"width=1232",
|
||||||
"height=1080",
|
"height=1080",
|
||||||
"algo=1",
|
"algo=1",
|
||||||
"sourceAR=0",
|
"sourceAR=0",
|
||||||
|
@ -91,7 +91,7 @@ adm.addVideoFilter(
|
|||||||
"shaderFile=/opt/rk/avidemux/unfish_gopro_8:7.glsl")
|
"shaderFile=/opt/rk/avidemux/unfish_gopro_8:7.glsl")
|
||||||
adm.addVideoFilter(
|
adm.addVideoFilter(
|
||||||
"swscale",
|
"swscale",
|
||||||
"width=1104",
|
"width=824",
|
||||||
"height=720",
|
"height=720",
|
||||||
"algo=1",
|
"algo=1",
|
||||||
"sourceAR=0",
|
"sourceAR=0",
|
||||||
|
@ -91,7 +91,7 @@ adm.addVideoFilter(
|
|||||||
"shaderFile=/opt/rk/avidemux/unfish_gopro_8:7.glsl")
|
"shaderFile=/opt/rk/avidemux/unfish_gopro_8:7.glsl")
|
||||||
adm.addVideoFilter(
|
adm.addVideoFilter(
|
||||||
"swscale",
|
"swscale",
|
||||||
"width=832",
|
"width=616",
|
||||||
"height=540",
|
"height=540",
|
||||||
"algo=1",
|
"algo=1",
|
||||||
"sourceAR=0",
|
"sourceAR=0",
|
||||||
|
@ -13,17 +13,19 @@ uniform float pts;
|
|||||||
|
|
||||||
const vec2 half_pixel = vec2(0.5, 0.5);
|
const vec2 half_pixel = vec2(0.5, 0.5);
|
||||||
|
|
||||||
|
const vec2 input_scale = vec2(0.652485, 1.0);
|
||||||
const float input_fov = 156.0;
|
const float input_fov = 156.0;
|
||||||
const float output_fov = 119.789529;
|
const float output_fov = 119.789529;
|
||||||
|
|
||||||
vec2 unfish(vec2 coord) {
|
vec2 unfish(vec2 coord) {
|
||||||
float diameter = sqrt(dot(myResolution, myResolution));
|
float diameter = sqrt(dot(myResolution, myResolution));
|
||||||
vec2 center = myResolution * 0.5;
|
vec2 center = myResolution * 0.5;
|
||||||
vec2 position = coord - center;
|
vec2 input_position = (coord - center) * input_scale;
|
||||||
float input_distance = length(position);
|
float input_distance = length(input_position);
|
||||||
float input_foc = diameter / radians(input_fov);
|
float input_len = diameter / radians(input_fov);
|
||||||
float output_foc = diameter / (2.0 * tan(radians(output_fov) * 0.5));
|
float output_len = diameter / (2.0 * tan(radians(output_fov) * 0.5));
|
||||||
return center + position * (input_foc * atan(input_distance / output_foc) / input_distance);
|
float unfish_ratio = input_len * atan(input_distance / output_len) / input_distance;
|
||||||
|
return center + input_position * unfish_ratio;
|
||||||
}
|
}
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
Reference in New Issue
Block a user