History

avfilter/vf_v360: refactor dimensions and offsets calculations

Paul B Mahol committed 7 years ago

Commit 7f8f8861 parent 197985c1 file · +13 −22Browse files

Showing the changes to libavfilter (1 of 1 file). Show all

Unified · Split

libavfilter/vf_v360.c+13−22
@@ -2157,6 +2157,14 @@ static void fov_from_dfov(V360Context *s, float w, float h) · 2156 unmodified lines
2157 s->v_fov += 360.f;2157 s->v_fov += 360.f;
2158}2158}
2159 2159
2160static void set_dimensions(int *outw, int *outh, int w, int h, const AVPixFmtDescriptor *desc)
2161{
2162 outw[1] = outw[2] = FF_CEIL_RSHIFT(w, desc->log2_chroma_w);
2163 outw[0] = outw[3] = w;
2164 outh[1] = outh[2] = FF_CEIL_RSHIFT(h, desc->log2_chroma_h);
2165 outh[0] = outh[3] = h;
2166}
2167
2160static int config_output(AVFilterLink *outlink)2168static int config_output(AVFilterLink *outlink)
2161{2169{
2162 AVFilterContext *ctx = outlink->src;2170 AVFilterContext *ctx = outlink->src;
@@ -2264,15 +2272,8 @@ static int config_output(AVFilterLink *outlink) · 101 unmodified lines
2264 av_assert0(0);2272 av_assert0(0);
2265 }2273 }
2266 2274
2267 s->inplaneheight[1] = s->inplaneheight[2] = FF_CEIL_RSHIFT(h, desc->log2_chroma_h);2275 set_dimensions(s->inplanewidth, s->inplaneheight, w, h, desc);
2268 s->inplaneheight[0] = s->inplaneheight[3] = h;2276 set_dimensions(s->in_offset_w, s->in_offset_h, in_offset_w, in_offset_h, desc);
2269 s->inplanewidth[1] = s->inplanewidth[2] = FF_CEIL_RSHIFT(w, desc->log2_chroma_w);
2270 s->inplanewidth[0] = s->inplanewidth[3] = w;
2271
2272 s->in_offset_h[1] = s->in_offset_h[2] = FF_CEIL_RSHIFT(in_offset_h, desc->log2_chroma_h);
2273 s->in_offset_h[0] = s->in_offset_h[3] = in_offset_h;
2274 s->in_offset_w[1] = s->in_offset_w[2] = FF_CEIL_RSHIFT(in_offset_w, desc->log2_chroma_w);
2275 s->in_offset_w[0] = s->in_offset_w[3] = in_offset_w;
2276 2277
2277 switch (s->in) {2278 switch (s->in) {
2278 case EQUIRECTANGULAR:2279 case EQUIRECTANGULAR:
@@ -2419,10 +2420,7 @@ static int config_output(AVFilterLink *outlink) · 140 unmodified lines
2419 return err;2420 return err;
2420 }2421 }
2421 2422
2422 s->pr_height[1] = s->pr_height[2] = FF_CEIL_RSHIFT(h, desc->log2_chroma_h);2423 set_dimensions(s->pr_width, s->pr_height, w, h, desc);
2423 s->pr_height[0] = s->pr_height[3] = h;
2424 s->pr_width[1] = s->pr_width[2] = FF_CEIL_RSHIFT(w, desc->log2_chroma_w);
2425 s->pr_width[0] = s->pr_width[3] = w;
2426 2424
2427 switch (s->out_stereo) {2425 switch (s->out_stereo) {
2428 case STEREO_2D:2426 case STEREO_2D:
@@ -2442,15 +2440,8 @@ static int config_output(AVFilterLink *outlink) · 13 unmodified lines
2442 av_assert0(0);2440 av_assert0(0);
2443 }2441 }
2444 2442
2445 s->out_offset_h[1] = s->out_offset_h[2] = FF_CEIL_RSHIFT(out_offset_h, desc->log2_chroma_h);2443 set_dimensions(s->out_offset_w, s->out_offset_h, out_offset_w, out_offset_h, desc);
2446 s->out_offset_h[0] = s->out_offset_h[3] = out_offset_h;2444 set_dimensions(s->planewidth, s->planeheight, w, h, desc);
2447 s->out_offset_w[1] = s->out_offset_w[2] = FF_CEIL_RSHIFT(out_offset_w, desc->log2_chroma_w);
2448 s->out_offset_w[0] = s->out_offset_w[3] = out_offset_w;
2449
2450 s->planeheight[1] = s->planeheight[2] = FF_CEIL_RSHIFT(h, desc->log2_chroma_h);
2451 s->planeheight[0] = s->planeheight[3] = h;
2452 s->planewidth[1] = s->planewidth[2] = FF_CEIL_RSHIFT(w, desc->log2_chroma_w);
2453 s->planewidth[0] = s->planewidth[3] = w;
2454 2445
2455 for (int i = 0; i < 4; i++)2446 for (int i = 0; i < 4; i++)
2456 s->uv_linesize[i] = FFALIGN(s->pr_width[i], 8);2447 s->uv_linesize[i] = FFALIGN(s->pr_width[i], 8);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t