summaryrefslogtreecommitdiffstats
path: root/libavfilter/vf_fade.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-05-24 17:34:36 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-05-24 17:47:02 +0200
commitbca59d7745e4fa4ed5444da959d6b487cd14e994 (patch)
treece820659bb16417a8b39aee4df3fd947020290b6 /libavfilter/vf_fade.c
parent1d08e4b584cc8a12fa4b63bc13829f1e6d4f2e55 (diff)
downloadffmpeg-streaming-bca59d7745e4fa4ed5444da959d6b487cd14e994.zip
ffmpeg-streaming-bca59d7745e4fa4ed5444da959d6b487cd14e994.tar.gz
fade: fix slice sizes
This more evenly distributes the load between threads This also fixes the chroma filtering where the filter was applied twice Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/vf_fade.c')
-rw-r--r--libavfilter/vf_fade.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/libavfilter/vf_fade.c b/libavfilter/vf_fade.c
index 60a690b..5bdec11 100644
--- a/libavfilter/vf_fade.c
+++ b/libavfilter/vf_fade.c
@@ -163,9 +163,8 @@ static int filter_slice_luma(AVFilterContext *ctx, void *arg, int jobnr,
{
FadeContext *s = ctx->priv;
AVFrame *frame = arg;
- int slice_h = frame->height / nb_jobs;
- int slice_start = jobnr * slice_h;
- int slice_end = (jobnr == nb_jobs - 1) ? frame->height : (jobnr + 1) * slice_h;
+ int slice_start = (frame->height * jobnr ) / nb_jobs;
+ int slice_end = (frame->height * (jobnr+1)) / nb_jobs;
int i, j;
for (i = slice_start; i < slice_end; i++) {
@@ -187,15 +186,15 @@ static int filter_slice_chroma(AVFilterContext *ctx, void *arg, int jobnr,
{
FadeContext *s = ctx->priv;
AVFrame *frame = arg;
- int slice_h = FFALIGN(frame->height / nb_jobs, 1 << s->vsub);
- int slice_start = jobnr * slice_h;
- int slice_end = (jobnr == nb_jobs - 1) ? frame->height : (jobnr + 1) * slice_h;
int i, j, plane;
const int width = FF_CEIL_RSHIFT(frame->width, s->hsub);
+ const int height= FF_CEIL_RSHIFT(frame->height, s->vsub);
+ int slice_start = (height * jobnr ) / nb_jobs;
+ int slice_end = (height * (jobnr+1)) / nb_jobs;
for (plane = 1; plane < 3; plane++) {
for (i = slice_start; i < slice_end; i++) {
- uint8_t *p = frame->data[plane] + (i >> s->vsub) * frame->linesize[plane];
+ uint8_t *p = frame->data[plane] + i * frame->linesize[plane];
for (j = 0; j < width; j++) {
/* 8421367 = ((128 << 1) + 1) << 15. It is an integer
* representation of 128.5. The .5 is for rounding
OpenPOWER on IntegriCloud