History

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.

Limin Wang committed 6 years ago

Commit 49054fe1 parent c367d145 files · +24 −24Browse files

Showing the changes to libavfilter (1 of 5 files). Show all

Unified · Split

libavfilter/vf_colorbalance.c+12−12
@@ -188,9 +188,9 @@ static int color_balance8_p(AVFilterContext *ctx, void *arg, int jobnr, int nb_j · 187 unmodified lines
188 if (s->preserve_lightness)188 if (s->preserve_lightness)
189 preservel(&r, &g, &b, l);189 preservel(&r, &g, &b, l);
190 190
191 dstr[j] = av_clip_uint8(r * max);191 dstr[j] = av_clip_uint8(lrintf(r * max));
192 dstg[j] = av_clip_uint8(g * max);192 dstg[j] = av_clip_uint8(lrintf(g * max));
193 dstb[j] = av_clip_uint8(b * max);193 dstb[j] = av_clip_uint8(lrintf(b * max));
194 if (in != out && out->linesize[3])194 if (in != out && out->linesize[3])
195 dsta[j] = srca[j];195 dsta[j] = srca[j];
196 }196 }
@@ -242,9 +242,9 @@ static int color_balance16_p(AVFilterContext *ctx, void *arg, int jobnr, int nb_ · 45 unmodified lines
242 if (s->preserve_lightness)242 if (s->preserve_lightness)
243 preservel(&r, &g, &b, l);243 preservel(&r, &g, &b, l);
244 244
245 dstr[j] = av_clip_uintp2_c(r * max, depth);245 dstr[j] = av_clip_uintp2_c(lrintf(r * max), depth);
246 dstg[j] = av_clip_uintp2_c(g * max, depth);246 dstg[j] = av_clip_uintp2_c(lrintf(g * max), depth);
247 dstb[j] = av_clip_uintp2_c(b * max, depth);247 dstb[j] = av_clip_uintp2_c(lrintf(b * max), depth);
248 if (in != out && out->linesize[3])248 if (in != out && out->linesize[3])
249 dsta[j] = srca[j];249 dsta[j] = srca[j];
250 }250 }
@@ -299,9 +299,9 @@ static int color_balance8(AVFilterContext *ctx, void *arg, int jobnr, int nb_job · 48 unmodified lines
299 if (s->preserve_lightness)299 if (s->preserve_lightness)
300 preservel(&r, &g, &b, l);300 preservel(&r, &g, &b, l);
301 301
302 dst[j + roffset] = av_clip_uint8(r * max);302 dst[j + roffset] = av_clip_uint8(lrintf(r * max));
303 dst[j + goffset] = av_clip_uint8(g * max);303 dst[j + goffset] = av_clip_uint8(lrintf(g * max));
304 dst[j + boffset] = av_clip_uint8(b * max);304 dst[j + boffset] = av_clip_uint8(lrintf(b * max));
305 if (in != out && step == 4)305 if (in != out && step == 4)
306 dst[j + aoffset] = src[j + aoffset];306 dst[j + aoffset] = src[j + aoffset];
307 }307 }
@@ -351,9 +351,9 @@ static int color_balance16(AVFilterContext *ctx, void *arg, int jobnr, int nb_jo · 43 unmodified lines
351 if (s->preserve_lightness)351 if (s->preserve_lightness)
352 preservel(&r, &g, &b, l);352 preservel(&r, &g, &b, l);
353 353
354 dst[j + roffset] = av_clip_uintp2_c(r * max, depth);354 dst[j + roffset] = av_clip_uintp2_c(lrintf(r * max), depth);
355 dst[j + goffset] = av_clip_uintp2_c(g * max, depth);355 dst[j + goffset] = av_clip_uintp2_c(lrintf(g * max), depth);
356 dst[j + boffset] = av_clip_uintp2_c(b * max, depth);356 dst[j + boffset] = av_clip_uintp2_c(lrintf(b * max), depth);
357 if (in != out && step == 4)357 if (in != out && step == 4)
358 dst[j + aoffset] = src[j + aoffset];358 dst[j + aoffset] = src[j + aoffset];
359 }359 }

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