On Sun, Apr 19, 2015 at 06:15:48PM +0200, Timo Rothenpieler wrote: [...] > +#define SATURATE(val) (FFMAX(FFMIN((val), 1.0), 0.0)) > + > +static uint8_t do_colorkey_pixel(ColorkeyContext *ctx, uint8_t r, uint8_t g, > uint8_t b) > +{ > + float diff_r = r / 255.0 - ctx->cf[0]; > + float diff_g = g / 255.0 - ctx->cf[1]; > + float diff_b = b / 255.0 - ctx->cf[2]; > + > + float diff = sqrt(diff_r * diff_r + diff_g * diff_g + diff_b * diff_b); > + > + return SATURATE(FFMAX(diff - ctx->similarity, 0.0) / ctx->blend) * 255.0;
i suggest you factor the 255.0 out like in > +#define SATURATE(val) (FFMAX(FFMIN((val), 255.0), 0.0)) > + > +static uint8_t do_colorkey_pixel(ColorkeyContext *ctx, uint8_t r, uint8_t g, > uint8_t b) > +{ > + float diff_r = r - ctx->cf[0]; > + float diff_g = g - ctx->cf[1]; > + float diff_b = b - ctx->cf[2]; > + > + float diff = sqrt(diff_r * diff_r + diff_g * diff_g + diff_b * diff_b); > + > + return SATURATE(FFMAX(diff - ctx->similarity, 0.0) / ctx->blend); this changes the units of all the used "constants" [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The real ebay dictionary, page 3 "Rare item" - "Common item with rare defect or maybe just a lie" "Professional" - "'Toy' made in china, not functional except as doorstop" "Experts will know" - "The seller hopes you are not an expert"
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel