Opened 13 years ago

Closed 13 years ago

#328 closed defect (invalid)

PGM to JPEG-LS identify error

Reported by: sebastian0 Owned by: Michael Niedermayer
Priority: normal Component: undetermined
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Hello dear mailinglist,
I've got a problem with the convertion from PGM to JPEG-LS.

$ file barbara-pgm.pgm
barbara-pgm.pgm: Netpbm PGM "rawbits" image data
$ identify barbara-pgm.pgm
barbara-pgm.pgm PNM 720x576 720x576+0+0 8-bit Grayscale DirectClass 405KiB
0.000u 0:00.000

$ ffmpeg -f image2 -vcodec pgm -pix_fmt gray16be -i barbara-pgm.pgm -f image2
-vcodec jpegls -pix_fmt gray16le barbara-ffmpeg-tojpegls.jls

$ file barbara-ffmpeg-tojpegls.jls
barbara-ffmpeg-tojpegls.jls: JPEG image data
$ identify barbara-ffmpeg-tojpegls.jls
identify: Unsupported marker type 0xf7 `barbara-ffmpeg-tojpegls.jls' @
jpeg.c/EmitMessage/232.

But it should look like (it's also JPEG-LS but not created with ffmpeg):
$ identify barbara-compressed.pgm
identify: Improper image header `barbara-compressed.pgm' @
pnm.c/ReadPNMImage/297.
$ file barbara-compressed.pgm
barbara-compressed.pgm: data

I also played around with "gray16be" and "gray16le" but this doesn't work out.

---
FFmpeg version SVN-r0.5.1-4:0.5.1-1ubuntu1.1, Copyright (c) 2000-2009 Fabrice
Bellard, et al.

configuration: --extra-version=4:0.5.1-1ubuntu1.1 --prefix=/usr

--enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib
--enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora
--enable-libvorbis --enable-pthreads --enable-zlib --disable-stripping
--disable-vhook --enable-runtime-cpudetect --enable-gpl --enable-postproc
--enable-swscale --enable-x11grab --enable-libdc1394 --enable-shared
--disable-static

libavutil 49.15. 0 / 49.15. 0
libavcodec 52.20. 1 / 52.20. 1
libavformat 52.31. 0 / 52.31. 0
libavdevice 52. 1. 0 / 52. 1. 0
libavfilter 0. 4. 0 / 0. 4. 0
libswscale 0. 7. 1 / 0. 7. 1
libpostproc 51. 2. 0 / 51. 2. 0
built on Mar 31 2011 18:53:20, gcc: 4.4.3

---

What should I do to get valid JPEG-LS data?

Best regards,

Sebastian Wieseler

Change History (9)

comment:1 by Carl Eugen Hoyos, 13 years ago

Component: FFmpegundetermined
Status: newopen

Your version of FFmpeg is several years old. Unfortunately, we do not have the manpower to support such old versions. Please test latest git head and if the problem is still reproducible for you, please post complete, uncut output of your encoding command (including the command line) here and please explain what is wrong with the resulting file. (Or are you simply worried by the output of identify?)

comment:2 by sebastian0, 13 years ago

Yes, tested it with very latest HEAD-git-version this morning, and... it still failes.
I am worry about the identify output.

I have an university project with a JPEG-LS implementation (en/decrypt) which is only able to work with gray (pgm) images.
So I tried to interchange with ffmpeg, but it seems incompatible at all. Encode a pgm to jpeg-ls with ffmpeg and tried to decode it back with my source code from university, it failed all the time.

So my current tasks was actually, to implement color images (ppm), but I do not know how. ;(

So is this actually a ffmpeg bug, or simply the "they do not work together" note? :/

comment:3 by Carl Eugen Hoyos, 13 years ago

Could you post complete, uncut output and the command line you used?

comment:4 by sebastian0, 13 years ago

sebastian@sebastian-desktop:~/Documents$ ffmpeg -f image2 -vcodec pgm -i barbara-pgm.pgm -f image2 -pix_fmt gray16le -vcodec jpegls barbara-from_pgm_to_jls.jls
ffmpeg version 0.7, Copyright (c) 2000-2011 the FFmpeg developers

built on Jul 4 2011 10:40:30 with gcc 4.4.3
configuration:
libavutil 51. 11. 0 / 51. 11. 0
libavcodec 53. 7. 0 / 53. 7. 0
libavformat 53. 5. 0 / 53. 5. 0
libavdevice 53. 2. 0 / 53. 2. 0
libavfilter 2. 24. 1 / 2. 24. 1
libswscale 2. 0. 0 / 2. 0. 0

Input #0, image2, from 'barbara-pgm.pgm':

Duration: 00:00:00.04, start: 0.000000, bitrate: N/A

Stream #0.0: Video: pgm, gray, 720x576, 25 tbr, 25 tbn, 25 tbc

[buffer @ 0x984c4a0] w:720 h:576 pixfmt:gray tb:1/1000000 sar:0/1 sws_param:
[buffersink @ 0x984bde0] auto-inserting filter 'auto-inserted scaler 0' between the filter 'src' and the filter 'out'
[scale @ 0x984d0c0] w:720 h:576 fmt:gray -> w:720 h:576 fmt:gray16le flags:0x4
Output #0, image2, to 'barbara-from_pgm_to_jls.jls':

Metadata:

encoder : Lavf53.5.0
Stream #0.0: Video: jpegls, gray16le, 720x576, q=2-31, 200 kb/s, 90k tbn, 25 tbc

Stream mapping:

Stream #0.0 -> #0.0

Press [q] to stop, ? for help
frame= 1 fps= 0 q=0.0 Lsize= -0kB time=00:00:00.04 bitrate= -4.4kbits/s
video:660kB audio:0kB global headers:0kB muxing overhead -100.003254%
sebastian@sebastian-desktop:~/Documents$ JPEG-LS2fast/d_locom -i barbara-from_pgm_to_jls.jls -o barbara-from_jls_to_pgm.pgm

Decoding, image decoder JPEG-LS v05/2001

Input (d_JPEG-LS): barbara-from_pgm_to_jls.jls
Output (d_JPEG-LS): barbara-from_jls_to_pgm.pgmNot a JPEG-LSm-Stream!

T1=127, T2=224, T3=945 LIMIT=32298123 RESET=128

Dauer 0.000 Sekunden

ready.
sebastian@sebastian-desktop:~/Documents$

comment:5 by Carl Eugen Hoyos, 13 years ago

(Please note that you are not using latest git head and, unfortunately, the version you are using is not supported, only the branches master and oldabi and currently the releases 0.7.1 and 0.8 are.)
I tested the following:

./ffmpeg -i tests/lena.pnm -f image2 -pix_fmt gray16le -vcodec jpegls out.jls
ffmpeg version N-31202-g976a8b2, Copyright (c) 2000-2011 the FFmpeg developers
  built on Jul  4 2011 10:37:33 with gcc 4.5.3
  configuration: --cc=/usr/local/gcc-4.5.3/bin/gcc --enable-gpl --enable-libopencore-amrnb --enable-version3
  libavutil    51. 11. 0 / 51. 11. 0
  libavcodec   53.  7. 0 / 53.  7. 0
  libavformat  53.  5. 0 / 53.  5. 0
  libavdevice  53.  2. 0 / 53.  2. 0
  libavfilter   2. 24. 1 /  2. 24. 1
  libswscale    2.  0. 0 /  2.  0. 0
  libpostproc  51.  2. 0 / 51.  2. 0
Input #0, image2, from 'tests/lena.pnm':
  Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
    Stream #0.0: Video: ppm, rgb24, 256x256, 25 tbr, 25 tbn, 25 tbc
[buffer @ 0x12cbd60] w:256 h:256 pixfmt:rgb24 tb:1/1000000 sar:0/1 sws_param:
[buffersink @ 0x12cb1e0] auto-inserting filter 'auto-inserted scaler 0' between the filter 'src' and the filter 'out'
[scale @ 0x12c4720] w:256 h:256 fmt:rgb24 -> w:256 h:256 fmt:gray16le flags:0x4
Output #0, image2, to 'out.jls':
  Metadata:
    encoder         : Lavf53.5.0
    Stream #0.0: Video: jpegls, gray16le, 256x256, q=2-31, 200 kb/s, 90k tbn, 25 tbc
Stream mapping:
  Stream #0.0 -> #0.0
Press [q] to stop, [?] for help
frame=    1 fps=  0 q=0.0 Lsize=      -0kB time=00:00:00.04 bitrate=  -4.4kbits/s
video:99kB audio:0kB global headers:0kB muxing overhead -100.021595%

The resulting file out.jls decodes fine with ffmpeg and the UBC implementation of jpeg-ls, V.2.2

comment:6 by sebastian0, 13 years ago

http://www.ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2:
ffmpeg version 0.7, Copyright (c) 2000-2011 the FFmpeg developers

built on Jul 5 2011 09:51:41 with gcc 4.4.3

Dunno. This is the git-HEAD-snapshot, right? O.o

But, anyway, let's have a look on the hexdumps:

$ most xxx.jls # created with ffmpeg from pgm
0x00000000: FFD8FFF7 00110802 4002D003 01110002 ........@.......
0x00000010: 11000311 00FFDA00 0C030100 02000300 ................
0x00000020: 00010001 E57FFF69 FF7FFF7F FF7FF4F9 .......i........
0x00000030: 3FFF7FFF 7FFF7FEC FF7FFF7A 7FD3FF69 ?..........z...i
0x00000040: E9FF7FFF 7FFF727F FF13E9FF 7FF4FE4F ......r........O
0x00000050: FF508601 000001EB 00003F9C F19FA70C .P........?.....
0x00000060: 6ED6AC95 535B377B 953BA8B8 ABC0401C n...S[7{.;....@.
...

$ most xxx.jls # created by the university project JPEG-LS2FAST
0x00000000: 4C530002 D0024000 FFFA8079 5FFFF4FF LS....@....y_...
0x00000010: FFFFFFFF FFD3E4FF FFFFFFFF FFFD9FFF ................
0x00000020: FFFD3FE9 FFE9E9FF FFFFFFFF 93FFF93E ..?............>
0x00000030: 9FFFFE9F C9FFF421 80400000 76002FCE .......!.@..v./.
...

Do you see the "LS" at the beginning on the second hexdump?
I think that's why the identify on the last one works, and on the ffmpeg one fails.

So isn't this a bad behaviour?

comment:7 by Carl Eugen Hoyos, 13 years ago

Both the samples that come with the UBC implementation of jpeg-ls and the samples from CharLS start with "ff dx", but I suspect you can quote the specification (which is much better than using ImageMagick as a reference - perhaps you should tell them they do not support the sample files from those projects)?

comment:8 by sebastian0, 13 years ago

Okay. Finally. My teacher told me, that the jpeg-ls2fast does not follow the "normal" JPEG-LS guidlines. So, please, I am so sorry. Close this bug report. :(

I am now on my own. :(

comment:9 by Carl Eugen Hoyos, 13 years ago

Resolution: invalid
Status: openclosed

Thank you for the clarification.

Note: See TracTickets for help on using tickets.