mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2024-12-26 01:02:33 +00:00
FATE: fix colorbalance fate test failed on x86_32
floating point precision will cause rgb*max generate different value on x86_32 and x86_64. have pass fate test on x86_32 and x86_64 by using lrintf to get the nearest integral value for rgb * max before av_clip. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
This commit is contained in:
parent
c367d14d0a
commit
49054fe94c
@ -188,9 +188,9 @@ static int color_balance8_p(AVFilterContext *ctx, void *arg, int jobnr, int nb_j
|
|||||||
if (s->preserve_lightness)
|
if (s->preserve_lightness)
|
||||||
preservel(&r, &g, &b, l);
|
preservel(&r, &g, &b, l);
|
||||||
|
|
||||||
dstr[j] = av_clip_uint8(r * max);
|
dstr[j] = av_clip_uint8(lrintf(r * max));
|
||||||
dstg[j] = av_clip_uint8(g * max);
|
dstg[j] = av_clip_uint8(lrintf(g * max));
|
||||||
dstb[j] = av_clip_uint8(b * max);
|
dstb[j] = av_clip_uint8(lrintf(b * max));
|
||||||
if (in != out && out->linesize[3])
|
if (in != out && out->linesize[3])
|
||||||
dsta[j] = srca[j];
|
dsta[j] = srca[j];
|
||||||
}
|
}
|
||||||
@ -242,9 +242,9 @@ static int color_balance16_p(AVFilterContext *ctx, void *arg, int jobnr, int nb_
|
|||||||
if (s->preserve_lightness)
|
if (s->preserve_lightness)
|
||||||
preservel(&r, &g, &b, l);
|
preservel(&r, &g, &b, l);
|
||||||
|
|
||||||
dstr[j] = av_clip_uintp2_c(r * max, depth);
|
dstr[j] = av_clip_uintp2_c(lrintf(r * max), depth);
|
||||||
dstg[j] = av_clip_uintp2_c(g * max, depth);
|
dstg[j] = av_clip_uintp2_c(lrintf(g * max), depth);
|
||||||
dstb[j] = av_clip_uintp2_c(b * max, depth);
|
dstb[j] = av_clip_uintp2_c(lrintf(b * max), depth);
|
||||||
if (in != out && out->linesize[3])
|
if (in != out && out->linesize[3])
|
||||||
dsta[j] = srca[j];
|
dsta[j] = srca[j];
|
||||||
}
|
}
|
||||||
@ -299,9 +299,9 @@ static int color_balance8(AVFilterContext *ctx, void *arg, int jobnr, int nb_job
|
|||||||
if (s->preserve_lightness)
|
if (s->preserve_lightness)
|
||||||
preservel(&r, &g, &b, l);
|
preservel(&r, &g, &b, l);
|
||||||
|
|
||||||
dst[j + roffset] = av_clip_uint8(r * max);
|
dst[j + roffset] = av_clip_uint8(lrintf(r * max));
|
||||||
dst[j + goffset] = av_clip_uint8(g * max);
|
dst[j + goffset] = av_clip_uint8(lrintf(g * max));
|
||||||
dst[j + boffset] = av_clip_uint8(b * max);
|
dst[j + boffset] = av_clip_uint8(lrintf(b * max));
|
||||||
if (in != out && step == 4)
|
if (in != out && step == 4)
|
||||||
dst[j + aoffset] = src[j + aoffset];
|
dst[j + aoffset] = src[j + aoffset];
|
||||||
}
|
}
|
||||||
@ -351,9 +351,9 @@ static int color_balance16(AVFilterContext *ctx, void *arg, int jobnr, int nb_jo
|
|||||||
if (s->preserve_lightness)
|
if (s->preserve_lightness)
|
||||||
preservel(&r, &g, &b, l);
|
preservel(&r, &g, &b, l);
|
||||||
|
|
||||||
dst[j + roffset] = av_clip_uintp2_c(r * max, depth);
|
dst[j + roffset] = av_clip_uintp2_c(lrintf(r * max), depth);
|
||||||
dst[j + goffset] = av_clip_uintp2_c(g * max, depth);
|
dst[j + goffset] = av_clip_uintp2_c(lrintf(g * max), depth);
|
||||||
dst[j + boffset] = av_clip_uintp2_c(b * max, depth);
|
dst[j + boffset] = av_clip_uintp2_c(lrintf(b * max), depth);
|
||||||
if (in != out && step == 4)
|
if (in != out && step == 4)
|
||||||
dst[j + aoffset] = src[j + aoffset];
|
dst[j + aoffset] = src[j + aoffset];
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
#codec_id 0: rawvideo
|
#codec_id 0: rawvideo
|
||||||
#dimensions 0: 352x288
|
#dimensions 0: 352x288
|
||||||
#sar 0: 0/1
|
#sar 0: 0/1
|
||||||
0, 0, 0, 1, 304128, 0xd50c9fea
|
0, 0, 0, 1, 304128, 0xf68fadfd
|
||||||
0, 1, 1, 1, 304128, 0xdf9e1f79
|
0, 1, 1, 1, 304128, 0xa6302d9a
|
||||||
0, 2, 2, 1, 304128, 0x9b84087e
|
0, 2, 2, 1, 304128, 0x758d165a
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
#codec_id 0: rawvideo
|
#codec_id 0: rawvideo
|
||||||
#dimensions 0: 352x288
|
#dimensions 0: 352x288
|
||||||
#sar 0: 0/1
|
#sar 0: 0/1
|
||||||
0, 0, 0, 1, 405504, 0xd33217e5
|
0, 0, 0, 1, 405504, 0xdcc71df0
|
||||||
0, 1, 1, 1, 405504, 0x08f161af
|
0, 1, 1, 1, 405504, 0x48d56675
|
||||||
0, 2, 2, 1, 405504, 0x27508654
|
0, 2, 2, 1, 405504, 0x68058bf0
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
#codec_id 0: rawvideo
|
#codec_id 0: rawvideo
|
||||||
#dimensions 0: 352x288
|
#dimensions 0: 352x288
|
||||||
#sar 0: 0/1
|
#sar 0: 0/1
|
||||||
0, 0, 0, 1, 405504, 0x2e44c4b0
|
0, 0, 0, 1, 405504, 0xa497ca1b
|
||||||
0, 1, 1, 1, 405504, 0xf47244e0
|
0, 1, 1, 1, 405504, 0x92c24b0e
|
||||||
0, 2, 2, 1, 405504, 0x040769dd
|
0, 2, 2, 1, 405504, 0x965270bd
|
||||||
|
@ -3,6 +3,6 @@
|
|||||||
#codec_id 0: rawvideo
|
#codec_id 0: rawvideo
|
||||||
#dimensions 0: 352x288
|
#dimensions 0: 352x288
|
||||||
#sar 0: 0/1
|
#sar 0: 0/1
|
||||||
0, 0, 0, 1, 811008, 0x42e5db8b
|
0, 0, 0, 1, 811008, 0xc5f7e6ba
|
||||||
0, 1, 1, 1, 811008, 0x31be5974
|
0, 1, 1, 1, 811008, 0x266955bf
|
||||||
0, 2, 2, 1, 811008, 0xdef21287
|
0, 2, 2, 1, 811008, 0x55360c6e
|
||||||
|
Loading…
Reference in New Issue
Block a user