Message ID | 20161222234532.6880-1-jamrial@gmail.com |
---|---|
State | Accepted |
Commit | 41de965e31ef68baee1833da7fe3407fb192668b |
Headers | show |
Le duodi 2 nivôse, an CCXXV, James Almer a écrit : > Signed-off-by: James Almer <jamrial@gmail.com> > --- > libavcodec/pixlet.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/libavcodec/pixlet.c b/libavcodec/pixlet.c > index c5d37bb..c1bd321 100644 > --- a/libavcodec/pixlet.c > +++ b/libavcodec/pixlet.c > @@ -457,7 +457,7 @@ static void postprocess_luma(AVFrame *frame, int w, int h, int depth) > uint16_t *dsty = (uint16_t *)frame->data[0]; > int16_t *srcy = (int16_t *)frame->data[0]; > ptrdiff_t stridey = frame->linesize[0] / 2; > - const float factor = 1. / ((1 << depth) - 1); > + const float factor = 1.0f / ((1 << depth) - 1); Any reason, here and everywhere, to do it that way and not the other way around, i.e. change all floats to doubles? There are only a 32-cells array and a few local variables, so memory is not a concern. Regards,
On 12/23/16, Nicolas George <george@nsup.org> wrote: > Le duodi 2 nivôse, an CCXXV, James Almer a écrit : >> Signed-off-by: James Almer <jamrial@gmail.com> >> --- >> libavcodec/pixlet.c | 6 +++--- >> 1 file changed, 3 insertions(+), 3 deletions(-) >> >> diff --git a/libavcodec/pixlet.c b/libavcodec/pixlet.c >> index c5d37bb..c1bd321 100644 >> --- a/libavcodec/pixlet.c >> +++ b/libavcodec/pixlet.c >> @@ -457,7 +457,7 @@ static void postprocess_luma(AVFrame *frame, int w, >> int h, int depth) >> uint16_t *dsty = (uint16_t *)frame->data[0]; >> int16_t *srcy = (int16_t *)frame->data[0]; >> ptrdiff_t stridey = frame->linesize[0] / 2; >> - const float factor = 1. / ((1 << depth) - 1); >> + const float factor = 1.0f / ((1 << depth) - 1); > > Any reason, here and everywhere, to do it that way and not the other way > around, i.e. change all floats to doubles? There are only a 32-cells > array and a few local variables, so memory is not a concern. I found no difference, but using float could help more one day when someone write SIMD code.
Le tridi 3 nivôse, an CCXXV, Paul B Mahol a écrit : > I found no difference, but using float could help more one day when > someone write SIMD code. Ok, it was a reason to use floats that I did not know. Thanks. Regards,
On 12/23/16, James Almer <jamrial@gmail.com> wrote: > Signed-off-by: James Almer <jamrial@gmail.com> > --- > libavcodec/pixlet.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) applied
diff --git a/libavcodec/pixlet.c b/libavcodec/pixlet.c index c5d37bb..c1bd321 100644 --- a/libavcodec/pixlet.c +++ b/libavcodec/pixlet.c @@ -457,7 +457,7 @@ static void postprocess_luma(AVFrame *frame, int w, int h, int depth) uint16_t *dsty = (uint16_t *)frame->data[0]; int16_t *srcy = (int16_t *)frame->data[0]; ptrdiff_t stridey = frame->linesize[0] / 2; - const float factor = 1. / ((1 << depth) - 1); + const float factor = 1.0f / ((1 << depth) - 1); int i, j; for (j = 0; j < h; j++) { @@ -502,8 +502,8 @@ static int decode_plane(AVCodecContext *avctx, int plane, AVPacket *avpkt, AVFra int i, ret; for (i = ctx->levels - 1; i >= 0; i--) { - ctx->scaling[plane][H][i] = 1000000. / sign_extend(bytestream2_get_be32(&ctx->gb), 32); - ctx->scaling[plane][V][i] = 1000000. / sign_extend(bytestream2_get_be32(&ctx->gb), 32); + ctx->scaling[plane][H][i] = 1000000.0f / sign_extend(bytestream2_get_be32(&ctx->gb), 32); + ctx->scaling[plane][V][i] = 1000000.0f / sign_extend(bytestream2_get_be32(&ctx->gb), 32); } bytestream2_skip(&ctx->gb, 4);
Signed-off-by: James Almer <jamrial@gmail.com> --- libavcodec/pixlet.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)