[FFmpeg-devel] lavc/tiff: Decode embedded JPEGs in DNG images

Submitted by velocityra@gmail.com on July 24, 2019, 10:05 a.m.

Details

Message ID 20190724100544.29560-1-velocityra@gmail.com
State New
Headers show

Commit Message

velocityra@gmail.com July 24, 2019, 10:05 a.m.
From: Nick Renieris <velocityra@gmail.com>

Used a technique similar to lavc/tdsc.c for invoking the MJPEG decoder.

This commit adds support for:
- DNG tiles
- DNG tile huffman lossless JPEG decoding
- DNG color scaling [1]
  - LinearizationTable tag
  - BlackLevel tag

[1]: As specified in the DNG Specification - Chapter 5

Signed-off-by: Nick Renieris <velocityra@gmail.com>
---
 libavcodec/tiff.c | 16 ----------------
 1 file changed, 16 deletions(-)

Comments

velocityra@gmail.com July 24, 2019, 10:14 a.m.
The latest patch is unrelated to the gamma stuff (which in hindsight
isn't accurately implemented, so never mind), it has a regression fix
for z8pf.dng and adds compatibility to the following:
https://www.camerafv5.com/pages/raw-samples.php
https://www.camerafv5.com/pages/nexus6-raw-samples.php
https://www.chris-juettner.de/projekte/raw-samples-comparison-download/dji-mavic-air
etc

>Do you plan to implement camera native RGB to CIE XYZ mapping as specified
in DNG Spec 1.4.0.0 Chapter 6 ?

Perhaps. I haven't looked at it much but it may be too much work for
the time I have left, I will talk with my mentor on whether to
prioritize it (a lot of images look fine without it).

Στις Τετ, 24 Ιουλ 2019 στις 1:06 μ.μ., ο/η <velocityra@gmail.com> έγραψε:
>
> From: Nick Renieris <velocityra@gmail.com>
>
> Used a technique similar to lavc/tdsc.c for invoking the MJPEG decoder.
>
> This commit adds support for:
> - DNG tiles
> - DNG tile huffman lossless JPEG decoding
> - DNG color scaling [1]
>   - LinearizationTable tag
>   - BlackLevel tag
>
> [1]: As specified in the DNG Specification - Chapter 5
>
> Signed-off-by: Nick Renieris <velocityra@gmail.com>
> ---
>  libavcodec/tiff.c | 16 ----------------
>  1 file changed, 16 deletions(-)
>
> diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
> index 423eaf0647..4f6ba256c6 100644
> --- a/libavcodec/tiff.c
> +++ b/libavcodec/tiff.c
> @@ -280,19 +280,6 @@ static void av_always_inline horizontal_fill(TiffContext *s,
>                                               int usePtr, const uint8_t *src,
>                                               uint8_t c, int width, int offset)
>  {
> -    /* Handle DNG images with uncompressed strips (non-tiled) */
> -    if (s->tiff_type == TIFF_TYPE_DNG || s->tiff_type == TIFF_TYPE_CINEMADNG) {
> -        dng_blit(s,
> -                 dst + offset,
> -                 width,
> -                 src,
> -                 width,
> -                 width,
> -                 1,
> -                 0);
> -        return;
> -    }
> -
>      switch (bpp) {
>      case 1:
>          while (--width >= 0) {
> @@ -1799,9 +1786,6 @@ again:
>          } else if (s->is_tiled) {
>              av_log(avctx, AV_LOG_ERROR, "DNG uncompressed tiled images are not supported\n");
>              return AVERROR_PATCHWELCOME;
> -        } else if (s->bpp != 8) {
> -            av_log(avctx, AV_LOG_ERROR, "DNG uncompressed non-tiled non-8bpp images are not supported\n");
> -            return AVERROR_PATCHWELCOME;
>          }
>      }
>
> --
> 2.21.0.windows.1
>

Patch hide | download patch | download mbox

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index 423eaf0647..4f6ba256c6 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -280,19 +280,6 @@  static void av_always_inline horizontal_fill(TiffContext *s,
                                              int usePtr, const uint8_t *src,
                                              uint8_t c, int width, int offset)
 {
-    /* Handle DNG images with uncompressed strips (non-tiled) */
-    if (s->tiff_type == TIFF_TYPE_DNG || s->tiff_type == TIFF_TYPE_CINEMADNG) {
-        dng_blit(s,
-                 dst + offset,
-                 width,
-                 src,
-                 width,
-                 width,
-                 1,
-                 0);
-        return;
-    }
-
     switch (bpp) {
     case 1:
         while (--width >= 0) {
@@ -1799,9 +1786,6 @@  again:
         } else if (s->is_tiled) {
             av_log(avctx, AV_LOG_ERROR, "DNG uncompressed tiled images are not supported\n");
             return AVERROR_PATCHWELCOME;
-        } else if (s->bpp != 8) {
-            av_log(avctx, AV_LOG_ERROR, "DNG uncompressed non-tiled non-8bpp images are not supported\n");
-            return AVERROR_PATCHWELCOME;
         }
     }