Re: [FFmpeg-devel] compile error caused by configure script's change

2017-03-22 Thread Dzung Hoang
I banged my head against this and finally figured out that opencv 3.2.0 does 
not support C language binding. You need to get opencv 2.4.13.


  From: Masaru Nomiya 
 To: ffmpeg-devel@ffmpeg.org 
 Sent: Wednesday, March 22, 2017 9:38 PM
 Subject: [FFmpeg-devel] compile error caused by configure script's change
   
Hello,

I got the very latest git head, and tried to compile.
But, with ./configure's run, I got an error message as follows;

[...]
gcc -L/usr/local/cuda/lib64 -Wl,--as-needed -Wl,-z,noexecstack -o 
/tmp/ffconf.G0t8P470 /tmp/ffconf.3kiEFzc2.o -lopencv_core -lopencv_imgproc 
-lopencore-amrwb -lopencore-amrnb -lnut -lmp3lame -L/usr/local/lib64 -lmodplug 
-lilbc -lgsm -lfreetype -lfontconfig -lfreetype -lflite_cmu_time_awb 
-lflite_cmu_us_awb -lflite_cmu_us_kal -lflite_cmu_us_kal16 -lflite_cmu_us_rms 
-lflite_cmu_us_slt -lflite_usenglish -lflite_cmulex -lflite -L/usr/local/lib64 
-lfdk-aac -lcaca -lcelt0 -lcelt0 -lbs2b -L/usr/local/lib64 -lbluray 
-L/usr/local/lib64 -lass -lraw1394 -lavc1394 -lrom1394 -liec61883 -lgnutls 
-lgmp -lcrystalhd -lm -llzma -lbz2 -lz -pthread
/tmp/ffconf.3kiEFzc2.o: In function `cvPointFrom32f':
ffconf.ZvXFCPIK.c:(.text+0x5fe): undefined reference to `cvRound'
ffconf.ZvXFCPIK.c:(.text+0x618): undefined reference to `cvRound'
/tmp/ffconf.3kiEFzc2.o: In function `cvReadInt':
ffconf.ZvXFCPIK.c:(.text+0xf40): undefined reference to `cvRound'
collect2: error: ld returned 1 exit status
ERROR: opencv not found

I installed opencv 3.2.0 last December. So, I suspected the configure
script.
With the configure script of 21th Mar, the compilation ended without
any problem.

I checked the difference of 2 configure scripts, but I can't find the
change which cause the problem.

Thanks,

---
┏━━┓彡 Masaru Nomiya            mail-to: nomiya @ galaxy.dti.ne.jp
┃\/彡
┗━━┛ "Bill! You married with Computers.
          Not with Me!"
        "No..., with money."
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


   
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/exr detect invalid line offset table and recreate table

2017-03-21 Thread Dzung Hoang
Sorry about the bad format for the patch. Here's another try.

--- 
libavcodec/exr.c | 18 ++ 
1 file changed, 18 insertions(+) 

diff --git a/libavcodec/exr.c b/libavcodec/exr.c 
index 034920f..265d44d 100644 
--- a/libavcodec/exr.c 
+++ b/libavcodec/exr.c 
@@ -1640,6 +1640,9 @@ static int decode_frame(AVCodecContext *avctx, void 
*data, 
int out_line_size; 
int nb_blocks;/* nb scanline or nb tile */ 

+uint64_t *table;/* scanline offset table */ 
+uint8_t *marker;/* used to recreate invalid scanline offset table */ 
+ 
bytestream2_init(>gb, avpkt->data, avpkt->size); 

if ((ret = decode_header(s, picture)) < 0) 
@@ -1731,6 +1734,21 @@ static int decode_frame(AVCodecContext *avctx, void 
*data, 
s->buf_size = avpkt->size; 
ptr = picture->data[0]; 

+// check offset table 
+if (!s->is_tile && bytestream2_peek_le64(>gb) == 0) 
+{ 
+table = (uint64_t *)s->gb.buffer; 
+marker = avpkt->data + bytestream2_tell(>gb) + nb_blocks * 8; 
+ 
+av_log(s->avctx, AV_LOG_DEBUG, "recreating invalid scanline offset 
table\n"); 
+ 
+for (y = 0; y < nb_blocks; y++) 
+{ 
+table[y] = marker - s->buf; 
+marker += ((uint32_t *)marker)[1] + 8; 
+} 
+} 
+ 
// Zero out the start if ymin is not 0 
for (y = 0; y < s->ymin; y++) { 
memset(ptr, 0, out_line_size); 
-- 
2.1.4 
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/exr detect invalid line offset table and recreate table

2017-03-21 Thread Dzung Hoang
Thanks Martin for your comments. I made the requested changes here.

--- libavcodec/exr.c | 18 ++ 1 file changed, 18 insertions(+)
diff --git a/libavcodec/exr.c b/libavcodec/exr.cindex 034920f..265d44d 
100644--- a/libavcodec/exr.c+++ b/libavcodec/exr.c@@ -1640,6 +1640,9 @@ static 
int decode_frame(AVCodecContext *avctx, void *data,     int out_line_size;     
int nb_blocks;/* nb scanline or nb tile */
+    uint64_t *table;/* scanline offset table */+    uint8_t *marker;/* used to 
recreate invalid scanline offset table */+     bytestream2_init(>gb, 
avpkt->data, avpkt->size);
     if ((ret = decode_header(s, picture)) < 0)@@ -1731,6 +1734,21 @@ static 
int decode_frame(AVCodecContext *avctx, void *data,     s->buf_size = 
avpkt->size;     ptr         = picture->data[0];
+    // check offset table+    if (!s->is_tile && bytestream2_peek_le64(>gb) 
== 0)+    {+        table = (uint64_t *)s->gb.buffer;+        marker = 
avpkt->data + bytestream2_tell(>gb) + nb_blocks * 8;++        
av_log(s->avctx, AV_LOG_DEBUG, "recreating invalid scanline offset table\n");++ 
       for (y = 0; y < nb_blocks; y++)+        {+            table[y] = marker 
- s->buf;+            marker += ((uint32_t *)marker)[1] + 8;+        }+    }+   
  // Zero out the start if ymin is not 0     for (y = 0; y < s->ymin; y++) {    
     memset(ptr, 0, out_line_size);--2.1.4



  From: Martin Vignali 
 To: FFmpeg development discussions and patches  
 Sent: Saturday, March 18, 2017 7:14 AM
 Subject: Re: [FFmpeg-devel] [PATCH] avcodec/exr detect invalid line offset 
table and recreate table
   
Hello,

I tested your patch on mac, seems to work, and doesn't break exr fate test.

Some comments :


> ---
>  libavcodec/exr.c | 19 +++
>  1 file changed, 19 insertions(+)
>
> diff --git a/libavcodec/exr.c b/libavcodec/exr.c
> index 034920f..dec21af 100644
> --- a/libavcodec/exr.c
> +++ b/libavcodec/exr.c
> @@ -1726,6 +1726,25 @@ static int decode_frame(AVCodecContext *avctx, void
> *data,
>    if (bytestream2_get_bytes_left(>gb) < nb_blocks * 8)
>        return AVERROR_INVALIDDATA;
>
> +    // check line offset table and recreate if first entry is 0
> +    if (bytestream2_peek_le64(>gb) == 0)
> +    {
>
You should probably test if the file is in scanline (using s->is_tile).
After taking a quick look to the official library, this table
reconstruction seems to be only for scanline picture.


> +        uint64_t *table = (uint64_t *)s->gb.buffer;
> +        uint8_t *head = avpkt->data;
> +        uint8_t *marker = head + bytestream2_tell(>gb) + nb_blocks * 8;
>

You should probably move variable declaration to the top of the function.


> +
> +        av_log(s->avctx, AV_LOG_INFO, "Recreating invalid offset
> table.\n");
> +
> +        // recreate the line offset table using the length field for each
> line
> +        // decode_block() will check for out-of-bounds offsets, so do not
> bother
> +        // to check here
> +        for (y = 0; y < nb_blocks; y++)
> +        {
> +            table[y] = marker - head;
> +            marker += ((uint32_t *)marker)[1] + 8;
> +        }
> +    }
> +
>
>
    // save pointer we are going to use in decode_block
>    s->buf      = avpkt->data;
>    s->buf_size = avpkt->size;
> --
>

You should also add a fate test for a short sample.


Martin
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


   
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/exr detect invalid line offset table and recreate table

2017-03-17 Thread Dzung Hoang
Since there are no comments since March 14, I assume this patch is good to go. 
I tried to commit the patch and push it to the mirror on github.com, but was 
denied access.
Can a developer please apply and commit this patch?
Thanks,- Dzung Hoang


  From: Dzung Hoang <dthoang-at-yahoo@ffmpeg.org>
 To: FFmpeg Development Discussions and Patches <ffmpeg-devel@ffmpeg.org> 
 Sent: Tuesday, March 14, 2017 1:36 PM
 Subject: [FFmpeg-devel] [PATCH] avcodec/exr detect invalid line offset table 
and recreate table
   
The EXR decoder cannot handle the image files included in NVidia's HDR SDK. 
After debugging, I found that the line offset table in the image files 
contained 0's. Other EXR decoders, including the official OpenEXR decoder, can 
detect and reconstruct missing line offset tables, so I added some code to do 
so.

I filed a trac ticket for this issue here:

https://trac.ffmpeg.org/ticket/6220.

The image files are here:

http://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket6220/

Dzung Hoang
Signed-off-by: Dzung Hoang <dtho...@yahoo.com>

---
 libavcodec/exr.c | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index 034920f..dec21af 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -1726,6 +1726,25 @@ static int decode_frame(AVCodecContext *avctx, void 
*data,
    if (bytestream2_get_bytes_left(>gb) < nb_blocks * 8)
        return AVERROR_INVALIDDATA;

+    // check line offset table and recreate if first entry is 0
+    if (bytestream2_peek_le64(>gb) == 0)
+    {
+        uint64_t *table = (uint64_t *)s->gb.buffer;
+        uint8_t *head = avpkt->data;
+        uint8_t *marker = head + bytestream2_tell(>gb) + nb_blocks * 8;
+
+        av_log(s->avctx, AV_LOG_INFO, "Recreating invalid offset table.\n");
+
+        // recreate the line offset table using the length field for each line
+        // decode_block() will check for out-of-bounds offsets, so do not 
bother
+        // to check here
+        for (y = 0; y < nb_blocks; y++)
+        {
+            table[y] = marker - head;
+            marker += ((uint32_t *)marker)[1] + 8;
+        }
+    }
+
    // save pointer we are going to use in decode_block
    s->buf      = avpkt->data;
    s->buf_size = avpkt->size;
--
2.1.4
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


   
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avcodec/exr detect invalid line offset table and recreate table

2017-03-14 Thread Dzung Hoang
The EXR decoder cannot handle the image files included in NVidia's HDR SDK. 
After debugging, I found that the line offset table in the image files 
contained 0's. Other EXR decoders, including the official OpenEXR decoder, can 
detect and reconstruct missing line offset tables, so I added some code to do 
so.

I filed a trac ticket for this issue here:

https://trac.ffmpeg.org/ticket/6220.

The image files are here:

http://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket6220/

Dzung Hoang
Signed-off-by: Dzung Hoang <dtho...@yahoo.com>

---
 libavcodec/exr.c | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/libavcodec/exr.c b/libavcodec/exr.c
index 034920f..dec21af 100644
--- a/libavcodec/exr.c
+++ b/libavcodec/exr.c
@@ -1726,6 +1726,25 @@ static int decode_frame(AVCodecContext *avctx, void 
*data,
 if (bytestream2_get_bytes_left(>gb) < nb_blocks * 8)
 return AVERROR_INVALIDDATA;

+// check line offset table and recreate if first entry is 0
+if (bytestream2_peek_le64(>gb) == 0)
+{
+uint64_t *table = (uint64_t *)s->gb.buffer;
+uint8_t *head = avpkt->data;
+uint8_t *marker = head + bytestream2_tell(>gb) + nb_blocks * 8;
+
+av_log(s->avctx, AV_LOG_INFO, "Recreating invalid offset table.\n");
+
+// recreate the line offset table using the length field for each line
+// decode_block() will check for out-of-bounds offsets, so do not 
bother
+// to check here
+for (y = 0; y < nb_blocks; y++)
+{
+table[y] = marker - head;
+marker += ((uint32_t *)marker)[1] + 8;
+}
+}
+
 // save pointer we are going to use in decode_block
 s->buf  = avpkt->data;
 s->buf_size = avpkt->size;
--
2.1.4
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/exr

2017-03-14 Thread Dzung Hoang
What is the next step to get this issue resolved?
Dzung Hoang

  From: Carl Eugen Hoyos <ceffm...@gmail.com>
 To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> 
 Sent: Tuesday, March 7, 2017 2:02 AM
 Subject: Re: [FFmpeg-devel] [PATCH] avcodec/exr
   
2017-03-06 18:24 GMT+01:00 Paul B Mahol <one...@gmail.com>:
> On 3/6/17, Dzung Hoang <dthoang-at-yahoo@ffmpeg.org> wrote:
>> The EXR decoder cannot handle the image files included in NVidia's HDR SDK.
>> After debugging, I found that the line offset table in the image files
>> contained 0's. Other EXR decoders, including the official OpenEXR decoder,
>> can detect and reconstruct missing line offset tables, so I added some code
>> to do so.
>> I filed a trac ticket for this issue here:
>> https://trac.ffmpeg.org/ticket/6220.
>
> Do you have files with this issue?

http://samples.ffmpeg.org/ffmpeg-bugs/trac/ticket6220/

Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


   
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] libavcodec/psd : add support for rgb/gray float

2017-03-07 Thread Dzung Hoang
I implemented a 32-bit float GBRAP/GBRP pixel format and used it in vf_zscale.c 
and vf_overlay.c. I also implemented an EXR encoder using miniexr that uses the 
new float pixel format. I can contribute this if there is interest.
I used the above mods to do HDR video processing that includes overlaying HDR 
and SDR video. IMHO, for ffmpeg to handle HDR video well, float and half-float 
are needed and also metadata to signal the color space and transfer function 
for each picture. It's a big job that can touch a lot of code, which is why I 
kept my changes private and limited to only what I need.


  From: Martin Vignali 
 To: FFmpeg development discussions and patches  
 Sent: Tuesday, March 7, 2017 4:16 PM
 Subject: Re: [FFmpeg-devel] libavcodec/psd : add support for rgb/gray float
   
Hello

@Carl :
I make some tests in order to avoid temp buffer, but i have some strange
result, when i not use a temp buffer.


> Time to think about a float pixfmt? I find it weird that we support
> excessively obscure pixfmts like AV_PIX_FMT_BGR4_BYTE, but then have
> hacks like this one if the codec uses float data.
>
> (I'm just commenting, not arguing for/against your actual patch.)
>
I agree with your comment.
Float pixfmt is a more clean way.
it can also be useful for image processing with filters, and encoding float
data.

Any tips to add support for float pixfmts ?
I try to take a look to the source code, but it's not very easy to
understand.

Martin
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


   
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/exr

2017-03-07 Thread Dzung Hoang
I uploaded rle_grayscale_noffset.exr using the videolan file uploader.
The rle_grayscale_nooffset.exr image was modified from 
https://trac.ffmpeg.org/raw-attachment/ticket/5621/rle_grayscale.exr by zeroing 
out the line offset table. The modified file is viewable with Adobe Photoshop 
but results in a blank image when processed by ffmpeg.
Let me know if you need additional test images.
Regards,- Dzung Hoang


  From: Paul B Mahol <one...@gmail.com>
 To: dtho...@yahoo.com 
 Sent: Monday, March 6, 2017 11:37 AM
 Subject: Re: [FFmpeg-devel] [PATCH] avcodec/exr
   
On 3/6/17, Dzung Hoang <dthoang-at-yahoo@ffmpeg.org> wrote:
> The EXR decoder cannot handle the image files included in NVidia's HDR
> SDK.
> After debugging, I found that the line offset table in the image files
> contained 0's. Other EXR decoders, including the official OpenEXR
> decoder,
> can detect and reconstruct missing line offset tables, so I added some
> code
> to do so.
> I filed a trac ticket for this issue here:
> https://trac.ffmpeg.org/ticket/6220.
>

 Do you have files with this issue?


   
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] avcodec/exr

2017-03-06 Thread Dzung Hoang
The EXR decoder cannot handle the image files included in NVidia's HDR SDK. 
After debugging, I found that the line offset table in the image files 
contained 0's. Other EXR decoders, including the official OpenEXR decoder, can 
detect and reconstruct missing line offset tables, so I added some code to do 
so.
I filed a trac ticket for this issue here: https://trac.ffmpeg.org/ticket/6220.


The patch is below.
Regards,Dzung Hoang


diff --git a/libavcodec/exr.c b/libavcodec/exr.c

index 034920f..de48e76 100644

--- a/libavcodec/exr.c

+++ b/libavcodec/exr.c

@@ -1726,6 +1726,24 @@ static intdecode_frame(AVCodecContext *avctx, void *data,

if(bytestream2_get_bytes_left(>gb) < nb_blocks * 8)

 returnAVERROR_INVALIDDATA;


 
+    // check offset table

+    if (bytestream2_peek_le64(>gb)== 0)

+    {

+    uint64_t *table= (uint64_t *)s->gb.buffer;

+    uint8_t *head =avpkt->data;

+    uint8_t *marker= head + bytestream2_tell(>gb) + nb_blocks * 8;

+    uint64_t offset;

+

+   av_log(s->avctx, AV_LOG_DEBUG, "recreating invalid offsettable\n");

+

+    for (y = 0; y< nb_blocks; y++)

+    {

+   offset = marker - head;

+   table[y] = offset;

+   marker += ((uint32_t *)marker)[1] + 8;

+    }

+    }

+

 // save pointer we are going to usein decode_block

s->buf  = avpkt->data;

 s->buf_size = avpkt->size;


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel