gstreamer/subprojects
Marek Vasut e6d83d8f96 jpegdec: Support libjpeg-turbo colorspace conversion
The libjpeg-turbo has a built-in support for performing colorspace
conversion. The performance of this conversion is much better than
doing the same separately using videoconvert. Implement support for
this conversion to RGBx/xRGB/BGRx/xBGR formats. Other formats can
be easily added later.

- The decoding of various pixel formats can be tested and compared to
  non-libjpeg-turbo decoding as follows:
  for gfmt in {RGB,BGR}{,x} x{RGB,BGR} ; do
      echo "$gfmt"
      gst-launch-1.0 -q \
          videotestsrc pattern=colors ! \
          video/x-raw,format=${gfmt} ! \
          fakesink dump=true | \
	  head -n 200 | tail -n 1
      gst-launch-1.0 -q --gst-plugin-path=build/ext/jpeg/ \
          videotestsrc pattern=colors ! \
          video/x-raw,format=${gfmt} ! \
	  jpegenc ! \
	  jpegdec ! \
	  video/x-raw,format=${gfmt} ! \
	  fakesink dump=true | \
	  head -n 200 | tail -n 1
      done
  Result looks as follows, i.e. comparable:
  RGB
  00000c70 (0x7f7736fbdd10): 05 33 19 05 33 26 05 33 33 05 33 40 05 33 4c 05  .3..3&.33.3@.3L.
  00000c70 (0x7f389e8f7d10): 05 32 17 04 32 22 04 32 31 04 32 3e 04 32 4a 04  .2..2".21.2>.2J.
  RGBx
  00000c70 (0x7f79efd0ad10): cc 07 22 ff d9 07 22 ff e6 07 22 ff f3 07 22 ff  .."..."..."...".
  00000c70 (0x7fb6989f3d10): cd 06 22 00 d9 06 22 00 e6 06 22 00 f4 06 22 00  .."..."..."...".
  BGR
  00000c70 (0x7fa0a6c42d10): 05 0c 33 05 19 33 05 26 33 05 33 33 05 40 33 05  ..3..3.&3.33.@3.
  00000c70 (0x7fc74165fd10): 05 08 32 04 17 32 04 22 32 04 31 32 04 3e 32 04  ..2..2."2.12.>2.
  BGRx
  00000c70 (0x7fbf399f1d10): 22 07 cc ff 22 07 d9 ff 22 07 e6 ff 22 07 f3 ff  "..."..."..."...
  00000c70 (0x7f50e3d1cd10): 22 06 cd 00 22 06 d9 00 22 06 e6 00 22 06 f4 00  "..."..."..."...
  xRGB
  00000c70 (0x7f0b950a2d10): ff cc 07 22 ff d9 07 22 ff e6 07 22 ff f3 07 22  ..."..."..."..."
  00000c70 (0x7f4416b8dd10): 00 cd 06 22 00 d9 06 22 00 e6 06 22 00 f4 06 22  ..."..."..."..."
  xBGR
  00000c70 (0x7f237d74dd10): ff 22 07 cc ff 22 07 d9 ff 22 07 e6 ff 22 07 f3  ."..."..."..."..
  00000c70 (0x7f095547dd10): 00 22 06 cd 00 22 06 d9 00 22 06 e6 00 22 06 f4  ."..."..."..."..
                             ^^          ^^          ^^          ^^
  Notice how the alpha channel is set to arbitrary value in case of the
  libjpeg-turbo decoding into RGBx/BGRx/xRGB/xBGR pixel formats. This is
  documented in libjpeg-turbo README.md as follows:
    "
    When using the RGBX, BGRX, XBGR, and XRGB colorspaces during decompression, the
    X byte is undefined, and in order to ensure the best performance, libjpeg-turbo
    can set that byte to whatever value it wishes.
    "

- The interlaced num_fields=2 mjpeg stream can be generated and
  tested as follows (this does require mjpegtools):
  $ gst-launch-1.0 videotestsrc num-buffers=10 ! jpegenc ! multifilesink location=in%04d.jpg
  $ jpeg2yuv -f 25 -I t -L 0 -j in%04d.jpg | yuv2lav -f avi -o result.avi
  ...
  $ gst-launch-1.0 --gst-plugin-path=build/ext/jpeg/ filesrc location=result.avi ! \
       avidemux ! jpegdec ! video/x-raw,format=RGBx ! videoconvert ! autovideosink

Signed-off-by: Marek Vasut <marex@denx.de>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1091>
2021-10-07 12:40:29 +00:00
..
gst-devtools validate:launcher: Sync asset only when passing --sync 2021-10-06 17:00:54 +00:00
gst-docs ci: Fix gst-indent path 2021-10-05 23:44:03 +03:00
gst-editing-services ges:uri-asset: Ignore streams with no ID 2021-10-02 10:44:26 +00:00
gst-examples Back to development 2021-09-26 01:07:02 +01:00
gst-integration-testsuites validate:launcher: Sync asset only when passing --sync 2021-10-06 17:00:54 +00:00
gst-libav doc: update IRC links to OFTC 2021-09-28 10:11:15 +10:00
gst-omx doc: update IRC links to OFTC 2021-09-28 10:11:15 +10:00
gst-plugins-bad codecs: Use GST_VIDEO_DECODER_ERROR() only for decoding error case 2021-10-07 06:48:46 +00:00
gst-plugins-base pbutils: Remove sample entry code "raw" 2021-10-05 09:00:23 +00:00
gst-plugins-good jpegdec: Support libjpeg-turbo colorspace conversion 2021-10-07 12:40:29 +00:00
gst-plugins-ugly doc: update IRC links to OFTC 2021-09-28 10:11:15 +10:00
gst-python doc: update IRC links to OFTC 2021-09-28 10:11:15 +10:00
gst-rtsp-server rtsp-media: Unprepare suspended medias too 2021-10-07 11:16:39 +00:00
gstreamer tests: gstmeta: Fix failure on Windows 2021-10-07 07:43:27 +00:00
gstreamer-sharp Back to development 2021-09-26 01:07:02 +01:00
gstreamer-vaapi doc: update IRC links to OFTC 2021-09-28 10:11:15 +10:00
macos-bison-binary
win-flex-bison-binaries
win-nasm
avtp.wrap
bindinator.wrap Move files from gstreamer-sharp into the "subprojects/gstreamer-sharp/" subdir 2021-09-24 16:16:29 -03:00
cairo.wrap
dav1d.wrap
dssim.wrap dssim: Use http:// git repo 2018-07-13 18:54:34 -04:00
dv.wrap
expat.wrap
FFmpeg.wrap
fontconfig.wrap
freetype2.wrap
fribidi.wrap
gl-headers.wrap Move files from gst-plugins-base into the "subprojects/gst-plugins-base/" subdir 2021-09-24 16:13:26 -03:00
glib-networking.wrap
glib.wrap
graphene.wrap Move files from gst-plugins-base into the "subprojects/gst-plugins-base/" subdir 2021-09-24 16:13:26 -03:00
gtk-sharp.wrap Move files from gstreamer-sharp into the "subprojects/gstreamer-sharp/" subdir 2021-09-24 16:16:29 -03:00
harfbuzz.wrap
json-glib.wrap
libdrm.wrap
libffi.wrap
libjpeg-turbo.wrap
libmicrodns.wrap
libnice.wrap
libopenjp2.wrap
libpsl.wrap
libsoup.wrap
libwpe.wrap
libxml2.wrap
openh264.wrap
opus.wrap
orc.wrap
pango.wrap
pixman.wrap
proxy-libintl.wrap
pycairo.wrap
pygobject.wrap
sqlite3.wrap
webrtc-audio-processing.wrap
wpebackend-fdo.wrap
x264.wrap
zlib.wrap