Skip to content

Commit a69a0b6

Browse files
committed
avfilter/blend: put slice parameters to a single struct
This should make future extensibility easier. Signed-off-by: Marton Balint <[email protected]>
1 parent 77fc047 commit a69a0b6

File tree

5 files changed

+15
-7
lines changed

5 files changed

+15
-7
lines changed

libavfilter/blend.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ enum BlendMode {
6969
BLEND_NB
7070
};
7171

72+
typedef struct SliceParams {
73+
double *values;
74+
int starty;
75+
} SliceParams;
76+
7277
typedef struct FilterParams {
7378
enum BlendMode mode;
7479
double opacity;
@@ -78,7 +83,7 @@ typedef struct FilterParams {
7883
const uint8_t *bottom, ptrdiff_t bottom_linesize,
7984
uint8_t *dst, ptrdiff_t dst_linesize,
8085
ptrdiff_t width, ptrdiff_t height,
81-
struct FilterParams *param, double *values, int starty);
86+
struct FilterParams *param, SliceParams *sliceparam);
8287
} FilterParams;
8388

8489
void ff_blend_init_x86(FilterParams *param, int depth);

libavfilter/blend_modes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static void fn0(NAME)(const uint8_t *_top, ptrdiff_t top_linesize, \
9191
const uint8_t *_bottom, ptrdiff_t bottom_linesize, \
9292
uint8_t *_dst, ptrdiff_t dst_linesize, \
9393
ptrdiff_t width, ptrdiff_t height, \
94-
FilterParams *param, double *values, int starty) \
94+
FilterParams *param, SliceParams *sliceparam) \
9595
{ \
9696
const PIXEL *top = (const PIXEL *)_top; \
9797
const PIXEL *bottom = (const PIXEL *)_bottom; \

libavfilter/vf_blend.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,12 @@ static void blend_expr_## name(const uint8_t *_top, ptrdiff_t top_linesize,
132132
const uint8_t *_bottom, ptrdiff_t bottom_linesize, \
133133
uint8_t *_dst, ptrdiff_t dst_linesize, \
134134
ptrdiff_t width, ptrdiff_t height, \
135-
FilterParams *param, double *values, int starty) \
135+
FilterParams *param, SliceParams *sliceparam) \
136136
{ \
137137
const type *top = (const type*)_top; \
138138
const type *bottom = (const type*)_bottom; \
139+
double *values = sliceparam->values; \
140+
int starty = sliceparam->starty; \
139141
type *dst = (type*)_dst; \
140142
AVExpr *e = param->e; \
141143
int y, x; \
@@ -171,6 +173,7 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
171173
const uint8_t *bottom = td->bottom->data[td->plane];
172174
uint8_t *dst = td->dst->data[td->plane];
173175
double values[VAR_VARS_NB];
176+
SliceParams sliceparam = {.values = &values[0], .starty = slice_start};
174177

175178
values[VAR_N] = td->inlink->frame_count_out;
176179
values[VAR_T] = td->dst->pts == AV_NOPTS_VALUE ? NAN : td->dst->pts * av_q2d(td->inlink->time_base);
@@ -185,7 +188,7 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
185188
td->bottom->linesize[td->plane],
186189
dst + slice_start * td->dst->linesize[td->plane],
187190
td->dst->linesize[td->plane],
188-
td->w, height, td->param, &values[0], slice_start);
191+
td->w, height, td->param, &sliceparam);
189192
return 0;
190193
}
191194

libavfilter/vf_blend_init.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static void blend_copy ## src##_##depth(const uint8_t *top, ptrdiff_t top_linesi
5858
const uint8_t *bottom, ptrdiff_t bottom_linesize,\
5959
uint8_t *dst, ptrdiff_t dst_linesize, \
6060
ptrdiff_t width, ptrdiff_t height, \
61-
FilterParams *param, double *values, int starty) \
61+
FilterParams *param, SliceParams *sliceparam) \
6262
{ \
6363
av_image_copy_plane(dst, dst_linesize, src, src ## _linesize, \
6464
width * depth / 8, height); \
@@ -80,7 +80,7 @@ static void blend_normal_##name(const uint8_t *_top, ptrdiff_t top_linesize,
8080
const uint8_t *_bottom, ptrdiff_t bottom_linesize,\
8181
uint8_t *_dst, ptrdiff_t dst_linesize, \
8282
ptrdiff_t width, ptrdiff_t height, \
83-
FilterParams *param, double *values, int starty) \
83+
FilterParams *param, SliceParams *sliceparam) \
8484
{ \
8585
const type *top = (const type*)_top; \
8686
const type *bottom = (const type*)_bottom; \

libavfilter/x86/vf_blend_init.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ void ff_blend_##name##_##opt(const uint8_t *top, ptrdiff_t top_linesize, \
2828
const uint8_t *bottom, ptrdiff_t bottom_linesize, \
2929
uint8_t *dst, ptrdiff_t dst_linesize, \
3030
ptrdiff_t width, ptrdiff_t height, \
31-
struct FilterParams *param, double *values, int starty);
31+
FilterParams *param, SliceParams *sliceparam);
3232

3333
BLEND_FUNC(addition, sse2)
3434
BLEND_FUNC(addition, avx2)

0 commit comments

Comments
 (0)