Remove any usage of padding for this format.
Unified · Split
| @@ -19043,19 +19043,19 @@ Dual fisheye. · 19042 unmodified lines | ||
| 19043 | 19043 | |
| 19044 | 19044 | Format specific options: |
| 19045 | 19045 | @table @option |
| 19046 | −@item in_pad | |
| 19047 | −@item out_pad | |
| 19048 | −Set padding proportion. Values in decimals. | |
| 19046 | +@item h_fov | |
| 19047 | +@item v_fov | |
| 19048 | +@item d_fov | |
| 19049 | +Set output horizontal/vertical/diagonal field of view. Values in degrees. | |
| 19049 | 19050 | |
| 19050 | −Example values: | |
| 19051 | −@table @samp | |
| 19052 | −@item 0 | |
| 19053 | −No padding. | |
| 19054 | −@item 0.01 | |
| 19055 | −1% padding. | |
| 19056 | −@end table | |
| 19051 | +If diagonal field of view is set it overrides horizontal and vertical field of view. | |
| 19057 | 19052 | |
| 19058 | −Default value is @b{@samp{0}}. | |
| 19053 | +@item ih_fov | |
| 19054 | +@item iv_fov | |
| 19055 | +@item id_fov | |
| 19056 | +Set input horizontal/vertical/diagonal field of view. Values in degrees. | |
| 19057 | + | |
| 19058 | +If diagonal field of view is set it overrides horizontal and vertical field of view. | |
| 19059 | 19059 | @end table |
| 19060 | 19060 | |
| 19061 | 19061 | @item barrel |
| @@ -2991,16 +2991,14 @@ static int dfisheye_to_xyz(const V360Context *s, · 2990 unmodified lines | ||
| 2991 | 2991 | int i, int j, int width, int height, |
| 2992 | 2992 | float *vec) |
| 2993 | 2993 | { |
| 2994 | − const float scale = 1.f + s->out_pad; | |
| 2995 | − | |
| 2996 | 2994 | const float ew = width / 2.f; |
| 2997 | 2995 | const float eh = height; |
| 2998 | 2996 | |
| 2999 | 2997 | const int ei = i >= ew ? i - ew : i; |
| 3000 | 2998 | const float m = i >= ew ? 1.f : -1.f; |
| 3001 | 2999 | |
| 3002 | − const float uf = ((2.f * ei) / ew - 1.f) * scale; | |
| 3003 | − const float vf = ((2.f * j + 1.f) / eh - 1.f) * scale; | |
| 3000 | + const float uf = s->flat_range[0] * ((2.f * ei) / ew - 1.f); | |
| 3001 | + const float vf = s->flat_range[1] * ((2.f * j + 1.f) / eh - 1.f); | |
| 3004 | 3002 | |
| 3005 | 3003 | const float h = hypotf(uf, vf); |
| 3006 | 3004 | const float lh = h > 0.f ? h : 1.f; |
| @@ -3034,8 +3032,6 @@ static int xyz_to_dfisheye(const V360Context *s, · 27 unmodified lines | ||
| 3034 | 3032 | const float *vec, int width, int height, |
| 3035 | 3033 | int16_t us[4][4], int16_t vs[4][4], float *du, float *dv) |
| 3036 | 3034 | { |
| 3037 | − const float scale = 1.f - s->in_pad; | |
| 3038 | − | |
| 3039 | 3035 | const float ew = width / 2.f; |
| 3040 | 3036 | const float eh = height; |
| 3041 | 3037 | |
| @@ -3043,8 +3039,8 @@ static int xyz_to_dfisheye(const V360Context *s, · 1 unmodified line | ||
| 3043 | 3039 | const float lh = h > 0.f ? h : 1.f; |
| 3044 | 3040 | const float theta = acosf(fabsf(vec[2])) / M_PI; |
| 3045 | 3041 | |
| 3046 | − float uf = (theta * (vec[0] / lh) * s->input_mirror_modifier[0] * scale + 0.5f) * ew; | |
| 3047 | − float vf = (theta * (vec[1] / lh) * s->input_mirror_modifier[1] * scale + 0.5f) * eh; | |
| 3042 | + float uf = (theta * (vec[0] / lh) * s->input_mirror_modifier[0] / s->iflat_range[0] + 0.5f) * ew; | |
| 3043 | + float vf = (theta * (vec[1] / lh) * s->input_mirror_modifier[1] / s->iflat_range[1] + 0.5f) * eh; | |
| 3048 | 3044 | |
| 3049 | 3045 | int ui, vi; |
| 3050 | 3046 | int u_shift; |
| @@ -3657,6 +3653,14 @@ static void fov_from_dfov(int format, float d_fov, float w, float h, float *h_fo · 606 unmodified lines | ||
| 3657 | 3653 | *v_fov = 2.f * atan2f(h * 0.5f, l) * 360.f / M_PI; |
| 3658 | 3654 | } |
| 3659 | 3655 | break; |
| 3656 | + case DUAL_FISHEYE: | |
| 3657 | + { | |
| 3658 | + const float d = 0.5f * hypotf(w * 0.5f, h); | |
| 3659 | + | |
| 3660 | + *h_fov = d / w * 2.f * d_fov; | |
| 3661 | + *v_fov = d / h * d_fov; | |
| 3662 | + } | |
| 3663 | + break; | |
| 3660 | 3664 | case FISHEYE: |
| 3661 | 3665 | { |
| 3662 | 3666 | const float d = 0.5f * hypotf(w, h); |
| @@ -3928,7 +3932,7 @@ static int config_output(AVFilterLink *outlink) · 265 unmodified lines | ||
| 3928 | 3932 | return AVERROR(EINVAL); |
| 3929 | 3933 | case DUAL_FISHEYE: |
| 3930 | 3934 | s->in_transform = xyz_to_dfisheye; |
| 3931 | − err = 0; | |
| 3935 | + err = prepare_fisheye_in(ctx); | |
| 3932 | 3936 | wf = w; |
| 3933 | 3937 | hf = h; |
| 3934 | 3938 | break; |
| @@ -4058,7 +4062,7 @@ static int config_output(AVFilterLink *outlink) · 123 unmodified lines | ||
| 4058 | 4062 | break; |
| 4059 | 4063 | case DUAL_FISHEYE: |
| 4060 | 4064 | s->out_transform = dfisheye_to_xyz; |
| 4061 | − prepare_out = NULL; | |
| 4065 | + prepare_out = prepare_fisheye_out; | |
| 4062 | 4066 | w = lrintf(wf); |
| 4063 | 4067 | h = lrintf(hf); |
| 4064 | 4068 | break; |