History

lavfi/hflip: Support Bayer pixel formats.

Fixes part of ticket #8819.

Carl Eugen Hoyos committed 6 years ago

Commit b61376b1 parent 3092a533 files · +5 −1Browse files

Showing the changes to libavfilter (2 of 3 files). Show all

Unified · Split

2 files
  1. libavfilter/hflip.h +1 −0
  2. libavfilter/vf_hflip.c +3 −1
libavfilter/hflip.h+1−0
@@ -27,6 +27,7 @@ · 26 unmodified lines
2727 typedef struct FlipContext {
2828 const AVClass *class;
2929 int max_step[4]; ///< max pixel step for each plane, expressed as a number of bytes
30+ int bayer_plus1; ///< 1 .. not a Bayer input format, 2 .. Bayer input format
3031 int planewidth[4]; ///< width of each plane
3132 int planeheight[4]; ///< height of each plane
3233
libavfilter/vf_hflip.c+3−1
@@ -138,6 +138,7 @@ static int config_props(AVFilterLink *inlink) · 137 unmodified lines
138138 s->planewidth[1] = s->planewidth[2] = AV_CEIL_RSHIFT(inlink->w, hsub);
139139 s->planeheight[0] = s->planeheight[3] = inlink->h;
140140 s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, vsub);
141+ s->bayer_plus1 = !!(pix_desc->flags & AV_PIX_FMT_FLAG_BAYER) + 1;
141142
142143 nb_planes = av_pix_fmt_count_planes(inlink->format);
143144
@@ -149,6 +150,7 @@ int ff_hflip_init(FlipContext *s, int step[4], int nb_planes) · 5 unmodified lines
149150 int i;
150151
151152 for (i = 0; i < nb_planes; i++) {
153+ step[i] *= s->bayer_plus1;
152154 switch (step[i]) {
153155 case 1: s->flip_line[i] = hflip_byte_c; break;
154156 case 2: s->flip_line[i] = hflip_short_c; break;
@@ -180,7 +182,7 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int job, int nb_jobs) · 25 unmodified lines
180182 int i, plane, step;
181183
182184 for (plane = 0; plane < 4 && in->data[plane] && in->linesize[plane]; plane++) {
183− const int width = s->planewidth[plane];
185+ const int width = s->planewidth[plane] / s->bayer_plus1;
184186 const int height = s->planeheight[plane];
185187 const int start = (height * job ) / nb_jobs;
186188 const int end = (height * (job+1)) / nb_jobs;

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