History

avfilter/vf_v360: refactor dimensions and offsets calculations

Paul B Mahol committed 7 years ago

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

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
21572157 s->v_fov += 360.f;
21582158 }
21592159
2160+static 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+
21602168 static int config_output(AVFilterLink *outlink)
21612169 {
21622170 AVFilterContext *ctx = outlink->src;
@@ -2264,15 +2272,8 @@ static int config_output(AVFilterLink *outlink) · 101 unmodified lines
22642272 av_assert0(0);
22652273 }
22662274
2267− s->inplaneheight[1] = s->inplaneheight[2] = FF_CEIL_RSHIFT(h, desc->log2_chroma_h);
2268− s->inplaneheight[0] = s->inplaneheight[3] = h;
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;
2275+ set_dimensions(s->inplanewidth, s->inplaneheight, w, h, desc);
2276+ set_dimensions(s->in_offset_w, s->in_offset_h, in_offset_w, in_offset_h, desc);
22762277
22772278 switch (s->in) {
22782279 case EQUIRECTANGULAR:
@@ -2419,10 +2420,7 @@ static int config_output(AVFilterLink *outlink) · 140 unmodified lines
24192420 return err;
24202421 }
24212422
2422− s->pr_height[1] = s->pr_height[2] = FF_CEIL_RSHIFT(h, desc->log2_chroma_h);
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;
2423+ set_dimensions(s->pr_width, s->pr_height, w, h, desc);
24262424
24272425 switch (s->out_stereo) {
24282426 case STEREO_2D:
@@ -2442,15 +2440,8 @@ static int config_output(AVFilterLink *outlink) · 13 unmodified lines
24422440 av_assert0(0);
24432441 }
24442442
2445− s->out_offset_h[1] = s->out_offset_h[2] = FF_CEIL_RSHIFT(out_offset_h, desc->log2_chroma_h);
2446− s->out_offset_h[0] = s->out_offset_h[3] = out_offset_h;
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;
2443+ set_dimensions(s->out_offset_w, s->out_offset_h, out_offset_w, out_offset_h, desc);
2444+ set_dimensions(s->planewidth, s->planeheight, w, h, desc);
24542445
24552446 for (int i = 0; i < 4; i++)
24562447 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