[PATCH] Add a gamma flag to exr loader to avoid banding
Attached is a patch to add a gamma flag to the exr loader. This is needed to avoid banding artifacts when gammaing the picture. Currently, if done with a video filter, the process is done on uints instead of full float.
On Sun, Apr 27, 2014 at 10:43:09AM -0300, Gonzalo Garramuno wrote:
Attached is a patch to add a gamma flag to the exr loader. This is needed to avoid banding artifacts when gammaing the picture. Currently, if done with a video filter, the process is done on uints instead of full float.
Changelog | 1 libavcodec/exr.c | 138 ++++++++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 117 insertions(+), 22 deletions(-) 828c54dedd21b004de00e049b4fa4b2f72ae78b1 exr_gamma.patch diff --git a/Changelog b/Changelog index daaa1ea..a726823 100644 --- a/Changelog +++ b/Changelog @@ -2,6 +2,7 @@ Entries are sorted chronologically from oldest to youngest within each release, releases are sorted from youngest to oldest.
version <next>: +- EXR loader supports a gamma flag - AC3 fixed-point decoding - shuffleplanes filter - subfile protocol diff --git a/libavcodec/exr.c b/libavcodec/exr.c index 084025a..8c2425c 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -31,6 +31,7 @@ */
#include <zlib.h> +#include <float.h>
#include "libavutil/imgutils.h" #include "libavutil/opt.h" @@ -106,8 +107,30 @@ typedef struct EXRContext { EXRThreadData *thread_data;
const char *layer; + + float gamma; + } EXRContext;
+union FP32 { + uint32_t u; + float f; + struct { + unsigned int Mantissa : 23; + unsigned int Exponent : 8; + unsigned int Sign : 1; + }; +} FP32; + +union FP16 { + uint16_t u; + struct { + unsigned int Mantissa : 10; + unsigned int Exponent : 5; + unsigned int Sign : 1; + }; +} FP16;
that way to access parts of a float is not portable see libavutil/intfloat.h [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The misfortune of the wise is better than the prosperity of the fool. -- Epicurus
On Sun, Apr 27, 2014 at 06:04:33PM +0200, Michael Niedermayer wrote:
On Sun, Apr 27, 2014 at 10:43:09AM -0300, Gonzalo Garramuno wrote:
Attached is a patch to add a gamma flag to the exr loader. This is needed to avoid banding artifacts when gammaing the picture. Currently, if done with a video filter, the process is done on uints instead of full float.
Changelog | 1 libavcodec/exr.c | 138 ++++++++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 117 insertions(+), 22 deletions(-) 828c54dedd21b004de00e049b4fa4b2f72ae78b1 exr_gamma.patch diff --git a/Changelog b/Changelog index daaa1ea..a726823 100644 --- a/Changelog +++ b/Changelog @@ -2,6 +2,7 @@ Entries are sorted chronologically from oldest to youngest within each release, releases are sorted from youngest to oldest.
version <next>: +- EXR loader supports a gamma flag - AC3 fixed-point decoding - shuffleplanes filter - subfile protocol diff --git a/libavcodec/exr.c b/libavcodec/exr.c index 084025a..8c2425c 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -31,6 +31,7 @@ */
#include <zlib.h> +#include <float.h>
#include "libavutil/imgutils.h" #include "libavutil/opt.h" @@ -106,8 +107,30 @@ typedef struct EXRContext { EXRThreadData *thread_data;
const char *layer; + + float gamma; + } EXRContext;
+union FP32 { + uint32_t u; + float f; + struct { + unsigned int Mantissa : 23; + unsigned int Exponent : 8; + unsigned int Sign : 1; + }; +} FP32; + +union FP16 { + uint16_t u; + struct { + unsigned int Mantissa : 10; + unsigned int Exponent : 5; + unsigned int Sign : 1; + }; +} FP16;
that way to access parts of a float is not portable
see libavutil/intfloat.h
or for 16bit floats you could simply use a LUT [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Democracy is the form of government in which you can choose your dictator
On 27/04/14 13:12, Michael Niedermayer wrote:
On Sun, Apr 27, 2014 at 06:04:33PM +0200, Michael Niedermayer wrote:
Attached is a patch to add a gamma flag to the exr loader. This is needed to avoid banding artifacts when gammaing the picture. Currently, if done with a video filter, the process is done on uints instead of full float. Changelog | 1 libavcodec/exr.c | 138 ++++++++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 117 insertions(+), 22 deletions(-) 828c54dedd21b004de00e049b4fa4b2f72ae78b1 exr_gamma.patch diff --git a/Changelog b/Changelog index daaa1ea..a726823 100644 --- a/Changelog +++ b/Changelog @@ -2,6 +2,7 @@ Entries are sorted chronologically from oldest to youngest within each release, releases are sorted from youngest to oldest.
version <next>: +- EXR loader supports a gamma flag - AC3 fixed-point decoding - shuffleplanes filter - subfile protocol diff --git a/libavcodec/exr.c b/libavcodec/exr.c index 084025a..8c2425c 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -31,6 +31,7 @@ */
#include <zlib.h> +#include <float.h>
#include "libavutil/imgutils.h" #include "libavutil/opt.h" @@ -106,8 +107,30 @@ typedef struct EXRContext { EXRThreadData *thread_data;
const char *layer; + + float gamma; + } EXRContext;
+union FP32 { + uint32_t u; + float f; + struct { + unsigned int Mantissa : 23; + unsigned int Exponent : 8; + unsigned int Sign : 1; + }; +} FP32; + +union FP16 { + uint16_t u; + struct { + unsigned int Mantissa : 10; + unsigned int Exponent : 5; + unsigned int Sign : 1; + }; +} FP16;
On Sun, Apr 27, 2014 at 10:43:09AM -0300, Gonzalo Garramuno wrote: that way to access parts of a float is not portable
see libavutil/intfloat.h
In what way is not portable? The bits in the struct?
or for 16bit floats you could simply use a LUT
[...]
I am following the blog at: http://fgiesen.wordpress.com/2012/03/28/half-to-float-done-quic/ In there, there are several ways to convert a half to a float. The smallest one is the following (and does not rely on bits): staticFP32half_to_float_fast5(FP16h) { staticconstFP32magic={(254-15)<<23}; staticconstFP32was_infnan={(127+16)<<23}; FP32o; o.u=(h.u&0x7fff)<<13;// exponent/mantissa bits o.f*=magic.f;// exponent adjust if(o.f>=was_infnan.f)// make sure Inf/NaN survive o.u|=255<<23; o.u|=(h.u&0x8000)<<16;// sign bit returno; } Would that be acceptable?
On Sun, Apr 27, 2014 at 01:28:15PM -0300, Gonzalo Garramuno wrote:
On 27/04/14 13:12, Michael Niedermayer wrote:
On Sun, Apr 27, 2014 at 06:04:33PM +0200, Michael Niedermayer wrote:
Attached is a patch to add a gamma flag to the exr loader. This is needed to avoid banding artifacts when gammaing the picture. Currently, if done with a video filter, the process is done on uints instead of full float. Changelog | 1 libavcodec/exr.c | 138 ++++++++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 117 insertions(+), 22 deletions(-) 828c54dedd21b004de00e049b4fa4b2f72ae78b1 exr_gamma.patch diff --git a/Changelog b/Changelog index daaa1ea..a726823 100644 --- a/Changelog +++ b/Changelog @@ -2,6 +2,7 @@ Entries are sorted chronologically from oldest to youngest within each release, releases are sorted from youngest to oldest. version <next>: +- EXR loader supports a gamma flag - AC3 fixed-point decoding - shuffleplanes filter - subfile protocol diff --git a/libavcodec/exr.c b/libavcodec/exr.c index 084025a..8c2425c 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -31,6 +31,7 @@ */ #include <zlib.h> +#include <float.h> #include "libavutil/imgutils.h" #include "libavutil/opt.h" @@ -106,8 +107,30 @@ typedef struct EXRContext { EXRThreadData *thread_data; const char *layer; + + float gamma; + } EXRContext; +union FP32 { + uint32_t u; + float f; + struct { + unsigned int Mantissa : 23; + unsigned int Exponent : 8; + unsigned int Sign : 1; + }; +} FP32; + +union FP16 { + uint16_t u; + struct { + unsigned int Mantissa : 10; + unsigned int Exponent : 5; + unsigned int Sign : 1; + }; +} FP16;
On Sun, Apr 27, 2014 at 10:43:09AM -0300, Gonzalo Garramuno wrote: that way to access parts of a float is not portable
see libavutil/intfloat.h
In what way is not portable? The bits in the struct?
yes
or for 16bit floats you could simply use a LUT
[...]
I am following the blog at:
http://fgiesen.wordpress.com/2012/03/28/half-to-float-done-quic/
In there, there are several ways to convert a half to a float. The smallest one is the following (and does not rely on bits):
staticFP32half_to_float_fast5(FP16h) { staticconstFP32magic={(254-15)<<23}; staticconstFP32was_infnan={(127+16)<<23}; FP32o; o.u=(h.u&0x7fff)<<13;// exponent/mantissa bits o.f*=magic.f;// exponent adjust if(o.f>=was_infnan.f)// make sure Inf/NaN survive o.u|=255<<23; o.u|=(h.u&0x8000)<<16;// sign bit returno; }
Would that be acceptable?
you can do the gamma correction in the LUT for 16bit too [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Frequently ignored answer#1 FFmpeg bugs should be sent to our bugtracker. User questions about the command line tools should be sent to the ffmpeg-user ML. And questions about how to use libav* should be sent to the libav-user ML.
Attached is a new patch that uses av_intfloat32 and avoids the bits in the struct to do the half to float conversion. There isn't any table lookup used, as I don't think that would improve the speed much.
On 27/04/14 13:48, Michael Niedermayer wrote:
On Sun, Apr 27, 2014 at 01:28:15PM -0300, Gonzalo Garramuno wrote:
you can do the gamma correction in the LUT for 16bit too
[...]
Good idea. And here it is. The gamma table for the half float path. Now hopefully the powers that be accept the patch.
On Sun, Apr 27, 2014 at 07:39:57PM -0300, Gonzalo Garramuno wrote:
On 27/04/14 13:48, Michael Niedermayer wrote:
On Sun, Apr 27, 2014 at 01:28:15PM -0300, Gonzalo Garramuno wrote:
you can do the gamma correction in the LUT for 16bit too
[...]
Good idea. And here it is. The gamma table for the half float path. Now hopefully the powers that be accept the patch.
diff --git a/Changelog b/Changelog index daaa1ea..a726823 100644 --- a/Changelog +++ b/Changelog @@ -2,6 +2,7 @@ Entries are sorted chronologically from oldest to youngest within each release, releases are sorted from youngest to oldest.
version <next>: +- EXR loader supports a gamma flag
"Entries are sorted chronologically from oldest to youngest"
- AC3 fixed-point decoding - shuffleplanes filter - subfile protocol diff --git a/libavcodec/exr.c b/libavcodec/exr.c index 084025a..55313f4 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -31,9 +31,11 @@ */
#include <zlib.h> +#include <float.h>
#include "libavutil/imgutils.h" #include "libavutil/opt.h" +#include "libavutil/intfloat.h"
#include "avcodec.h" #include "bytestream.h" @@ -77,6 +79,7 @@ typedef struct EXRThreadData { uint16_t *lut; } EXRThreadData;
+ typedef struct EXRContext { AVClass *class; AVFrame *picture; @@ -106,8 +109,14 @@ typedef struct EXRContext { EXRThreadData *thread_data;
const char *layer; + + float gamma; + + uint16_t gamma_table[32767]; + } EXRContext;
+ /** * Convert from 32-bit float as uint32_t to uint16_t. * @@ -128,6 +137,23 @@ static inline uint16_t exr_flt2uint(uint32_t v) return (v + (1 << 23)) >> (127 + 7 - exp); }
+/* + Safely convert a half float to a full float + */ +static inline union av_intfloat32 half_to_float_full(uint16_t h) +{ + static const union av_intfloat32 magic = { (254 - 15) << 23 }; + static const union av_intfloat32 was_infnan = { (127 + 16) << 23 }; + union av_intfloat32 o; + + o.i = (h & 0x7fff) << 13; // exponent/mantissa bits + o.f *= magic.f; // exponent adjust + if (o.f >= was_infnan.f) // make sure Inf/NaN survive + o.i |= 255 << 23; + o.i |= (h & 0x8000) << 16; // sign bit + return o; +} + /** * Convert from 16-bit float as uint16_t to uint16_t. * @@ -772,6 +798,7 @@ static int decode_block(AVCodecContext *avctx, void *tdata, int bxmin = s->xmin * 2 * s->desc->nb_components; int i, x, buf_size = s->buf_size; int ret; + float one_gamma = 1.0f / s->gamma;
line_offset = AV_RL64(s->gb.buffer + jobnr * 8); // Check if the buffer has the required bytes needed from the offset @@ -851,31 +878,40 @@ static int decode_block(AVCodecContext *avctx, void *tdata, if (s->pixel_type == EXR_FLOAT) { // 32-bit for (x = 0; x < xdelta; x++) { - *ptr_x++ = exr_flt2uint(bytestream_get_le32(&r)); - *ptr_x++ = exr_flt2uint(bytestream_get_le32(&g)); - *ptr_x++ = exr_flt2uint(bytestream_get_le32(&b)); + union av_intfloat32 t; + t.i = bytestream_get_le32(&r);; + t.f = powf(t.f, one_gamma); + *ptr_x++ = exr_flt2uint(t.i); + + t.i = bytestream_get_le32(&g); + t.f = powf(t.f, one_gamma); + *ptr_x++ = exr_flt2uint(t.i); + + t.i = bytestream_get_le32(&b); + t.f = powf(t.f, one_gamma); + *ptr_x++ = exr_flt2uint(t.i); if (channel_buffer[3]) *ptr_x++ = exr_flt2uint(bytestream_get_le32(&a)); } - } else { - // 16-bit - for (x = 0; x < xdelta; x++) { - *ptr_x++ = exr_halflt2uint(bytestream_get_le16(&r)); - *ptr_x++ = exr_halflt2uint(bytestream_get_le16(&g)); - *ptr_x++ = exr_halflt2uint(bytestream_get_le16(&b)); - if (channel_buffer[3]) - *ptr_x++ = exr_halflt2uint(bytestream_get_le16(&a)); - } - } - - // Zero out the end if xmax+1 is not w - memset(ptr_x, 0, axmax); - - channel_buffer[0] += s->scan_line_size; - channel_buffer[1] += s->scan_line_size; - channel_buffer[2] += s->scan_line_size; - if (channel_buffer[3]) - channel_buffer[3] += s->scan_line_size; + } else { + // 16-bit + for (x = 0; x < xdelta; x++) { + *ptr_x++ = s->gamma_table[bytestream_get_le16(&r)]; + *ptr_x++ = s->gamma_table[bytestream_get_le16(&g)]; + *ptr_x++ = s->gamma_table[bytestream_get_le16(&b)]; + if (channel_buffer[3]) + *ptr_x++ = exr_halflt2uint(bytestream_get_le16(&a)); + } + } + + // Zero out the end if xmax+1 is not w + memset(ptr_x, 0, axmax); + + channel_buffer[0] += s->scan_line_size; + channel_buffer[1] += s->scan_line_size; + channel_buffer[2] += s->scan_line_size; + if (channel_buffer[3]) + channel_buffer[3] += s->scan_line_size; }
return 0; @@ -1261,7 +1297,11 @@ static int decode_frame(AVCodecContext *avctx, void *data,
static av_cold int decode_init(AVCodecContext *avctx) { + uint16_t i; + union av_intfloat32 t; EXRContext *s = avctx->priv_data; + float one_gamma = 1.0f / s->gamma; + av_log(avctx, AV_LOG_INFO, "gamma %f.\n", s->gamma);
s->avctx = avctx; s->xmin = ~0; @@ -1280,6 +1320,13 @@ static av_cold int decode_init(AVCodecContext *avctx) s->w = 0; s->h = 0;
+ for ( i = 0; i < 32767; ++i ) + {
style: "for (i = 0; i < 32767; i++) {"
+ t = half_to_float_full(i); + t.f = powf(t.f,one_gamma);
+ s->gamma_table[i] = exr_flt2uint( t.i );
trailing whitespace, style, and indent
+ } + // allocate thread data, used for non EXR_RAW compreesion types s->thread_data = av_mallocz_array(avctx->thread_count, sizeof(EXRThreadData)); if (!s->thread_data) @@ -1322,6 +1369,8 @@ static av_cold int decode_end(AVCodecContext *avctx) static const AVOption options[] = { { "layer", "Set the decoding layer", OFFSET(layer), AV_OPT_TYPE_STRING, { .str = "" }, 0, 0, VD }, + { "gamma", "Set the float gamma value when decoding", OFFSET(gamma), + AV_OPT_TYPE_FLOAT, { .dbl = 2.2 }, 0.001, FLT_MAX, VD }, { NULL }, };
-- Clément B.
Here it is with the formatting changes. BTW, patcheck seems not to work for me or report any errors even when there are indentention errors. $ tools/patcheck libavcodec/exr.c patCHeck 1e10.0 This tool is intended to help a human check/review patches. It is very far from being free of false positives and negatives, and its output are just hints of what may or may not be bad. When you use it and it misses something or detects something wrong, fix it and send a patch to the ffmpeg-devel mailing list. License: GPL, Author: Michael Niedermayer Missing changelog entry (ignore if minor change)
Sorry for the latest patch. Was using the wrong table index. Here is the correction.
Never mind the noise. I realized I had to run patcheck against the patch not the original file. Here's an updated patch with all warnings eliminated but one which I don't know how.
Ping. Just checking if the patch will be (pretty please) accepted or not.
On Mon, Apr 28, 2014 at 11:43:16AM -0300, Gonzalo Garramuno wrote:
Ping. Just checking if the patch will be (pretty please) accepted or not.
patience First it seems to still have a bug it fails fate --- ./tests/ref/fate/exr-slice-raw 2014-04-28 04:14:37.849375679 +0200 +++ tests/data/fate/exr-slice-raw 2014-04-28 19:50:27.430558597 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x6a356d0d +0, 0, 0, 1, 3169800, 0x2cfefd25 Second, some people seem to dislike it, and some (me and you at least) seem to think its ok until full float pixel format support exists. theres noone listed in MAINTAINERs for exr does anyone volunteer to maintain exr ? if no and noone is strongly against then ill apply this patch once it works but not before 3 days. if someone volunteers as maintainer for exr then its his decission iam also CCing the author of the exr code and paul who was actively working on exr, maybe either of them want to maintain the code or have comments Thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Dictatorship naturally arises out of democracy, and the most aggravated form of tyranny and slavery out of the most extreme liberty. -- Plato
Ping. Just checking if the patch will be (pretty please) accepted or not.
On Mon, Apr 28, 2014 at 11:43:16AM -0300, Gonzalo Garramuno wrote: patience
First it seems to still have a bug it fails fate --- ./tests/ref/fate/exr-slice-raw 2014-04-28 04:14:37.849375679 +0200 +++ tests/data/fate/exr-slice-raw 2014-04-28 19:50:27.430558597 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x6a356d0d +0, 0, 0, 1, 3169800, 0x2cfefd25 How can I reproduce the test? I don't know how fate works and my tests
On 28/04/14 14:59, Michael Niedermayer wrote: dir has no exr-slice-raw. Is it failing on the sign bit for 0 or is it failing somewhere else?
On Mon, Apr 28, 2014 at 03:31:19PM -0300, Gonzalo Garramuno wrote:
On 28/04/14 14:59, Michael Niedermayer wrote:
Ping. Just checking if the patch will be (pretty please) accepted or not.
On Mon, Apr 28, 2014 at 11:43:16AM -0300, Gonzalo Garramuno wrote: patience
First it seems to still have a bug it fails fate --- ./tests/ref/fate/exr-slice-raw 2014-04-28 04:14:37.849375679 +0200 +++ tests/data/fate/exr-slice-raw 2014-04-28 19:50:27.430558597 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x6a356d0d +0, 0, 0, 1, 3169800, 0x2cfefd25 How can I reproduce the test? I don't know how fate works and my tests dir has no exr-slice-raw. Is it failing on the sign bit for 0 or is it failing somewhere else?
set a samples directory with configure --samples=... make fate-rsync will download the samples make fate-exr will test them [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Democracy is the form of government in which you can choose your dictator
On Mon, Apr 28, 2014 at 03:31:19PM -0300, Gonzalo Garramuno wrote:
On 28/04/14 14:59, Michael Niedermayer wrote:
Ping. Just checking if the patch will be (pretty please) accepted or not.
On Mon, Apr 28, 2014 at 11:43:16AM -0300, Gonzalo Garramuno wrote: patience
First it seems to still have a bug it fails fate --- ./tests/ref/fate/exr-slice-raw 2014-04-28 04:14:37.849375679 +0200 +++ tests/data/fate/exr-slice-raw 2014-04-28 19:50:27.430558597 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x6a356d0d +0, 0, 0, 1, 3169800, 0x2cfefd25
Michael, did you try it without the patch? I get the same errors with
On 28/04/14 15:37, Michael Niedermayer wrote: the origin code and without any of my additions.
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
On Mon, Apr 28, 2014 at 04:49:37PM -0300, Gonzalo Garramuno wrote:
On 28/04/14 15:37, Michael Niedermayer wrote:
On Mon, Apr 28, 2014 at 03:31:19PM -0300, Gonzalo Garramuno wrote:
On 28/04/14 14:59, Michael Niedermayer wrote:
Ping. Just checking if the patch will be (pretty please) accepted or not.
On Mon, Apr 28, 2014 at 11:43:16AM -0300, Gonzalo Garramuno wrote: patience
First it seems to still have a bug it fails fate --- ./tests/ref/fate/exr-slice-raw 2014-04-28 04:14:37.849375679 +0200 +++ tests/data/fate/exr-slice-raw 2014-04-28 19:50:27.430558597 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x6a356d0d +0, 0, 0, 1, 3169800, 0x2cfefd25
Michael, did you try it without the patch? I get the same errors with the origin code and without any of my additions.
http://fate.ffmpeg.org/ looks quite green, so i would assume it works without modifications [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB it is not once nor twice but times without number that the same ideas make their appearance in the world. -- Aristotle
On 28.04.2014, at 19:59, Michael Niedermayer <michaelni@gmx.at> wrote:
On Mon, Apr 28, 2014 at 11:43:16AM -0300, Gonzalo Garramuno wrote:
Ping. Just checking if the patch will be (pretty please) accepted or not.
patience
First it seems to still have a bug it fails fate --- ./tests/ref/fate/exr-slice-raw 2014-04-28 04:14:37.849375679 +0200 +++ tests/data/fate/exr-slice-raw 2014-04-28 19:50:27.430558597 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x6a356d0d +0, 0, 0, 1, 3169800, 0x2cfefd25
Second, some people seem to dislike it, and some (me and you at least) seem to think its ok until full float pixel format support exists.
I will not object to it, but some considerations: 1) I think we agree that is a bad hack for something that could and should be fixed properly. 2) There is a balance between accepting hacks out of pragmatism vs. ending up encouraging people to write hacks instead of good solutions (note in particular that I believe this issue is basically the result of someone else having chosen the easier way, thus one hack resulting in the next). 3) It adds an option that people might rely on but which might be incompatible/require more hacks to support in a better solution. I would suggest marking the option as experimental/unsupported in the meaning we may remove it at any time with only a minor version bump.
On Mon, Apr 28, 2014 at 09:19:07PM +0200, Reimar Döffinger wrote:
On 28.04.2014, at 19:59, Michael Niedermayer <michaelni@gmx.at> wrote:
On Mon, Apr 28, 2014 at 11:43:16AM -0300, Gonzalo Garramuno wrote:
Ping. Just checking if the patch will be (pretty please) accepted or not.
patience
First it seems to still have a bug it fails fate --- ./tests/ref/fate/exr-slice-raw 2014-04-28 04:14:37.849375679 +0200 +++ tests/data/fate/exr-slice-raw 2014-04-28 19:50:27.430558597 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x6a356d0d +0, 0, 0, 1, 3169800, 0x2cfefd25
Second, some people seem to dislike it, and some (me and you at least) seem to think its ok until full float pixel format support exists.
I will not object to it, but some considerations: 1) I think we agree that is a bad hack for something that could and should be fixed properly. 2) There is a balance between accepting hacks out of pragmatism vs. ending up encouraging people to write hacks instead of good solutions (note in particular that I believe this issue is basically the result of someone else having chosen the easier way, thus one hack resulting in the next).
3) It adds an option that people might rely on but which might be incompatible/require more hacks to support in a better solution. I would suggest marking the option as experimental/unsupported in the meaning we may remove it at any time with only a minor version bump.
agree [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The bravest are surely those who have the clearest vision of what is before them, glory and danger alike, and yet notwithstanding go out to meet it. -- Thucydides
On 28/04/14 17:10, Michael Niedermayer wrote:
On Mon, Apr 28, 2014 at 09:19:07PM +0200, Reimar Döffinger wrote:
patience I apologize for being so impatient. Sorry. First it seems to still have a bug it fails fate --- ./tests/ref/fate/exr-slice-raw 2014-04-28 04:14:37.849375679 +0200 +++ tests/data/fate/exr-slice-raw 2014-04-28 19:50:27.430558597 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x6a356d0d +0, 0, 0, 1, 3169800, 0x2cfefd25 I am stuck with this bug. Not sure exactly what the numbers mean in the first place, except that it seems +0 and -0 are misplaced.
The fate test should fail with the exr_patch6.patch since gamma was set at a default of 2.2. But that's not the case why it is failing. I removed the powf function from the table lookup and that's not either. IEEE math is not my strongest suit. Can an IEEE guru take a look at the code, please (Reimar?)? There is a HACK comment in the exr_flt2uint function which appears harmless, but not sure.
3) It adds an option that people might rely on but which might be incompatible/require more hacks to support in a better solution. I would suggest marking the option as experimental/unsupported in the meaning we may remove it at any time with only a minor version bump. agree
[...] Agreed.
On Mon, Apr 28, 2014 at 08:21:03PM -0300, Gonzalo Garramuno wrote:
On Mon, Apr 28, 2014 at 09:19:07PM +0200, Reimar Döffinger wrote:
patience I apologize for being so impatient. Sorry. First it seems to still have a bug it fails fate --- ./tests/ref/fate/exr-slice-raw 2014-04-28 04:14:37.849375679 +0200 +++ tests/data/fate/exr-slice-raw 2014-04-28 19:50:27.430558597 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x6a356d0d +0, 0, 0, 1, 3169800, 0x2cfefd25 I am stuck with this bug. Not sure exactly what the numbers mean in
On 28/04/14 17:10, Michael Niedermayer wrote: the first place, except that it seems +0 and -0 are misplaced.
the data outputed by the decoder changes, which changes the checksum Either the decoder should not change in output by default or the checksum should be updated or the command line options for the tests would need to be changed so as to maintain the same output in the test [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB He who knows, does not speak. He who speaks, does not know. -- Lao Tsu
On 28/04/14 21:01, Michael Niedermayer wrote:
On Mon, Apr 28, 2014 at 09:19:07PM +0200, Reimar Döffinger wrote:
patience I apologize for being so impatient. Sorry. First it seems to still have a bug it fails fate --- ./tests/ref/fate/exr-slice-raw 2014-04-28 04:14:37.849375679 +0200 +++ tests/data/fate/exr-slice-raw 2014-04-28 19:50:27.430558597 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x6a356d0d +0, 0, 0, 1, 3169800, 0x2cfefd25 I am stuck with this bug. Not sure exactly what the numbers mean in
On 28/04/14 17:10, Michael Niedermayer wrote: the first place, except that it seems +0 and -0 are misplaced.
On Mon, Apr 28, 2014 at 08:21:03PM -0300, Gonzalo Garramuno wrote: the data outputed by the decoder changes, which changes the checksum
Either the decoder should not change in output by default or the checksum should be updated or the command line options for the tests would need to be changed so as to maintain the same output in the test
[...]
Thanks Michael. I understand how the checksum works. What I don't understand is where is the framecrc command and what does its 5 numbers of output mean.
On 29/04/14 10:14, Carl Eugen Hoyos wrote:
Gonzalo Garramuno <ggarra13 <at> gmail.com> writes:
> -0, 0, 0, 1, 3169800, 0x6a356d0d > +0, 0, 0, 1, 3169800, 0x2cfefd25
Thanks Michael. I understand how the checksum works.
Is the difference still there if you change the gamma default value to 1.0?
My point about the default value excactly :) - Jimmy
On 29/04/14 05:14, Carl Eugen Hoyos wrote:
Is the difference still there if you change the gamma default value to 1.0?
Yes. It shows up as -0 and +0. The fate test shows up even if I don't do any powf() gamma function. It seems half_to_float_full (which I renamed to exr_half2float) and exr_flt2uint don't return the same values. It seems a precision issue.
On Tue, Apr 29, 2014 at 05:05:10AM -0300, Gonzalo Garramuno wrote:
On 28/04/14 21:01, Michael Niedermayer wrote:
On Mon, Apr 28, 2014 at 09:19:07PM +0200, Reimar Döffinger wrote:
patience I apologize for being so impatient. Sorry. First it seems to still have a bug it fails fate --- ./tests/ref/fate/exr-slice-raw 2014-04-28 04:14:37.849375679 +0200 +++ tests/data/fate/exr-slice-raw 2014-04-28 19:50:27.430558597 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x6a356d0d +0, 0, 0, 1, 3169800, 0x2cfefd25 I am stuck with this bug. Not sure exactly what the numbers mean in
On 28/04/14 17:10, Michael Niedermayer wrote: the first place, except that it seems +0 and -0 are misplaced.
On Mon, Apr 28, 2014 at 08:21:03PM -0300, Gonzalo Garramuno wrote: the data outputed by the decoder changes, which changes the checksum
Either the decoder should not change in output by default or the checksum should be updated or the command line options for the tests would need to be changed so as to maintain the same output in the test
[...]
Thanks Michael. I understand how the checksum works. What I don't understand is where is the framecrc command and what does its 5 numbers of output mean.
make fate-exr-slice-raw V=1 will give you the command see libavformat/framecrcenc.c for column values -- Clément B.
On Tue, Apr 29, 2014 at 05:05:10AM -0300, Gonzalo Garramuno wrote:
On 28/04/14 21:01, Michael Niedermayer wrote:
On Mon, Apr 28, 2014 at 09:19:07PM +0200, Reimar Döffinger wrote:
patience I apologize for being so impatient. Sorry. First it seems to still have a bug it fails fate --- ./tests/ref/fate/exr-slice-raw 2014-04-28 04:14:37.849375679 +0200 +++ tests/data/fate/exr-slice-raw 2014-04-28 19:50:27.430558597 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x6a356d0d +0, 0, 0, 1, 3169800, 0x2cfefd25 I am stuck with this bug. Not sure exactly what the numbers mean in
On 28/04/14 17:10, Michael Niedermayer wrote: the first place, except that it seems +0 and -0 are misplaced.
On Mon, Apr 28, 2014 at 08:21:03PM -0300, Gonzalo Garramuno wrote: the data outputed by the decoder changes, which changes the checksum
Either the decoder should not change in output by default or the checksum should be updated or the command line options for the tests would need to be changed so as to maintain the same output in the test
[...]
Thanks Michael. I understand how the checksum works. What I don't understand is where is the framecrc command and what does its 5 numbers of output mean.
RTFM: http://www.ffmpeg.org/ffmpeg-formats.html#framecrc -- Peter (A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
On Mon, Apr 28, 2014 at 09:19:07PM +0200, Reimar Döffinger wrote:
patience I apologize for being so impatient. Sorry. First it seems to still have a bug it fails fate --- ./tests/ref/fate/exr-slice-raw 2014-04-28 04:14:37.849375679 +0200 +++ tests/data/fate/exr-slice-raw 2014-04-28 19:50:27.430558597 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x6a356d0d +0, 0, 0, 1, 3169800, 0x2cfefd25 I am stuck with this bug. Not sure exactly what the numbers mean in
On 28/04/14 17:10, Michael Niedermayer wrote: the first place, except that it seems +0 and -0 are misplaced. I have a new update to fix the bugs in the code but it still does not
On 28/04/14 20:21, Gonzalo Garramuno wrote: pass fate. #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x6a356d0d +0, 0, 0, 1, 3169800, 0x1f656d7a My feeling is that it will never pass it, since float->half is a lossy operation, so exr_flt2uint() returns a different float value than exr_half2float() which is a lossless operation. I am checking with the OpenEXR guys to make sure my assumption is correct. If it is, I'll post a new update and an updated fate checksum.
Reimar Döffinger <Reimar.Doeffinger <at> gmx.de> writes:
1) I think we agree that is a bad hack for something that could and should be fixed properly.
Is it really both realistic and useful to have a float pix_fmt? I mean assuming that no hardware will support the pix_fmt (I believe this used to be a criteria a very long time ago), will a filter or an encoder profit from it? Carl Eugen
Reimar Döffinger <Reimar.Doeffinger <at> gmx.de> writes:
1) I think we agree that is a bad hack for something that could and should be fixed properly. Is it really both realistic and useful to have a float pix_fmt? I mean assuming that no hardware will support the pix_fmt (I believe this used to be a criteria a very long time ago), will a filter or an encoder profit from it?
Carl Eugen Carl, alll latest ( 3 years or so ) NVidia gfx cards support at least
On 28/04/14 17:11, Carl Eugen Hoyos wrote: the half float format.
On 28.04.2014, at 22:11, Carl Eugen Hoyos <cehoyos@ag.or.at> wrote:
Reimar Döffinger <Reimar.Doeffinger <at> gmx.de> writes:
1) I think we agree that is a bad hack for something that could and should be fixed properly.
Is it really both realistic and useful to have a float pix_fmt? I mean assuming that no hardware will support the pix_fmt (I believe this used to be a criteria a very long time ago), will a filter or an encoder profit from it?
Well, we have a specific example here of a filter profiting from it. Also all modern graphics cards should support half- and full-precision float (though the bandwidth requirements make it not that useful, plus without HDR displays - in fact many only offering 6 bit precision - there is no quality improvement for normal use-cases). Through OpenCL even using double-precision should be possible.
Got a little late into the discussion of it all. My main concern was about the speed of the new code compared to the old, however it seem that the new code is even faster than the old :) I'm not sure that I like that it's default with gamma 2.2. Personally I would rather have it defaults to gamma 1.0 (no changes). Have too much bad experience with default values like this :) When people apply gamma etc. they should know what they are doing. Also in the future when floating point pixel format is supported, you don't want to apply gamma before applying eg. a lin2log filter before applying a LUT. Hilsen Jimmy Christensen Developer Ghost A/S On 28/04/14 19:59, Michael Niedermayer wrote:
On Mon, Apr 28, 2014 at 11:43:16AM -0300, Gonzalo Garramuno wrote:
Ping. Just checking if the patch will be (pretty please) accepted or not.
patience
First it seems to still have a bug it fails fate --- ./tests/ref/fate/exr-slice-raw 2014-04-28 04:14:37.849375679 +0200 +++ tests/data/fate/exr-slice-raw 2014-04-28 19:50:27.430558597 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x6a356d0d +0, 0, 0, 1, 3169800, 0x2cfefd25
Second, some people seem to dislike it, and some (me and you at least) seem to think its ok until full float pixel format support exists.
theres noone listed in MAINTAINERs for exr does anyone volunteer to maintain exr ?
if no and noone is strongly against then ill apply this patch once it works but not before 3 days. if someone volunteers as maintainer for exr then its his decission
iam also CCing the author of the exr code and paul who was actively working on exr, maybe either of them want to maintain the code or have comments
Thanks
[...]
Hi, On Tue, Apr 29, 2014 at 2:49 AM, Jimmy Christensen <jimmy@ghost.dk> wrote:
'm not sure that I like that it's default with gamma 2.2. Personally I would rather have it defaults to gamma 1.0 (no changes).
The gamma here is a little different from what you probably think it is, it's the linear XYZ (that's the actual perceived rays of light shooting in your eye as a scientific metric) vs. exponential RGB/YUV (which are just matrix transformations of each other), such as sRGB or bt709 or whatever. It's not the gamma _over_ the non-linear YUV/RGB (which was already non-linear in itself), which is the kind of operation that you get when you apply a gamma in e.g. gimp or photoshop on an image. For typical gamma values for colorspaces, see e.g. http://www.brucelindbloom.com/index.html?Eqn_RGB_to_XYZ.html - 2.2 is a pretty typical default. Ronald
On 29/04/14 15:18, Ronald S. Bultje wrote:
Hi,
On Tue, Apr 29, 2014 at 2:49 AM, Jimmy Christensen <jimmy@ghost.dk> wrote:
'm not sure that I like that it's default with gamma 2.2. Personally I would rather have it defaults to gamma 1.0 (no changes).
The gamma here is a little different from what you probably think it is, it's the linear XYZ (that's the actual perceived rays of light shooting in your eye as a scientific metric) vs. exponential RGB/YUV (which are just matrix transformations of each other), such as sRGB or bt709 or whatever.
Huh? The gamma correction in the patch has nothing to do with the XYZ colorspace. As far as I can see it's a simple powf() applied.
It's not the gamma _over_ the non-linear YUV/RGB (which was already non-linear in itself), which is the kind of operation that you get when you apply a gamma in e.g. gimp or photoshop on an image.
For typical gamma values for colorspaces, see e.g. http://www.brucelindbloom.com/index.html?Eqn_RGB_to_XYZ.html - 2.2 is a pretty typical default.
My point is that you can never assume that the input OpenEXR's are gamma 1.0. Not to mention when you start to mix in ACES sometime in the near future. Assuming stuff which is not part/dictated of the standard is a bad idea IMHO. - Jimmy
On 29-04-14 15:58, Jimmy Christensen wrote:
On 29/04/14 15:18, Ronald S. Bultje wrote:
Hi,
On Tue, Apr 29, 2014 at 2:49 AM, Jimmy Christensen <jimmy@ghost.dk> wrote:
'm not sure that I like that it's default with gamma 2.2. Personally I would rather have it defaults to gamma 1.0 (no changes).
The gamma here is a little different from what you probably think it is, it's the linear XYZ (that's the actual perceived rays of light shooting in your eye as a scientific metric) vs. exponential RGB/YUV (which are just matrix transformations of each other), such as sRGB or bt709 or whatever.
Huh? The gamma correction in the patch has nothing to do with the XYZ colorspace. As far as I can see it's a simple powf() applied.
It's not the gamma _over_ the non-linear YUV/RGB (which was already non-linear in itself), which is the kind of operation that you get when you apply a gamma in e.g. gimp or photoshop on an image.
For typical gamma values for colorspaces, see e.g. http://www.brucelindbloom.com/index.html?Eqn_RGB_to_XYZ.html - 2.2 is a pretty typical default.
My point is that you can never assume that the input OpenEXR's are gamma 1.0. Not to mention when you start to mix in ACES sometime in the near future.
Assuming stuff which is not part/dictated of the standard is a bad idea IMHO.
- Jimmy _______________________________________________
Hi, As far as I know and have been using ACES and EXR, OpenEXR is gamma 1.0 by standard: http://www.openexr.com/OpenEXRColorManagement.pdf If you store a photo of a light into an EXR, double the light's brightness and store it again, the pixel values have doubled. This is not the case with RGB or YUV images. ACES is specifies EXR as the preferred fileformat: http://www.oscars.org/science-technology/council/projects/aces.html and is also scene-linear. Of course both have the option to use alternative gamma's but it should be specifically written in the headers. greets Arno
Hi, On Tue, Apr 29, 2014 at 9:58 AM, Jimmy Christensen <jimmy@ghost.dk> wrote:
On 29/04/14 15:18, Ronald S. Bultje wrote:
On Tue, Apr 29, 2014 at 2:49 AM, Jimmy Christensen <jimmy@ghost.dk> wrote:
'm not sure that I like that it's default with gamma 2.2. Personally I
would rather have it defaults to gamma 1.0 (no changes).
The gamma here is a little different from what you probably think it is, it's the linear XYZ (that's the actual perceived rays of light shooting in your eye as a scientific metric) vs. exponential RGB/YUV (which are just matrix transformations of each other), such as sRGB or bt709 or whatever.
Huh? The gamma correction in the patch has nothing to do with the XYZ colorspace. As far as I can see it's a simple powf() applied.
Of course it's just a powf function, that's what exponential is, right? This is about the _meaning_ of _why_ the powf is there. There's such a thing as linear-rgb, and EXR may be coded as such. In that case, xyz-rgb conversion is just a matrix transformation (just like rgb/yuv), but conversion to exponential rgb/yuv (like srgb or bt709 or smpte-blah) is an exponential function again - hence the powf. The basic thing I want you to learn from this is that if you have a pixel in the Y component of a YUV video frame that has 8 bits color depth (and let's assume that it's full-jpeg-range 0-255, not mpeg range) and the pixel has a value of 0x2, and the pixel next to it has a value of 0x1, it does _NOT_ mean that if you put a light detector on the actual source of that video frame, that the area covered by this pixel had double the amount of luminescence coming off it compared to the area covered by the next pixel. One-sentence summary: there is no linear correlation between pixel value in your bitmap and luminescence. That correlation is exponential, and the value of the exponent is the gamma. Wikipedia or that webpage I linked earlier will explain why: we'd waste pixels in value ranges where we can't really see the difference between two consecutive binning values very well relative to other ranges where we're actually much more perceptive to consecutive binning value differences. To optimize the utility of our bitmap's bits, we use a gamma. Ronald
Le decadi 10 floréal, an CCXXII, Ronald S. Bultje a écrit :
Of course it's just a powf function, that's what exponential is, right?
Actually, I suspect you are making a mistake in vocabulary. Unless I am mistaken, exponential is for "x -> a^x", with x the parameter and a a constant (which may be a parameter on its own right, but at another level). Gamma is "x -> x^2.2", that is just a power function. Regards, -- Nicolas George
On 29/04/14 03:49, Jimmy Christensen wrote:
On 28/04/14 19:59, Michael Niedermayer wrote:
On Mon, Apr 28, 2014 at 11:43:16AM -0300, Gonzalo Garramuno wrote:
Ping. Just checking if the patch will be (pretty please) accepted or not.
Find the bug fixed patch with new checksums for fate.
Here's an updated patch to fix trailing whitespace and other things patcheck caught.
On Thu, May 01, 2014 at 10:18:43AM -0300, Gonzalo Garramuno wrote:
Here's an updated patch to fix trailing whitespace and other things patcheck caught.
libavcodec/exr.c | 108 ++++++++++++++++++++++++++++++++--------- tests/ref/fate/exr-slice-raw | 2 tests/ref/fate/exr-slice-rle | 2 tests/ref/fate/exr-slice-zip1 | 2 tests/ref/fate/exr-slice-zip16 | 2 5 files changed, 89 insertions(+), 27 deletions(-) 81b08653e65f24190d107efd8977e8669292ab92 exr_patch8.diff diff --git a/libavcodec/exr.c b/libavcodec/exr.c index 084025a..3ca7552 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -27,13 +27,17 @@ * For more information on the OpenEXR format, visit: * http://openexr.com/ * - * exr_flt2uint() and exr_halflt2uint() is credited to Reimar Döffinger + * exr_flt2uint() and exr_halflt2uint() is credited to Reimar Döffinger. + * exr_half2float() is credited to Fabian “ryg” Giesen. + * */
#include <zlib.h> +#include <float.h>
#include "libavutil/imgutils.h" #include "libavutil/opt.h" +#include "libavutil/intfloat.h"
#include "avcodec.h" #include "bytestream.h" @@ -77,6 +81,7 @@ typedef struct EXRThreadData { uint16_t *lut; } EXRThreadData;
+ typedef struct EXRContext { AVClass *class; AVFrame *picture; @@ -106,6 +111,11 @@ typedef struct EXRContext { EXRThreadData *thread_data;
const char *layer; + + float gamma; + + uint16_t gamma_table[65536]; + } EXRContext;
/** @@ -128,6 +138,29 @@ static inline uint16_t exr_flt2uint(uint32_t v) return (v + (1 << 23)) >> (127 + 7 - exp); }
+ +/* + * Convert a half float as a uint16_t into a full float. + * + * @param h half float as uint16_t + * + * @return float value + */ +static inline float exr_half2float(uint16_t h) +{ + static const union av_intfloat32 magic = { (254 - 15) << 23 }; + static const union av_intfloat32 was_infnan = { (127 + 16) << 23 }; + union av_intfloat32 o; + + o.i = (h & 0x7fff) << 13; /* exponent/mantissa bits */ + o.f *= magic.f; /* exponent adjust */ + if (o.f >= was_infnan.f) /* make sure Inf/NaN survive */ + o.i |= 255 << 23; + o.i |= (h & 0x8000) << 16; // sign bit + + return o.f; +} + /** * Convert from 16-bit float as uint16_t to uint16_t. * @@ -772,6 +805,7 @@ static int decode_block(AVCodecContext *avctx, void *tdata, int bxmin = s->xmin * 2 * s->desc->nb_components; int i, x, buf_size = s->buf_size; int ret; + float one_gamma = 1.0f / s->gamma;
line_offset = AV_RL64(s->gb.buffer + jobnr * 8); // Check if the buffer has the required bytes needed from the offset @@ -851,31 +885,43 @@ static int decode_block(AVCodecContext *avctx, void *tdata, if (s->pixel_type == EXR_FLOAT) { // 32-bit for (x = 0; x < xdelta; x++) { - *ptr_x++ = exr_flt2uint(bytestream_get_le32(&r)); - *ptr_x++ = exr_flt2uint(bytestream_get_le32(&g)); - *ptr_x++ = exr_flt2uint(bytestream_get_le32(&b)); + union av_intfloat32 t; + t.i = bytestream_get_le32(&r); + if ( t.f < 0.0f ) t.f = 0.0f; /* avoid negative values */ + t.f = powf(t.f, one_gamma); + *ptr_x++ = exr_flt2uint(t.i); + + t.i = bytestream_get_le32(&g); + if ( t.f < 0.0f ) t.f = 0.0f; + t.f = powf(t.f, one_gamma); + *ptr_x++ = exr_flt2uint(t.i); + + t.i = bytestream_get_le32(&b); + if ( t.f < 0.0f ) t.f = 0.0f; + t.f = powf(t.f, one_gamma); + *ptr_x++ = exr_flt2uint(t.i); if (channel_buffer[3]) *ptr_x++ = exr_flt2uint(bytestream_get_le32(&a)); }
- } else { - // 16-bit - for (x = 0; x < xdelta; x++) { - *ptr_x++ = exr_halflt2uint(bytestream_get_le16(&r)); - *ptr_x++ = exr_halflt2uint(bytestream_get_le16(&g)); - *ptr_x++ = exr_halflt2uint(bytestream_get_le16(&b)); - if (channel_buffer[3]) - *ptr_x++ = exr_halflt2uint(bytestream_get_le16(&a)); - } - } - - // Zero out the end if xmax+1 is not w - memset(ptr_x, 0, axmax); - - channel_buffer[0] += s->scan_line_size; - channel_buffer[1] += s->scan_line_size; - channel_buffer[2] += s->scan_line_size; - if (channel_buffer[3]) - channel_buffer[3] += s->scan_line_size; + } else { + /* 16-bit */ + for (x = 0; x < xdelta; x++) { + *ptr_x++ = s->gamma_table[bytestream_get_le16(&r)]; + *ptr_x++ = s->gamma_table[bytestream_get_le16(&g)]; + *ptr_x++ = s->gamma_table[bytestream_get_le16(&b)]; + if (channel_buffer[3]) + *ptr_x++ = exr_halflt2uint(bytestream_get_le16(&a)); + } + } + + // Zero out the end if xmax+1 is not w + memset(ptr_x, 0, axmax); + + channel_buffer[0] += s->scan_line_size; + channel_buffer[1] += s->scan_line_size; + channel_buffer[2] += s->scan_line_size; + if (channel_buffer[3]) + channel_buffer[3] += s->scan_line_size;
please dont mess up the indention of otherwise unchanged code [...]
diff --git a/tests/ref/fate/exr-slice-raw b/tests/ref/fate/exr-slice-raw index a8b4b27..8534f88 100644 --- a/tests/ref/fate/exr-slice-raw +++ b/tests/ref/fate/exr-slice-raw @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x6a356d0d +0, 0, 0, 1, 3169800, 0x1f656d7a diff --git a/tests/ref/fate/exr-slice-rle b/tests/ref/fate/exr-slice-rle index a8b4b27..8534f88 100644 --- a/tests/ref/fate/exr-slice-rle +++ b/tests/ref/fate/exr-slice-rle @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x6a356d0d +0, 0, 0, 1, 3169800, 0x1f656d7a diff --git a/tests/ref/fate/exr-slice-zip1 b/tests/ref/fate/exr-slice-zip1 index a8b4b27..8534f88 100644 --- a/tests/ref/fate/exr-slice-zip1 +++ b/tests/ref/fate/exr-slice-zip1 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x6a356d0d +0, 0, 0, 1, 3169800, 0x1f656d7a diff --git a/tests/ref/fate/exr-slice-zip16 b/tests/ref/fate/exr-slice-zip16 index a8b4b27..8534f88 100644 --- a/tests/ref/fate/exr-slice-zip16 +++ b/tests/ref/fate/exr-slice-zip16 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x6a356d0d +0, 0, 0, 1, 3169800, 0x1f656d7a
make fate still fails: unraster-1bit-raw TEST sunraster-1bit-rle TEST sunraster-8bit-raw TEST sunraster-8bit_gray-raw --- ./tests/ref/fate/exr-slice-raw 2014-05-01 18:55:23.191949620 +0200 +++ tests/data/fate/exr-slice-raw 2014-05-01 19:12:22.391971092 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x1f656d7a +0, 0, 0, 1, 3169800, 0xc96ed674 TEST sunraster-8bit-rle TEST sunraster-24bit-raw Test exr-slice-raw failed. Look at tests/data/fate/exr-slice-raw.err for details. make: *** [fate-exr-slice-raw] Error 1 make: *** Waiting for unfinished jobs.... --- ./tests/ref/fate/exr-slice-rle 2014-05-01 18:55:23.195949620 +0200 +++ tests/data/fate/exr-slice-rle 2014-05-01 19:12:22.419971092 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x1f656d7a +0, 0, 0, 1, 3169800, 0xc96ed674 Test exr-slice-rle failed. Look at tests/data/fate/exr-slice-rle.err for details. make: *** [fate-exr-slice-rle] Error 1 --- ./tests/ref/fate/exr-slice-zip16 2014-05-01 18:55:23.199949620 +0200 +++ tests/data/fate/exr-slice-zip16 2014-05-01 19:12:22.439971093 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x1f656d7a +0, 0, 0, 1, 3169800, 0xc96ed674 Test exr-slice-zip16 failed. Look at tests/data/fate/exr-slice-zip16.err for details. make: *** [fate-exr-slice-zip16] Error 1 --- ./tests/ref/fate/exr-slice-zip1 2014-05-01 18:55:23.199949620 +0200 +++ tests/data/fate/exr-slice-zip1 2014-05-01 19:12:22.443971092 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x1f656d7a +0, 0, 0, 1, 3169800, 0xc96ed674 Test exr-slice-zip1 failed. Look at tests/data/fate/exr-slice-zip1.err for details. make: *** [fate-exr-slice-zip1] Error 1 [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I know you won't believe me, but the highest form of Human Excellence is to question oneself and others. -- Socrates
On Thu, May 01, 2014 at 10:18:43AM -0300, Gonzalo Garramuno wrote:
Here's an updated patch to fix trailing whitespace and other things patcheck caught.
please dont mess up the indention of otherwise unchanged code
[...] I am puzzled how you get such a high checksum. Over here all fate tests
On 01/05/14 14:19, Michael Niedermayer wrote: pass with my checksum. Does the image you get looks okay or has artifacts? What platform are you running the tests on? On the meantime, I attached a new patch that does not mess the indentation.
Gonzalo Garramuno <ggarra13 <at> gmail.com> writes:
I am puzzled how you get such a high checksum. Over here all fate tests pass with my checksum.
I get this output on Linux with different gcc compilers for both ia32 and x64: $ make -k SAMPLES=fate-suite/ fate-exr TEST exr-slice-raw --- ./tests/ref/fate/exr-slice-raw 2014-05-01 22:07:04.915299853 +0200 +++ tests/data/fate/exr-slice-raw 2014-05-01 22:14:35.182290889 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x6a356d0d +0, 0, 0, 1, 3169800, 0x1f656d7a Test exr-slice-raw failed. Look at tests/data/fate/exr-slice-raw.err for details. make: *** [fate-exr-slice-raw] Error 1 TEST exr-slice-rle --- ./tests/ref/fate/exr-slice-rle 2014-05-01 22:07:04.915299853 +0200 +++ tests/data/fate/exr-slice-rle 2014-05-01 22:14:35.234290304 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x6a356d0d +0, 0, 0, 1, 3169800, 0x1f656d7a Test exr-slice-rle failed. Look at tests/data/fate/exr-slice-rle.err for details. make: *** [fate-exr-slice-rle] Error 1 TEST exr-slice-zip1 --- ./tests/ref/fate/exr-slice-zip1 2014-05-01 22:07:04.915299853 +0200 +++ tests/data/fate/exr-slice-zip1 2014-05-01 22:14:35.320289336 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x6a356d0d +0, 0, 0, 1, 3169800, 0x1f656d7a Test exr-slice-zip1 failed. Look at tests/data/fate/exr-slice-zip1.err for details. make: *** [fate-exr-slice-zip1] Error 1 TEST exr-slice-zip16 --- ./tests/ref/fate/exr-slice-zip16 2014-05-01 22:07:04.915299853 +0200 +++ tests/data/fate/exr-slice-zip16 2014-05-01 22:14:35.400288436 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x6a356d0d +0, 0, 0, 1, 3169800, 0x1f656d7a Test exr-slice-zip16 failed. Look at tests/data/fate/exr-slice-zip16.err for details. make: *** [fate-exr-slice-zip16] Error 1 TEST exr-slice-pxr24 make: Target `fate-exr' not remade because of errors.
Does the image you get looks okay
Yes. Carl Eugen
On 01/05/14 17:16, Carl Eugen Hoyos wrote:
Gonzalo Garramuno <ggarra13 <at> gmail.com> writes:
I am puzzled how you get such a high checksum. Over here all fate tests pass with my checksum. I get this output on Linux with different gcc compilers for both ia32 and x64:
$ make -k SAMPLES=fate-suite/ fate-exr TEST exr-slice-raw --- ./tests/ref/fate/exr-slice-raw 2014-05-01 22:07:04.915299853 +0200 +++ tests/data/fate/exr-slice-raw 2014-05-01 22:14:35.182290889 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x6a356d0d +0, 0, 0, 1, 3169800, 0x1f656d7a Test exr-slice-raw failed. Look at tests/data/fate/exr-slice-raw.err for details. make: *** [fate-exr-slice-raw] Error 1 TEST exr-slice-rle --- ./tests/ref/fate/exr-slice-rle 2014-05-01 22:07:04.915299853 +0200 +++ tests/data/fate/exr-slice-rle 2014-05-01 22:14:35.234290304 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x6a356d0d +0, 0, 0, 1, 3169800, 0x1f656d7a These are the old checksums. The new checksum is 0x1f656d7a So for you it seems the fate checks are passing.
Gonzalo Garramuno <ggarra13 <at> gmail.com> writes:
So for you it seems the fate checks are passing.
Please send a patch that - if applied - allows the following command to pass (so that it does not show errors): $ make fate-exr And please don't forget to remove the trailing whitespace and the hunk breaking indentation. Carl Eugen
Gonzalo Garramuno <ggarra13 <at> gmail.com> writes:
I attached a new patch that does not mess the indentation.
Please remove this hunk: - // 16-bit - for (x = 0; x < xdelta; x++) { - *ptr_x++ = exr_halflt2uint(bytestream_get_le16(&r)); - *ptr_x++ = exr_halflt2uint(bytestream_get_le16(&g)); - *ptr_x++ = exr_halflt2uint(bytestream_get_le16(&b)); - if (channel_buffer[3]) - *ptr_x++ = exr_halflt2uint(bytestream_get_le16(&a)); - } + /* 16-bit */ + for (x = 0; x < xdelta; x++) { + *ptr_x++ = s->gamma_table[bytestream_get_le16(&r)]; + *ptr_x++ = s->gamma_table[bytestream_get_le16(&g)]; + *ptr_x++ = s->gamma_table[bytestream_get_le16(&b)]; + if (channel_buffer[3]) + *ptr_x++ = exr_halflt2uint(bytestream_get_le16(&a)); + } And patcheck still reports trailing whitespace: Our repository refuses such changes. Carl Eugen
On 01/05/14 17:19, Carl Eugen Hoyos wrote:
Gonzalo Garramuno <ggarra13 <at> gmail.com> writes:
I attached a new patch that does not mess the indentation. Here goes the patch with the requested changes and with new checksums for exr fate.
On Thu, May 01, 2014 at 06:04:25PM -0300, Gonzalo Garramuno wrote:
On 01/05/14 17:19, Carl Eugen Hoyos wrote:
Gonzalo Garramuno <ggarra13 <at> gmail.com> writes:
I attached a new patch that does not mess the indentation. Here goes the patch with the requested changes and with new checksums for exr fate.
still fails fate, and the image does not look ok that its produced there are individual green pixels in dark areas, so id guess something is overflowing [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB There will always be a question for which you do not know the correct answer.
On 01/05/14 18:45, Michael Niedermayer wrote:
still fails fate, and the image does not look ok that its produced there are individual green pixels in dark areas, so id guess something is overflowing
[...]
Can you do a distclean and a clean compile? I had the green areas showing bad in a previous patch because of not checking the values that go into the powf function. However, the latest patch does check both in the float path and in the table path and I get a clean image on my end. And the fate checksums work for me and Carl.
On Thu, May 01, 2014 at 07:37:58PM -0300, Gonzalo Garramuno wrote:
On 01/05/14 18:45, Michael Niedermayer wrote:
still fails fate, and the image does not look ok that its produced there are individual green pixels in dark areas, so id guess something is overflowing
[...]
Can you do a distclean and a clean compile?
i already did but just tried again, same failure
I had the green areas showing bad in a previous patch because of not checking the values that go into the powf function. However, the latest patch does check both in the float path and in the table path and I get a clean image on my end. And the fate checksums work for me and Carl.
float computations can differ in result between platforms, rounding can differ, compiler optimizations can differ i dont know if its either of these though thats causing the issue [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Many things microsoft did are stupid, but not doing something just because microsoft did it is even more stupid. If everything ms did were stupid they would be bankrupt already.
float computations can differ in result between platforms, rounding can differ, compiler optimizations can differ i dont know if its either of these though thats causing the issue
[...] Find attached a patch that isolates the powf function to only work when gamma is different than 1. And all negative values are clamped to 0. The checksums don't need to be changed from 0x1f656d7a. If it still does not work for you Michael, can you upload a png to with
On 01/05/14 23:06, Michael Niedermayer wrote: the image you get at http://www.datafilehost.com/ ?
On Fri, May 02, 2014 at 11:22:49AM -0300, Gonzalo Garramuno wrote:
On 01/05/14 23:06, Michael Niedermayer wrote:
float computations can differ in result between platforms, rounding can differ, compiler optimizations can differ i dont know if its either of these though thats causing the issue
[...] Find attached a patch that isolates the powf function to only work when gamma is different than 1. And all negative values are clamped to 0. The checksums don't need to be changed from 0x1f656d7a. If it still does not work for you Michael, can you upload a png to with the image you get at http://www.datafilehost.com/ ?
exr.c | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 70 insertions(+), 7 deletions(-) 391fc9a2030b5c271e89316a055cc6f4a29e1a86 exr_patch11.diff diff --git a/libavcodec/exr.c b/libavcodec/exr.c index 084025a..5ff4df4 100644
still fails both on x86_64 as well as arm32, it also fails differently on both gamma_table differs between the 2 first difference is at index 256, where one is 0 and the other 1 last difference is at index 1023 previous patches failed only on x86_64, but worked on arm32 on arm32: --- /home/michael/ffmpeg-git/ffmpeg/tests/ref/fate/exr-slice-raw 2014-05-02 05:37:07.676760799 +0200 +++ tests/data/fate/exr-slice-raw 2014-05-03 00:37:24.306202155 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x6a356d0d +0, 0, 0, 1, 3169800, 0x1f656d7a on x86_64: --- ./tests/ref/fate/exr-slice-raw 2014-05-02 05:37:07.676760799 +0200 +++ tests/data/fate/exr-slice-raw 2014-05-03 00:38:36.906203684 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x6a356d0d +0, 0, 0, 1, 3169800, 0x9a9b6cde [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The educated differ from the uneducated as much as the living from the dead. -- Aristotle
On 02/05/14 19:54, Michael Niedermayer wrote:
still fails both on x86_64 as well as arm32, it also fails differently on both gamma_table differs between the 2 first difference is at index 256, where one is 0 and the other 1 last difference is at index 1023 I reverted to the previous patch that kept the negative values and I am attaching it again without any changes. However, I am puzzled it fails on x86_64 as that's exactly the architecture I am developing on. Are you trying it on Windows or FreeBSD? I am running it on Ubuntu without problems on gcc4.7.
Find also attached an utility that creates the gamma table in /usr/tmp. Place it in the main ffmpeg tree and compile with gcc gamma.c -o gamma -lm. That should help us isolate the problem areas in the table.
On Sat, May 03, 2014 at 05:22:15PM -0300, Gonzalo Garramuno wrote:
On 02/05/14 19:54, Michael Niedermayer wrote:
still fails both on x86_64 as well as arm32, it also fails differently on both gamma_table differs between the 2 first difference is at index 256, where one is 0 and the other 1 last difference is at index 1023 I reverted to the previous patch that kept the negative values and I am attaching it again without any changes. However, I am puzzled it fails on x86_64 as that's exactly the architecture I am developing on. Are you trying it on Windows or FreeBSD? I am running it on Ubuntu without problems on gcc4.7.
ubuntu gcc 4.6.3
Find also attached an utility that creates the gamma table in /usr/tmp. Place it in the main ffmpeg tree and compile with gcc gamma.c -o gamma -lm. That should help us isolate the problem areas in the table.
/*
Place me at the root of ffmpeg as gamma.c and try compiling me with: gcc gamma.c -o gamma -lm
gcc gamma.c -o gamma -lm ./gamma Segmentation fault (core dumped) (user apps have no buisness writing to usr, in fact /usr could be physically read only) also to debug the float issue, id suggest that you check that your implementation is stable one way to do that is by adding a random small value to every non interger computation that is for example replace o.f *= magic.f; /* exponent adjust */ if (o.f >= was_infnan.f) /* make sure Inf/NaN survive */ by magic.f += random_small() o.f += random_small() o.f *= magic.f; /* exponent adjust */ o.f += random_small() if (o.f + random_small() >= was_infnan.f + random_small()) /* make sure Inf/NaN survive */ with random_small() returning a random value so that it would change the lowest 2-3 bits of the float which are still stored do this for every use of floats or doubles also dont assume that using the same expression twice must evaluate to the same value, theres no such gurantee in C with floats and then make sure the code gives binary identical output still which may be tricky alternatively you could use integers instead of floats, to generate the table see tests/tiny_psnr.c for fixed point log and exp for example [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB There will always be a question for which you do not know the correct answer.
On 03/05/14 23:45, Michael Niedermayer wrote:
alternatively you could use integers instead of floats, to generate the table see tests/tiny_psnr.c for fixed point log and exp for example
[...] I'll follow this advice. I notice tiny_psnr.c has an exp function but it is commented out. Does it work fine?
On Sun, May 04, 2014 at 11:20:00AM -0300, Gonzalo Garramuno wrote:
On 03/05/14 23:45, Michael Niedermayer wrote:
alternatively you could use integers instead of floats, to generate the table see tests/tiny_psnr.c for fixed point log and exp for example
[...] I'll follow this advice. I notice tiny_psnr.c has an exp function but it is commented out. Does it work fine?
dunno also see ff_exp2() / ff_log2_q15() / wp_exp2 / wp_log2 [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Many things microsoft did are stupid, but not doing something just because microsoft did it is even more stupid. If everything ms did were stupid they would be bankrupt already.
On 03/05/14 23:45, Michael Niedermayer wrote:
one way to do that is by adding a random small value to every non interger computation that is for example replace o.f *= magic.f; /* exponent adjust */ if (o.f >= was_infnan.f) /* make sure Inf/NaN survive */ by
magic.f += random_small() o.f += random_small() o.f *= magic.f; /* exponent adjust */ o.f += random_small() if (o.f + random_small() >= was_infnan.f + random_small()) /* make sure Inf/NaN survive */
I made the constants use the float value instead of the bit shifts. Can you give it a try? If that does not work I'll try adding a random value to debug it.
On Sun, May 04, 2014 at 11:58:42AM -0300, Gonzalo Garramuno wrote:
On 03/05/14 23:45, Michael Niedermayer wrote:
one way to do that is by adding a random small value to every non interger computation that is for example replace o.f *= magic.f; /* exponent adjust */ if (o.f >= was_infnan.f) /* make sure Inf/NaN survive */ by
magic.f += random_small() o.f += random_small() o.f *= magic.f; /* exponent adjust */ o.f += random_small() if (o.f + random_small() >= was_infnan.f + random_small()) /* make sure Inf/NaN survive */
I made the constants use the float value instead of the bit shifts. Can you give it a try? If that does not work I'll try adding a random value to debug it.
--- ./tests/ref/fate/exr-slice-raw 2014-05-05 03:50:41.026086887 +0200 +++ tests/data/fate/exr-slice-raw 2014-05-05 03:54:03.790091159 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x1f656d7a +0, 0, 0, 1, 3169800, 0x6a356d0d Test exr-slice-raw failed. Look at tests/data/fate/exr-slice-raw.err for details. make: *** [fate-exr-slice-raw] Error 1 make: *** Waiting for unfinished jobs.... --- ./tests/ref/fate/exr-slice-rle 2014-05-05 03:50:41.034086890 +0200 +++ tests/data/fate/exr-slice-rle 2014-05-05 03:54:03.810091161 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x1f656d7a +0, 0, 0, 1, 3169800, 0x6a356d0d Test exr-slice-rle failed. Look at tests/data/fate/exr-slice-rle.err for details. make: *** [fate-exr-slice-rle] Error 1 --- ./tests/ref/fate/exr-slice-zip16 2014-05-05 03:50:41.038086890 +0200 +++ tests/data/fate/exr-slice-zip16 2014-05-05 03:54:03.842091161 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x1f656d7a +0, 0, 0, 1, 3169800, 0x6a356d0d --- ./tests/ref/fate/exr-slice-zip1 2014-05-05 03:50:41.034086890 +0200 +++ tests/data/fate/exr-slice-zip1 2014-05-05 03:54:03.842091161 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x1f656d7a +0, 0, 0, 1, 3169800, 0x6a356d0d [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The misfortune of the wise is better than the prosperity of the fool. -- Epicurus
On 03/05/14 23:45, Michael Niedermayer wrote:
On Sat, May 03, 2014 at 05:22:15PM -0300, Gonzalo Garramuno wrote:
On 02/05/14 19:54, Michael Niedermayer wrote:
still fails both on x86_64 as well as arm32, it also fails differently on both gamma_table differs between the 2 first difference is at index 256, where one is 0 and the other 1 last difference is at index 1023 I reverted to the previous patch that kept the negative values and I am attaching it again without any changes. However, I am puzzled it fails on x86_64 as that's exactly the architecture I am developing on. Are you trying it on Windows or FreeBSD? I am running it on Ubuntu without problems on gcc4.7. ubuntu gcc 4.6.3
Is there an easy way to set the compiler for ffmpeg? I tried export CC=gcc-4.6 before configure and that did not work. I found out I have almost the same offending compiler (4.6.4) and wanted to see if I could reproduce fate failing.
On Sun, May 04, 2014 at 09:16:50PM -0300, Gonzalo Garramuno wrote:
On 03/05/14 23:45, Michael Niedermayer wrote:
On Sat, May 03, 2014 at 05:22:15PM -0300, Gonzalo Garramuno wrote:
On 02/05/14 19:54, Michael Niedermayer wrote:
still fails both on x86_64 as well as arm32, it also fails differently on both gamma_table differs between the 2 first difference is at index 256, where one is 0 and the other 1 last difference is at index 1023 I reverted to the previous patch that kept the negative values and I am attaching it again without any changes. However, I am puzzled it fails on x86_64 as that's exactly the architecture I am developing on. Are you trying it on Windows or FreeBSD? I am running it on Ubuntu without problems on gcc4.7. ubuntu gcc 4.6.3
Is there an easy way to set the compiler for ffmpeg? I tried export CC=gcc-4.6 before configure and that did not work. I found out I have almost the same offending compiler (4.6.4) and wanted to see if I could reproduce fate failing.
./configure --cc='mycompiler' [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Republics decline into democracies and democracies degenerate into despotisms. -- Aristotle
On 04/05/14 22:53, Michael Niedermayer wrote:
On Sun, May 04, 2014 at 09:16:50PM -0300, Gonzalo Garramuno wrote:
On 03/05/14 23:45, Michael Niedermayer wrote:
On Sat, May 03, 2014 at 05:22:15PM -0300, Gonzalo Garramuno wrote:
On 02/05/14 19:54, Michael Niedermayer wrote:
still fails both on x86_64 as well as arm32, it also fails differently on both gamma_table differs between the 2 first difference is at index 256, where one is 0 and the other 1 last difference is at index 1023 I reverted to the previous patch that kept the negative values and I am attaching it again without any changes. However, I am puzzled it fails on x86_64 as that's exactly the architecture I am developing on. Are you trying it on Windows or FreeBSD? I am running it on Ubuntu without problems on gcc4.7. ubuntu gcc 4.6.3
Is there an easy way to set the compiler for ffmpeg? I tried export CC=gcc-4.6 before configure and that did not work. I found out I have almost the same offending compiler (4.6.4) and wanted to see if I could reproduce fate failing. ./configure --cc='mycompiler'
[...]
No luck. I did a distclean and a compile with gcc-4.6.4 and the fate tests passed. $ gcc --version gcc-4.6.real (Ubuntu/Linaro 4.6.4-1ubuntu1~12.04) 4.6.4
On Mon, May 05, 2014 at 10:37:43AM -0300, Gonzalo Garramuno wrote:
On 04/05/14 22:53, Michael Niedermayer wrote:
On Sun, May 04, 2014 at 09:16:50PM -0300, Gonzalo Garramuno wrote:
On 03/05/14 23:45, Michael Niedermayer wrote:
On Sat, May 03, 2014 at 05:22:15PM -0300, Gonzalo Garramuno wrote:
On 02/05/14 19:54, Michael Niedermayer wrote:
still fails both on x86_64 as well as arm32, it also fails differently on both gamma_table differs between the 2 first difference is at index 256, where one is 0 and the other 1 last difference is at index 1023 I reverted to the previous patch that kept the negative values and I am attaching it again without any changes. However, I am puzzled it fails on x86_64 as that's exactly the architecture I am developing on. Are you trying it on Windows or FreeBSD? I am running it on Ubuntu without problems on gcc4.7. ubuntu gcc 4.6.3
Is there an easy way to set the compiler for ffmpeg? I tried export CC=gcc-4.6 before configure and that did not work. I found out I have almost the same offending compiler (4.6.4) and wanted to see if I could reproduce fate failing. ./configure --cc='mycompiler'
[...]
No luck. I did a distclean and a compile with gcc-4.6.4 and the fate tests passed.
it seems to fail only with --enable-libopencv -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Everything should be made as simple as possible, but not simpler. -- Albert Einstein
On 05/05/14 12:28, Michael Niedermayer wrote:
it seems to fail only with --enable-libopencv That's beyond my knowledge. So you got the fate tests to pass?
On Mon, May 05, 2014 at 12:52:25PM -0300, Gonzalo Garramuno wrote:
On 05/05/14 12:28, Michael Niedermayer wrote:
it seems to fail only with --enable-libopencv That's beyond my knowledge. So you got the fate tests to pass?
its basically the same as before, they pass on some platforms with some configure options but fail on others. also to make sure there is no misunderstanding, this is not a libopencv issue with libopencv i just get the checksums from before your patch with your patch. The same difference happens without any libopencv just your patch vs. before [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The real ebay dictionary, page 2 "100% positive feedback" - "All either got their money back or didnt complain" "Best seller ever, very honest" - "Seller refunded buyer after failed scam"
On 05/05/14 16:47, Michael Niedermayer wrote:
On Mon, May 05, 2014 at 12:52:25PM -0300, Gonzalo Garramuno wrote:
On 05/05/14 12:28, Michael Niedermayer wrote:
it seems to fail only with --enable-libopencv That's beyond my knowledge. So you got the fate tests to pass? its basically the same as before, they pass on some platforms with some configure options but fail on others. I replaced the exr_half2float() with one that does not work any magic with floating point (it works all in uint). Can you give it a try? Attached is the exr diff and the checksums which remain the same.
On Tue, May 06, 2014 at 04:30:16PM -0300, Gonzalo Garramuno wrote:
On 05/05/14 16:47, Michael Niedermayer wrote:
On Mon, May 05, 2014 at 12:52:25PM -0300, Gonzalo Garramuno wrote:
On 05/05/14 12:28, Michael Niedermayer wrote:
it seems to fail only with --enable-libopencv That's beyond my knowledge. So you got the fate tests to pass? its basically the same as before, they pass on some platforms with some configure options but fail on others. I replaced the exr_half2float() with one that does not work any magic with floating point (it works all in uint). Can you give it a try? Attached is the exr diff and the checksums which remain the same.
[...]
@@ -77,6 +81,7 @@ typedef struct EXRThreadData { uint16_t *lut; } EXRThreadData;
+ typedef struct EXRContext { AVClass *class; AVFrame *picture;
unrelated
@@ -106,8 +111,83 @@ typedef struct EXRContext { EXRThreadData *thread_data;
const char *layer; + + float gamma; + + uint16_t gamma_table[65536]; + } EXRContext;
+// -15 stored using a single precision bias of 127 +const unsigned int HALF_FLOAT_MIN_BIASED_EXP_AS_SINGLE_FP_EXP = 0x38000000; +// max exponent value in single precision that will be converted +// to Inf or Nan when stored as a half-float +const unsigned int HALF_FLOAT_MAX_BIASED_EXP_AS_SINGLE_FP_EXP = 0x47800000; + +// 255 is the max exponent biased value +const unsigned int FLOAT_MAX_BIASED_EXP = (0xFF << 23); + +const unsigned int HALF_FLOAT_MAX_BIASED_EXP = (0x1F << 10);
these should be #define ...
+ +/* + * Convert a half float as a uint16_t into a full float. + * + * @param h half float as uint16_t + * + * @return float value + */ +inline static float
doesnt need to be inline
+exr_half2float(uint16_t hf) +{ + unsigned int sign = (unsigned int)(hf >> 15); + unsigned int mantissa = (unsigned int)(hf & ((1 << 10) - 1)); + unsigned int exp = (unsigned int)(hf & HALF_FLOAT_MAX_BIASED_EXP); + unsigned int f; + + if (exp == HALF_FLOAT_MAX_BIASED_EXP) + { + // we have a half-float NaN or Inf + // half-float NaNs will be converted to a single precision NaN + // half-float Infs will be converted to a single precision Inf + exp = FLOAT_MAX_BIASED_EXP; + if (mantissa) + mantissa = (1 << 23) - 1; // set all bits to indicate a NaN + } + else if (exp == 0x0) + { + // convert half-float zero/denorm to single precision value + if (mantissa) + {
> + mantissa <<= 1;
+ exp = HALF_FLOAT_MIN_BIASED_EXP_AS_SINGLE_FP_EXP; + // check for leading 1 in denorm mantissa
+ while ((mantissa & (1 << 10)) == 0) + { + // for every leading 0, decrement single precision exponent by 1 + // and shift half-float mantissa value to the left + mantissa <<= 1; + exp -= (1 << 23); + } + // clamp the mantissa to 10-bits
this could probably be simplified with av_log2(), not sure its worth teh work considering this isnt speed relevant though also please keep the formating consistent within a file
+ mantissa &= ((1 << 10) - 1); + // shift left to generate single-precision mantissa of 23-bits + mantissa <<= 13; + } + } + else + { + // shift left to generate single-precision mantissa of 23-bits + mantissa <<= 13; + // generate single precision biased exponent value + exp = (exp << 13) + HALF_FLOAT_MIN_BIASED_EXP_AS_SINGLE_FP_EXP; + } + + f = (sign << 31) | exp | mantissa; +
+ return *((float *)&f);
aliasing violation, undefined behavior also it would be better if it outputted some kind of int and float is limited to the pow() codepath
+} + + /** * Convert from 32-bit float as uint32_t to uint16_t. *
@@ -128,6 +208,8 @@ static inline uint16_t exr_flt2uint(uint32_t v) return (v + (1 << 23)) >> (127 + 7 - exp); }
+ + /** * Convert from 16-bit float as uint16_t to uint16_t. *
unrelated and this one seems to pass here for the case that failed previously [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Breaking DRM is a little like attempting to break through a door even though the window is wide open and the only thing in the house is a bunch of things you dont want and which you would get tomorrow for free anyway
On 06/05/14 20:31, Michael Niedermayer wrote:
On Tue, May 06, 2014 at 04:30:16PM -0300, Gonzalo Garramuno wrote:
I replaced the exr_half2float() with one that does not work any magic with floating point (it works all in uint). Can you give it a try? Attached is the exr diff and the checksums which remain the same. I fixed the code to make it consistent with the code in ffmpeg ( fixed brackets, used an union to avoid aliasing, defines instead of const, etc). Please give it a go.
On 06/05/14 20:31, Michael Niedermayer wrote:
unrelated
and this one seems to pass here for the case that failed previously
[...]
Some cosmetic changes that patcheck brough to light to comply with ffmpeg conventions.
On Wed, May 07, 2014 at 12:44:56PM -0300, Gonzalo Garramuno wrote:
On 06/05/14 20:31, Michael Niedermayer wrote:
unrelated
and this one seems to pass here for the case that failed previously
[...]
Some cosmetic changes that patcheck brough to light to comply with ffmpeg conventions.
libavcodec/exr.c: In function ‘exr_half2float’: libavcodec/exr.c:142:56: error: expected ‘)’ before ‘;’ token libavcodec/exr.c:145:28: error: expected ‘)’ before ‘;’ token make: *** [libavcodec/exr.o] Error 1 [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Opposition brings concord. Out of discord comes the fairest harmony. -- Heraclitus
libavcodec/exr.c: In function ‘exr_half2float’: libavcodec/exr.c:142:56: error: expected ‘)’ before ‘;’ token libavcodec/exr.c:145:28: error: expected ‘)’ before ‘;’ token make: *** [libavcodec/exr.o] Error 1
[...] I feel so silly. I did not turn the defines correctly. Here's a fixed version. I appreciate all the patience you are having with me, Michael. I apologize for the trouble I am causing you.
On Wed, May 07, 2014 at 06:24:36PM -0300, Gonzalo Garramuno wrote:
libavcodec/exr.c: In function ‘exr_half2float’: libavcodec/exr.c:142:56: error: expected ‘)’ before ‘;’ token libavcodec/exr.c:145:28: error: expected ‘)’ before ‘;’ token make: *** [libavcodec/exr.o] Error 1
[...] I feel so silly. I did not turn the defines correctly. Here's a fixed version. I appreciate all the patience you are having with me, Michael. I apologize for the trouble I am causing you.
libavcodec/exr.c | 117 ++++++++++++++++++++++++++++++++++++++--- tests/ref/fate/exr-slice-raw | 2 tests/ref/fate/exr-slice-rle | 2 tests/ref/fate/exr-slice-zip1 | 2 tests/ref/fate/exr-slice-zip16 | 2
this one fails again: --- ./tests/ref/fate/exr-slice-raw 2014-05-08 04:14:15.093250540 +0200 +++ tests/data/fate/exr-slice-raw 2014-05-08 04:29:33.489269884 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x1f656d7a +0, 0, 0, 1, 3169800, 0xdc8f6d0b Test exr-slice-raw failed. Look at tests/data/fate/exr-slice-raw.err for details. make: *** [fate-exr-slice-raw] Error 1 make: *** Waiting for unfinished jobs.... --- ./tests/ref/fate/exr-slice-rle 2014-05-08 04:14:15.097250540 +0200 +++ tests/data/fate/exr-slice-rle 2014-05-08 04:29:33.501269889 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x1f656d7a +0, 0, 0, 1, 3169800, 0xdc8f6d0b Test exr-slice-rle failed. Look at tests/data/fate/exr-slice-rle.err for details. make: *** [fate-exr-slice-rle] Error 1 --- ./tests/ref/fate/exr-slice-zip16 2014-05-08 04:14:15.101250540 +0200 +++ tests/data/fate/exr-slice-zip16 2014-05-08 04:29:33.521269886 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x1f656d7a +0, 0, 0, 1, 3169800, 0xdc8f6d0b Test exr-slice-zip16 failed. Look at tests/data/fate/exr-slice-zip16.err for details. make: *** [fate-exr-slice-zip16] Error 1 --- ./tests/ref/fate/exr-slice-zip1 2014-05-08 04:14:15.101250540 +0200 +++ tests/data/fate/exr-slice-zip1 2014-05-08 04:29:33.525269888 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x1f656d7a +0, 0, 0, 1, 3169800, 0xdc8f6d0b [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I do not agree with what you have to say, but I'll defend to the death your right to say it. -- Voltaire
this one fails again: The only things I changed were the defines and used av_intfloat32 to avoid the aliasing problem. There's something more severely broken in
On 07/05/14 23:30, Michael Niedermayer wrote: the test suite. I attach a version with returning av_intfloat32 instead of a float and see if that passes.
On Thu, May 08, 2014 at 10:20:22AM -0300, Gonzalo Garramuno wrote:
On 07/05/14 23:30, Michael Niedermayer wrote:
this one fails again: The only things I changed were the defines and used av_intfloat32 to avoid the aliasing problem. There's something more severely broken in the test suite. I attach a version with returning av_intfloat32 instead of a float and see if that passes.
fails: also can you get rid of all floats int->union->float on the main gamma=1 path ? IIRC they are only used to transport a unchanged value, --- ./tests/ref/fate/exr-slice-raw 2014-05-08 15:37:58.078114782 +0200 +++ tests/data/fate/exr-slice-raw 2014-05-08 15:39:33.578116794 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x1f656d7a +0, 0, 0, 1, 3169800, 0xdc8f6d0b TEST sunraster-24bit-rle Test exr-slice-raw failed. Look at tests/data/fate/exr-slice-raw.err for details. make: *** [fate-exr-slice-raw] Error 1 make: *** Waiting for unfinished jobs.... --- ./tests/ref/fate/exr-slice-rle 2014-05-08 15:37:58.078114782 +0200 +++ tests/data/fate/exr-slice-rle 2014-05-08 15:39:33.598116794 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x1f656d7a +0, 0, 0, 1, 3169800, 0xdc8f6d0b Test exr-slice-rle failed. Look at tests/data/fate/exr-slice-rle.err for details. make: *** [fate-exr-slice-rle] Error 1 --- ./tests/ref/fate/exr-slice-zip16 2014-05-08 15:37:58.082114782 +0200 +++ tests/data/fate/exr-slice-zip16 2014-05-08 15:39:33.622116794 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x1f656d7a +0, 0, 0, 1, 3169800, 0xdc8f6d0b Test exr-slice-zip16 failed. Look at tests/data/fate/exr-slice-zip16.err for details. make: *** [fate-exr-slice-zip16] Error 1 --- ./tests/ref/fate/exr-slice-zip1 2014-05-08 15:37:58.082114782 +0200 +++ tests/data/fate/exr-slice-zip1 2014-05-08 15:39:33.630116795 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x1f656d7a +0, 0, 0, 1, 3169800, 0xdc8f6d0b Test exr-slice-zip1 failed. Look at tests/data/fate/exr-slice-zip1.err for details. make: *** [fate-exr-slice-zip1] Error 1 [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB DNS cache poisoning attacks, popular search engine, Google internet authority dont be evil, please
On 08/05/14 10:43, Michael Niedermayer wrote:
On Thu, May 08, 2014 at 10:20:22AM -0300, Gonzalo Garramuno wrote:
On 07/05/14 23:30, Michael Niedermayer wrote:
this one fails again: The only things I changed were the defines and used av_intfloat32 to avoid the aliasing problem. There's something more severely broken in the test suite. I attach a version with returning av_intfloat32 instead of a float and see if that passes.
fails: also can you get rid of all floats int->union->float on the main gamma=1 path ? IIRC they are only used to transport a unchanged value, Find it attached. In principle this should revert to the old checksums, but when I run fate, it uses the new checksums.
On Thu, May 08, 2014 at 11:30:08AM -0300, Gonzalo Garramuno wrote:
On 08/05/14 10:43, Michael Niedermayer wrote:
On Thu, May 08, 2014 at 10:20:22AM -0300, Gonzalo Garramuno wrote:
On 07/05/14 23:30, Michael Niedermayer wrote:
this one fails again: The only things I changed were the defines and used av_intfloat32 to avoid the aliasing problem. There's something more severely broken in the test suite. I attach a version with returning av_intfloat32 instead of a float and see if that passes.
fails: also can you get rid of all floats int->union->float on the main gamma=1 path ? IIRC they are only used to transport a unchanged value, Find it attached. In principle this should revert to the old checksums, but when I run fate, it uses the new checksums.
still fails: also theres still a float in there in the gamma=1 path: "if ( t.f <= 0.0f ) {" --- ./tests/ref/fate/exr-slice-raw 2014-05-08 17:24:22.886249292 +0200 +++ tests/data/fate/exr-slice-raw 2014-05-08 17:25:54.690251226 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x1f656d7a +0, 0, 0, 1, 3169800, 0x6a356d0d Test exr-slice-raw failed. Look at tests/data/fate/exr-slice-raw.err for details. make: *** [fate-exr-slice-raw] Error 1 make: *** Waiting for unfinished jobs.... --- ./tests/ref/fate/exr-slice-rle 2014-05-08 17:24:22.886249292 +0200 +++ tests/data/fate/exr-slice-rle 2014-05-08 17:25:54.706251225 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x1f656d7a +0, 0, 0, 1, 3169800, 0x6a356d0d Test exr-slice-rle failed. Look at tests/data/fate/exr-slice-rle.err for details. make: *** [fate-exr-slice-rle] Error 1 --- ./tests/ref/fate/exr-slice-zip16 2014-05-08 17:24:22.890249292 +0200 +++ tests/data/fate/exr-slice-zip16 2014-05-08 17:25:54.718251227 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x1f656d7a +0, 0, 0, 1, 3169800, 0x6a356d0d Test exr-slice-zip16 failed. Look at tests/data/fate/exr-slice-zip16.err for details. make: *** [fate-exr-slice-zip16] Error 1 --- ./tests/ref/fate/exr-slice-zip1 2014-05-08 17:24:22.890249292 +0200 +++ tests/data/fate/exr-slice-zip1 2014-05-08 17:25:54.726251227 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x1f656d7a +0, 0, 0, 1, 3169800, 0x6a356d0d Test exr-slice-zip1 failed. Look at tests/data/fate/exr-slice-zip1.err for details. make: *** [fate-exr-slice-zip1] Error 1 [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The greatest way to live with honor in this world is to be what we pretend to be. -- Socrates
On 08/05/14 12:29, Michael Niedermayer wrote:
On Thu, May 08, 2014 at 11:30:08AM -0300, Gonzalo Garramuno wrote:
On 08/05/14 10:43, Michael Niedermayer wrote:
On Thu, May 08, 2014 at 10:20:22AM -0300, Gonzalo Garramuno wrote:
On 07/05/14 23:30, Michael Niedermayer wrote:
this one fails again: The only things I changed were the defines and used av_intfloat32 to avoid the aliasing problem. There's something more severely broken in the test suite. I attach a version with returning av_intfloat32 instead of a float and see if that passes.
fails: also can you get rid of all floats int->union->float on the main gamma=1 path ? IIRC they are only used to transport a unchanged value, Find it attached. In principle this should revert to the old checksums, but when I run fate, it uses the new checksums. still fails:
also theres still a float in there in the gamma=1 path: "if ( t.f <= 0.0f ) {"
No, there's no float in the gamma path: + if ( one_gamma > 0.9999f && one_gamma < 1.0001f ) { + for ( i = 0; i < 65536; ++i ) { + s->gamma_table[i] = exr_halflt2uint(i); + } + }
On 08/05/14 12:29, Michael Niedermayer wrote:
still fails:
also theres still a float in there in the gamma=1 path: "if ( t.f <= 0.0f ) {"
--- ./tests/ref/fate/exr-slice-raw 2014-05-08 17:24:22.886249292 +0200 +++ tests/data/fate/exr-slice-raw 2014-05-08 17:25:54.690251226 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x1f656d7a +0, 0, 0, 1, 3169800, 0x6a356d0d Test exr-slice-raw failed. Look at tests/data/fate/exr-slice-raw.err for details.
[...]
I made a distclean rebuild and now I got the old checksums just like above. In summary, with the gamma table as in the attachment, the chceksums must not be changed. This is what I expected when I created the gamma=1 path.
On Thu, May 08, 2014 at 01:27:56PM -0300, Gonzalo Garramuno wrote:
On 08/05/14 12:29, Michael Niedermayer wrote:
still fails:
also theres still a float in there in the gamma=1 path: "if ( t.f <= 0.0f ) {"
--- ./tests/ref/fate/exr-slice-raw 2014-05-08 17:24:22.886249292 +0200 +++ tests/data/fate/exr-slice-raw 2014-05-08 17:25:54.690251226 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x1f656d7a +0, 0, 0, 1, 3169800, 0x6a356d0d Test exr-slice-raw failed. Look at tests/data/fate/exr-slice-raw.err for details.
[...]
I made a distclean rebuild and now I got the old checksums just like above. In summary, with the gamma table as in the attachment, the chceksums must not be changed. This is what I expected when I created the gamma=1 path.
seems to work applied thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Rewriting code that is poorly written but fully understood is good. Rewriting code that one doesnt understand is a sign that one is less smart then the original author, trying to rewrite it will not make it better.
On 02/05/14 19:54, Michael Niedermayer wrote:
On Fri, May 02, 2014 at 11:22:49AM -0300, Gonzalo Garramuno wrote:
on arm32: --- /home/michael/ffmpeg-git/ffmpeg/tests/ref/fate/exr-slice-raw 2014-05-02 05:37:07.676760799 +0200 +++ tests/data/fate/exr-slice-raw 2014-05-03 00:37:24.306202155 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x6a356d0d +0, 0, 0, 1, 3169800, 0x1f656d7a This one is not failing. It's got the right new checksum ( 0x1f656d7a ).
On Sat, May 03, 2014 at 05:28:34PM -0300, Gonzalo Garramuno wrote:
On 02/05/14 19:54, Michael Niedermayer wrote:
On Fri, May 02, 2014 at 11:22:49AM -0300, Gonzalo Garramuno wrote:
on arm32: --- /home/michael/ffmpeg-git/ffmpeg/tests/ref/fate/exr-slice-raw 2014-05-02 05:37:07.676760799 +0200 +++ tests/data/fate/exr-slice-raw 2014-05-03 00:37:24.306202155 +0200 @@ -1,2 +1,2 @@ #tb 0: 1/25 -0, 0, 0, 1, 3169800, 0x6a356d0d
+0, 0, 0, 1, 3169800, 0x1f656d7a This one is not failing. It's got the right new checksum ( 0x1f656d7a ).
yes and the patch was missing the "right new checksum" [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB it is not once nor twice but times without number that the same ideas make their appearance in the world. -- Aristotle
On 02/05/14 00:37, Gonzalo Garramuno wrote:
On 01/05/14 18:45, Michael Niedermayer wrote:
still fails fate, and the image does not look ok that its produced there are individual green pixels in dark areas, so id guess something is overflowing
[...]
Can you do a distclean and a clean compile? I had the green areas showing bad in a previous patch because of not checking the values that go into the powf function. However, the latest patch does check both in the float path and in the table path and I get a clean image on my end. And the fate checksums work for me and Carl.
I just tried on my system and the tests passed. - Jimmy
On 02/05/14 08:15, Jimmy Christensen wrote:
On 02/05/14 00:37, Gonzalo Garramuno wrote:
On 01/05/14 18:45, Michael Niedermayer wrote:
still fails fate, and the image does not look ok that its produced there are individual green pixels in dark areas, so id guess something is overflowing
[...]
Can you do a distclean and a clean compile? I had the green areas showing bad in a previous patch because of not checking the values that go into the powf function. However, the latest patch does check both in the float path and in the table path and I get a clean image on my end. And the fate checksums work for me and Carl.
I just tried on my system and the tests passed.
Regarding the gamma. Does ffmpeg in general expect an RGB gamma of 2.2 always? In that case should it not be considered when defining the gamma. I'm thinking that you define the source to be gamma 1.0 so it can apply gamma 2.2? And nothing when you define the source to be gamma 2.2? - Jimmy
participants (10)
-
Carl Eugen Hoyos -
Clément Bœsch -
FFMPEG_UL -
Gonzalo Garramuno -
Jimmy Christensen -
Michael Niedermayer -
Nicolas George -
Peter Ross -
Reimar Döffinger -
Ronald S. Bultje