summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-10-11 10:03:14 +0200
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-11-16 16:23:30 +0100
commit8ef1f016e41a66ea132e4b526e582f3e2884b0c4 (patch)
tree994cf2a4a4a0d399ee4a44e150d43d296882347e
parent799f5d37b183630e6c9564e6e693826ea269f824 (diff)
Add codecparsers submodule.
Backport from git master: c3b343f Add codecparsers submodule cee782a jpeg: use submodule sources 022e99e h264: use submodule sources d42d838 fix generation of symlinks d453297 update to gst-vaapi-rebased commit 73d6aab 18245b4 always build the VC-1 parser library 9ab3ce2 always build parserutils first
-rw-r--r--.gitignore2
-rw-r--r--.gitmodules3
-rw-r--r--Makefile.am2
-rwxr-xr-xautogen.sh11
-rw-r--r--configure.ac48
-rw-r--r--ext/Makefile.am29
m---------ext/codecparsers0
-rw-r--r--gst-libs/gst/codecparsers/Makefile.am46
-rw-r--r--gst-libs/gst/codecparsers/gstjpegparser.c611
-rw-r--r--gst-libs/gst/codecparsers/gstjpegparser.h414
-rw-r--r--gst-libs/gst/vaapi/Makefile.am8
11 files changed, 107 insertions, 1067 deletions
diff --git a/.gitignore b/.gitignore
index 00467e09..0ff526c3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -56,6 +56,8 @@ docs/reference/plugins/html*
docs/reference/plugins/plugins-docs.xml
docs/reference/plugins/tmpl*
docs/reference/plugins/xml*
+gst-libs/gst/codecparsers/*.[ch]
+gst-libs/gst/codecparsers/.timestamp.*
gst-libs/gst/gstutils_version.h
gtk-doc.make
pkgconfig/gstreamer-vaapi-0.10.pc
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 00000000..e40ceed5
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "ext/codecparsers"]
+ path = ext/codecparsers
+ url = git://gitorious.org/vaapi/gstreamer-codecparsers.git
diff --git a/Makefile.am b/Makefile.am
index 87184673..70cb5eea 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,7 +2,7 @@ ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
AUTOMAKE_OPTIONS = foreign
-SUBDIRS = debian.upstream gst-libs gst pkgconfig tests docs
+SUBDIRS = debian.upstream gst-libs gst pkgconfig tests docs ext
# Extra clean files so that maintainer-clean removes *everything*
MAINTAINERCLEANFILES = \
diff --git a/autogen.sh b/autogen.sh
index 3d7ffd83..4314352f 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -15,6 +15,17 @@ cd "$srcdir"
mkdir -p m4
+GIT=`which git`
+if test -z "$GIT"; then
+ echo "*** No git found ***"
+ exit 1
+else
+ if test ! -f ext/codecparsers/autogen.sh; then
+ $GIT submodule init
+ fi
+ $GIT submodule update
+fi
+
GTKDOCIZE=`which gtkdocize`
if test -z "$GTKDOCIZE"; then
echo "*** No gtk-doc support ***"
diff --git a/configure.ac b/configure.ac
index b12ba128..ae2ebecc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -211,41 +211,38 @@ PKG_CHECK_MODULES([GST_BASEVIDEO],
[gstreamer-basevideo-$GST_MAJORMINOR >= gst_plugins_bad_version])
dnl ... bitstream parsers
-USE_CODEC_PARSERS=1
-USE_LOCAL_CODEC_PARSERS=0
-
PKG_CHECK_MODULES([GST_CODEC_PARSERS],
[gstreamer-codecparsers-$GST_MAJORMINOR >= gst_plugins_bad_version])
-dnl ... 0.10.23 addition, could be implemented otherwise
-AC_CACHE_CHECK([for GstH264SliceHdr::n_emulation_prevention_bytes],
- ac_cv_have_gst_h264_slice_hdr_epb_count, [
- saved_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $GST_CFLAGS $GST_CODEC_PARSERS_CFLAGS"
+dnl ... H.264 parser, with the required extensions
+AC_CACHE_CHECK([for H.264 parser],
+ ac_cv_have_gst_h264_parser, [
+ saved_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $GST_CFLAGS $GST_CODEC_PARSERS_CFLAGS"
saved_LIBS="$LIBS"
LIBS="$LIBS $GST_LIBS $GST_CODEC_PARSERS_LIBS"
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <gst/codecparsers/gsth264parser.h>]],
[[GstH264SliceHdr slice_hdr;
- slice_hdr.n_emulation_prevention_bytes = 0;]])],
- [ac_cv_have_gst_h264_slice_hdr_epb_count="yes"],
- [ac_cv_have_gst_h264_slice_hdr_epb_count="no"]
+ GstH264VUIParams vui_params;
+ slice_hdr.n_emulation_prevention_bytes = 0;
+ vui_params.par_n = 0;
+ vui_params.par_d = 0;]])],
+ [ac_cv_have_gst_h264_parser="yes"],
+ [ac_cv_have_gst_h264_parser="no"]
)
- CFLAGS="$saved_CFLAGS"
+ CPPFLAGS="$saved_CPPFLAGS"
LIBS="$saved_LIBS"
])
-
-if test "$ac_cv_have_gst_h264_slice_hdr_epb_count" = "yes"; then
- AC_DEFINE_UNQUOTED(HAVE_GST_H264_SLICE_HDR_EPB_COUNT, 1,
- [Defined to 1 if GstH264SliceHdr::n_emulation_prevention_bytes exists.])
-fi
+AM_CONDITIONAL([USE_LOCAL_CODEC_PARSERS_H264],
+ [test "$ac_cv_have_gst_h264_parser" != "yes"])
dnl ... JPEG parser, not upstream yet
AC_CACHE_CHECK([for JPEG parser],
ac_cv_have_gst_jpeg_parser, [
- saved_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS $GST_CFLAGS $GST_CODEC_PARSERS_CFLAGS"
+ saved_CPPFLAGS="$CPPFLAGS"
+ CPPFLAGS="$CPPFLAGS $GST_CFLAGS $GST_CODEC_PARSERS_CFLAGS"
saved_LIBS="$LIBS"
LIBS="$LIBS $GST_LIBS $GST_CODEC_PARSERS_LIBS"
AC_COMPILE_IFELSE(
@@ -253,17 +250,13 @@ AC_CACHE_CHECK([for JPEG parser],
[[#include <gst/codecparsers/gstjpegparser.h>]],
[[GstJpegImage jpeg_image;]])],
[ac_cv_have_gst_jpeg_parser="yes"],
- [ac_cv_have_gst_jpeg_parser="no" USE_LOCAL_CODEC_PARSERS=1]
+ [ac_cv_have_gst_jpeg_parser="no"]
)
- CFLAGS="$saved_CFLAGS"
+ CPPFLAGS="$saved_CPPFLAGS"
LIBS="$saved_LIBS"
])
-
-if test "$ac_cv_have_gst_jpeg_parser" = "yes"; then
- AC_DEFINE_UNQUOTED(HAVE_GST_JPEG_PARSER, 1,
- [Defined to 1 if JPEG parser exists.])
-fi
-AM_CONDITIONAL(USE_LOCAL_CODEC_PARSERS, test $USE_LOCAL_CODEC_PARSERS -eq 1)
+AM_CONDITIONAL([USE_LOCAL_CODEC_PARSERS_JPEG],
+ [test "$ac_cv_have_gst_jpeg_parser" != "yes"])
dnl GST_ALL_LDFLAGS:
dnl LDFLAGS really should only contain flags, not libs - they get added before
@@ -530,6 +523,7 @@ debian.upstream/libgstvaapi-x11.install.in
docs/reference/libs/libs-docs.xml
docs/reference/plugins/Makefile
docs/reference/plugins/plugins-docs.xml
+ ext/Makefile
gst-libs/Makefile
gst-libs/gst/Makefile
gst-libs/gst/codecparsers/Makefile
diff --git a/ext/Makefile.am b/ext/Makefile.am
new file mode 100644
index 00000000..bad55d50
--- /dev/null
+++ b/ext/Makefile.am
@@ -0,0 +1,29 @@
+EXTRA_DIST =
+
+codecparsers_srcdir = \
+ $(top_srcdir)/ext/codecparsers/gst-libs/gst/codecparsers
+
+codecparsers_source_c = \
+ gsth264parser.c \
+ gstjpegparser.c \
+ gstmpeg4parser.c \
+ gstmpegvideoparser.c \
+ gstvc1parser.c \
+ parserutils.c \
+ $(NULL)
+
+EXTRA_DIST += $(codecparsers_source_c:%.c=$(codecparsers_srcdir)/%.c)
+
+codecparsers_source_h = \
+ gsth264parser.h \
+ gstjpegparser.h \
+ gstmpeg4parser.h \
+ gstmpegvideoparser.h \
+ gstvc1parser.h \
+ parserutils.h \
+ $(NULL)
+
+EXTRA_DIST += $(codecparsers_source_h:%.h=$(codecparsers_srcdir)/%.h)
+
+# Extra clean files so that maintainer-clean removes *everything*
+MAINTAINERCLEANFILES = Makefile.in
diff --git a/ext/codecparsers b/ext/codecparsers
new file mode 160000
+Subproject 73d6aab46c14d943f2a0238e70812d775f06ffe
diff --git a/gst-libs/gst/codecparsers/Makefile.am b/gst-libs/gst/codecparsers/Makefile.am
index aa10113b..8dd23ef9 100644
--- a/gst-libs/gst/codecparsers/Makefile.am
+++ b/gst-libs/gst/codecparsers/Makefile.am
@@ -2,6 +2,9 @@ noinst_LTLIBRARIES = \
libgstvaapi-codecparsers.la \
$(NULL)
+local_codecparsers_srcdir = \
+ $(top_srcdir)/ext/codecparsers/gst-libs/gst/codecparsers
+
libgstvaapi_codecparsers_cflags = \
-DGST_USE_UNSTABLE_API \
-I$(top_srcdir)/gst-libs \
@@ -14,17 +17,32 @@ libgstvaapi_codecparsers_libs = \
$(GST_LIBS) \
$(NULL)
-libgstvaapi_codecparsers_source_c = \
- gstjpegparser.c \
- $(NULL)
+gen_source_c = parserutils.c
+gen_source_h = parserutils.h
+
+# Always build VC-1 parser for now
+gen_source_c += gstvc1parser.c
+gen_source_h += gstvc1parser.h
+
+if USE_LOCAL_CODEC_PARSERS_JPEG
+gen_source_c += gstjpegparser.c
+gen_source_h += gstjpegparser.h
+endif
+
+if USE_LOCAL_CODEC_PARSERS_H264
+gen_source_c += gsth264parser.c
+gen_source_h += gsth264parser.h
+endif
-libgstvaapi_codecparsers_source_h = \
- gstjpegparser.h \
+GENFILES = \
+ $(gen_source_c) \
+ $(gen_source_h) \
$(NULL)
-libgstvaapi_codecparsers_la_SOURCES = \
- $(libgstvaapi_codecparsers_source_c) \
- $(libgstvaapi_codecparsers_source_h) \
+nodist_EXTRA_libgstvaapi_codecparsers_la_SOURCES = dummy.c
+
+nodist_libgstvaapi_codecparsers_la_SOURCES = \
+ $(gen_source_c) \
$(NULL)
libgstvaapi_codecparsers_la_CFLAGS = \
@@ -39,5 +57,17 @@ libgstvaapi_codecparsers_la_LDFLAGS = \
$(GST_ALL_LDFLAGS) \
$(NULL)
+all-local: .timestamp.symlinks
+
+.timestamp.symlinks: $(GENFILES)
+ touch $@
+
+$(gen_source_c): %.c: $(local_codecparsers_srcdir)/%.c %.h
+ $(LN_S) -f $< $@
+$(gen_source_h): %.h: $(local_codecparsers_srcdir)/%.h
+ $(LN_S) -f $< $@
+
+DISTCLEANFILES = $(GENFILES) .timestamp.symlinks
+
# Extra clean files so that maintainer-clean removes *everything*
MAINTAINERCLEANFILES = Makefile.in
diff --git a/gst-libs/gst/codecparsers/gstjpegparser.c b/gst-libs/gst/codecparsers/gstjpegparser.c
deleted file mode 100644
index 80de3fff..00000000
--- a/gst-libs/gst/codecparsers/gstjpegparser.c
+++ /dev/null
@@ -1,611 +0,0 @@
-/*
- * gstjpegparser.c - JPEG parser
- *
- * Copyright (C) 2011-2012 Intel Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1
- * of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#include <string.h>
-#include <stdlib.h>
-#include <gst/base/gstbytereader.h>
-#include "gstjpegparser.h"
-
-#ifndef GST_DISABLE_GST_DEBUG
-
-#define GST_CAT_DEFAULT ensure_debug_category()
-
-static GstDebugCategory *
-ensure_debug_category (void)
-{
- static gsize cat_gonce = 0;
-
- if (g_once_init_enter (&cat_gonce)) {
- gsize cat_done;
-
- cat_done = (gsize) _gst_debug_category_new ("codecparsers_jpeg", 0,
- "GstJpegCodecParser");
-
- g_once_init_leave (&cat_gonce, cat_done);
- }
-
- return (GstDebugCategory *) cat_gonce;
-}
-#else
-
-#define ensure_debug_category() /* NOOP */
-
-#endif /* GST_DISABLE_GST_DEBUG */
-
-#define DEBUG_PRINT_COMMENT 0
-
-#define READ_UINT8(reader, val) G_STMT_START { \
- if (!gst_byte_reader_get_uint8 ((reader), &(val))) { \
- GST_WARNING ("failed to read uint8"); \
- goto failed; \
- } \
- } G_STMT_END
-
-#define READ_UINT16(reader, val) G_STMT_START { \
- if (!gst_byte_reader_get_uint16_be ((reader), &(val))) { \
- GST_WARNING ("failed to read uint16"); \
- goto failed; \
- } \
- } G_STMT_END
-
-#define READ_BYTES(reader, buf, length) G_STMT_START { \
- const guint8 *vals; \
- if (!gst_byte_reader_get_data (reader, length, &vals)) { \
- GST_WARNING ("failed to read bytes, size:%d", length); \
- goto failed; \
- } \
- memcpy (buf, vals, length); \
- } G_STMT_END
-
-#define U_READ_UINT8(reader, val) G_STMT_START { \
- (val) = gst_byte_reader_get_uint8_unchecked(reader); \
- } G_STMT_END
-
-#define U_READ_UINT16(reader, val) G_STMT_START { \
- (val) = gst_byte_reader_get_uint16_be_unchecked(reader); \
- } G_STMT_END
-
-
-/* Table used to address an 8x8 matrix in zig-zag order */
-/* *INDENT-OFF* */
-static const guint8 zigzag_index[64] = {
- 0, 1, 8, 16, 9, 2, 3, 10,
- 17, 24, 32, 25, 18, 11, 4, 5,
- 12, 19, 26, 33, 40, 48, 41, 34,
- 27, 20, 13, 6, 7, 14, 21, 28,
- 35, 42, 49, 56, 57, 50, 43, 36,
- 29, 22, 15, 23, 30, 37, 44, 51,
- 58, 59, 52, 45, 38, 31, 39, 46,
- 53, 60, 61, 54, 47, 55, 62, 63
-};
-/* *INDENT-ON* */
-
-/* Table K.1 - Luminance quantization table */
-/* *INDENT-OFF* */
-static const guint8 default_luminance_quant_table[64] = {
- 16, 11, 10, 16, 24, 40, 51, 61,
- 12, 12, 14, 19, 26, 58, 60, 55,
- 14, 13, 16, 24, 40, 57, 69, 56,
- 14, 17, 22, 29, 51, 87, 80, 62,
- 18, 22, 37, 56, 68, 109, 103, 77,
- 24, 35, 55, 64, 81, 104, 113, 92,
- 49, 64, 78, 87, 103, 121, 120, 101,
- 72, 92, 95, 98, 112, 100, 103, 99
-};
-/* *INDENT-ON* */
-
-/* Table K.2 - Chrominance quantization table */
-/* *INDENT-OFF* */
-static const guint8 default_chrominance_quant_table[64] = {
- 17, 18, 24, 47, 99, 99, 99, 99,
- 18, 21, 26, 66, 99, 99, 99, 99,
- 24, 26, 56, 99, 99, 99, 99, 99,
- 47, 66, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99,
- 99, 99, 99, 99, 99, 99, 99, 99
-};
-/* *INDENT-ON* */
-
-typedef struct _GstJpegHuffmanTableEntry GstJpegHuffmanTableEntry;
-struct _GstJpegHuffmanTableEntry
-{
- guint8 value; /* category */
- guint8 length; /* code length in bits */
-};
-
-/* Table K.3 - Table for luminance DC coefficient differences */
-static const GstJpegHuffmanTableEntry default_luminance_dc_table[] = {
- {0x00, 2}, {0x01, 3}, {0x02, 3}, {0x03, 3}, {0x04, 3}, {0x05, 3},
- {0x06, 4}, {0x07, 5}, {0x08, 6}, {0x09, 7}, {0x0a, 8}, {0x0b, 9}
-};
-
-/* Table K.4 - Table for chrominance DC coefficient differences */
-static const GstJpegHuffmanTableEntry default_chrominance_dc_table[] = {
- {0x00, 2}, {0x01, 2}, {0x02, 2}, {0x03, 3}, {0x04, 4}, {0x05, 5},
- {0x06, 6}, {0x07, 7}, {0x08, 8}, {0x09, 9}, {0x0a, 10}, {0x0b, 11}
-};
-
-/* Table K.5 - Table for luminance AC coefficients */
-/* *INDENT-OFF* */
-static const GstJpegHuffmanTableEntry default_luminance_ac_table[] = {
- {0x00, 4}, {0x01, 2}, {0x02, 2}, {0x03, 3}, {0x04, 4}, {0x05, 5},
- {0x06, 7}, {0x07, 8}, {0x08, 10}, {0x09, 16}, {0x0a, 16}, {0x11, 4},
- {0x12, 5}, {0x13, 7}, {0x14, 9}, {0x15, 11}, {0x16, 16}, {0x17, 16},
- {0x18, 16}, {0x19, 16}, {0x1a, 16}, {0x21, 5}, {0x22, 8}, {0x23, 10},
- {0x24, 12}, {0x25, 16}, {0x26, 16}, {0x27, 16}, {0x28, 16}, {0x29, 16},
- {0x2a, 16}, {0x31, 6}, {0x32, 9}, {0x33, 12}, {0x34, 16}, {0x35, 16},
- {0x36, 16}, {0x37, 16}, {0x38, 16}, {0x39, 16}, {0x3a, 16}, {0x41, 6},
- {0x42, 10}, {0x43, 16}, {0x44, 16}, {0x45, 16}, {0x46, 16}, {0x47, 16},
- {0x48, 16}, {0x49, 16}, {0x4a, 16}, {0x51, 7}, {0x52, 11}, {0x53, 16},
- {0x54, 16}, {0x55, 16}, {0x56, 16}, {0x57, 16}, {0x58, 16}, {0x59, 16},
- {0x5a, 16}, {0x61, 7}, {0x62, 12}, {0x63, 16}, {0x64, 16}, {0x65, 16},
- {0x66, 16}, {0x67, 16}, {0x68, 16}, {0x69, 16}, {0x6a, 16}, {0x71, 8},
- {0x72, 12}, {0x73, 16}, {0x74, 16}, {0x75, 16}, {0x76, 16}, {0x77, 16},
- {0x78, 16}, {0x79, 16}, {0x7a, 16}, {0x81, 9}, {0x82, 15}, {0x83, 16},
- {0x84, 16}, {0x85, 16}, {0x86, 16}, {0x87, 16}, {0x88, 16}, {0x89, 16},
- {0x8a, 16}, {0x91, 9}, {0x92, 16}, {0x93, 16}, {0x94, 16}, {0x95, 16},
- {0x96, 16}, {0x97, 16}, {0x98, 16}, {0x99, 16}, {0x9a, 16}, {0xa1, 9},
- {0xa2, 16}, {0xa3, 16}, {0xa4, 16}, {0xa5, 16}, {0xa6, 16}, {0xa7, 16},
- {0xa8, 16}, {0xa9, 16}, {0xaa, 16}, {0xb1, 10}, {0xb2, 16}, {0xb3, 16},
- {0xb4, 16}, {0xb5, 16}, {0xb6, 16}, {0xb7, 16}, {0xb8, 16}, {0xb9, 16},
- {0xba, 16}, {0xc1, 10}, {0xc2, 16}, {0xc3, 16}, {0xc4, 16}, {0xc5, 16},
- {0xc6, 16}, {0xc7, 16}, {0xc8, 16}, {0xc9, 16}, {0xca, 16}, {0xd1, 11},
- {0xd2, 16}, {0xd3, 16}, {0xd4, 16}, {0xd5, 16}, {0xd6, 16}, {0xd7, 16},
- {0xd8, 16}, {0xd9, 16}, {0xda, 16}, {0xe1, 16}, {0xe2, 16}, {0xe3, 16},
- {0xe4, 16}, {0xe5, 16}, {0xe6, 16}, {0xe7, 16}, {0xe8, 16}, {0xe9, 16},
- {0xea, 16}, {0xf0, 11}, {0xf1, 16}, {0xf2, 16}, {0xf3, 16}, {0xf4, 16},
- {0xf5, 16}, {0xf6, 16}, {0xf7, 16}, {0xf8, 16}, {0xf9, 16}, {0xfa, 16}
-};
-/* *INDENT-ON* */
-
-/* Table K.6 - Table for chrominance AC coefficients */
-/* *INDENT-OFF* */
-static const GstJpegHuffmanTableEntry default_chrominance_ac_table[] = {
- {0x00, 2}, {0x01, 2}, {0x02, 3}, {0x03, 4}, {0x04, 5}, {0x05, 5},
- {0x06, 6}, {0x07, 7}, {0x08, 9}, {0x09, 10}, {0x0a, 12}, {0x11, 4},
- {0x12, 6}, {0x13, 8}, {0x14, 9}, {0x15, 11}, {0x16, 12}, {0x17, 16},
- {0x18, 16}, {0x19, 16}, {0x1a, 16}, {0x21, 5}, {0x22, 8}, {0x23, 10},
- {0x24, 12}, {0x25, 15}, {0x26, 16}, {0x27, 16}, {0x28, 16}, {0x29, 16},
- {0x2a, 16}, {0x31, 5}, {0x32, 8}, {0x33, 10}, {0x34, 12}, {0x35, 16},
- {0x36, 16}, {0x37, 16}, {0x38, 16}, {0x39, 16}, {0x3a, 16}, {0x41, 6},
- {0x42, 9}, {0x43, 16}, {0x44, 16}, {0x45, 16}, {0x46, 16}, {0x47, 16},
- {0x48, 16}, {0x49, 16}, {0x4a, 16}, {0x51, 6}, {0x52, 10}, {0x53, 16},
- {0x54, 16}, {0x55, 16}, {0x56, 16}, {0x57, 16}, {0x58, 16}, {0x59, 16},
- {0x5a, 16}, {0x61, 7}, {0x62, 11}, {0x63, 16}, {0x64, 16}, {0x65, 16},
- {0x66, 16}, {0x67, 16}, {0x68, 16}, {0x69, 16}, {0x6a, 16}, {0x71, 7},
- {0x72, 11}, {0x73, 16}, {0x74, 16}, {0x75, 16}, {0x76, 16}, {0x77, 16},
- {0x78, 16}, {0x79, 16}, {0x7a, 16}, {0x81, 8}, {0x82, 16}, {0x83, 16},
- {0x84, 16}, {0x85, 16}, {0x86, 16}, {0x87, 16}, {0x88, 16}, {0x89, 16},
- {0x8a, 16}, {0x91, 9}, {0x92, 16}, {0x93, 16}, {0x94, 16}, {0x95, 16},
- {0x96, 16}, {0x97, 16}, {0x98, 16}, {0x99, 16}, {0x9a, 16}, {0xa1, 9},
- {0xa2, 16}, {0xa3, 16}, {0xa4, 16}, {0xa5, 16}, {0xa6, 16}, {0xa7, 16},
- {0xa8, 16}, {0xa9, 16}, {0xaa, 16}, {0xb1, 9}, {0xb2, 16}, {0xb3, 16},
- {0xb4, 16}, {0xb5, 16}, {0xb6, 16}, {0xb7, 16}, {0xb8, 16}, {0xb9, 16},
- {0xba, 16}, {0xc1, 9}, {0xc2, 16}, {0xc3, 16}, {0xc4, 16}, {0xc5, 16},
- {0xc6, 16}, {0xc7, 16}, {0xc8, 16}, {0xc9, 16}, {0xca, 16}, {0xd1, 11},
- {0xd2, 16}, {0xd3, 16}, {0xd4, 16}, {0xd5, 16}, {0xd6, 16}, {0xd7, 16},
- {0xd8, 16}, {0xd9, 16}, {0xda, 16}, {0xe1, 14}, {0xe2, 16}, {0xe3, 16},
- {0xe4, 16}, {0xe5, 16}, {0xe6, 16}, {0xe7, 16}, {0xe8, 16}, {0xe9, 16},
- {0xea, 16}, {0xf0, 10}, {0xf1, 15}, {0xf2, 16}, {0xf3, 16}, {0xf4, 16},
- {0xf5, 16}, {0xf6, 16}, {0xf7, 16}, {0xf8, 16}, {0xf9, 16}, {0xfa, 16}
-};
-/* *INDENT-ON* */
-
-static inline gboolean
-jpeg_parse_to_next_marker (GstByteReader * br, guint8 * marker)
-{
- gint ofs;
-
- ofs = gst_jpeg_scan_for_marker_code (br->data, br->size, br->byte);
- if (ofs < 0)
- return FALSE;
-
- if (marker)
- *marker = br->data[ofs + 1];
- gst_byte_reader_skip (br, ofs - br->byte + 2);
- return TRUE;
-}
-
-gint
-gst_jpeg_scan_for_marker_code (const guint8 * data, gsize size, guint offset)
-{
- guint i;
-
- g_return_val_if_fail (data != NULL, -1);
- g_return_val_if_fail (size > offset, -1);
-
- for (i = offset; i < size - 1;) {
- if (data[i] != 0xff)
- i++;
- else {
- const guint8 v = data[i + 1];
- if (v >= 0xc0 && v <= 0xfe)
- return i;
- i += 2;
- }
- }
- return -1;
-}
-
-gboolean
-gst_jpeg_parse_frame_hdr (GstJpegFrameHdr * frame_hdr,
- const guint8 * data, gsize size, guint offset)
-{
- GstByteReader br;
- guint16 length;
- guint8 val;
- guint i;
-
- g_return_val_if_fail (frame_hdr != NULL, FALSE);
- g_return_val_if_fail (data != NULL, FALSE);
- g_return_val_if_fail (size > offset, FALSE);
-
- size -= offset;
- gst_byte_reader_init (&br, &data[offset], size);
- g_return_val_if_fail (size >= 8, FALSE);
-
- U_READ_UINT16 (&br, length); /* Lf */
- g_return_val_if_fail (size >= length, FALSE);
-
- U_READ_UINT8 (&br, frame_hdr->sample_precision);
- U_READ_UINT16 (&br, frame_hdr->height);
- U_READ_UINT16 (&br, frame_hdr->width);
- U_READ_UINT8 (&br, frame_hdr->num_components);
- g_return_val_if_fail (frame_hdr->num_components <=
- GST_JPEG_MAX_SCAN_COMPONENTS, FALSE);
-
- length -= 8;
- g_return_val_if_fail (length >= 3 * frame_hdr->num_components, FALSE);
- for (i = 0; i < frame_hdr->num_components; i++) {
- U_READ_UINT8 (&br, frame_hdr->components[i].identifier);
- U_READ_UINT8 (&br, val);
- frame_hdr->components[i].horizontal_factor = (val >> 4) & 0x0F;
- frame_hdr->components[i].vertical_factor = (val & 0x0F);
- U_READ_UINT8 (&br, frame_hdr->components[i].quant_table_selector);
- g_return_val_if_fail ((frame_hdr->components[i].horizontal_factor <= 4 &&
- frame_hdr->components[i].vertical_factor <= 4 &&
- frame_hdr->components[i].quant_table_selector < 4), FALSE);
- length -= 3;
- }
-
- g_assert (length == 0);
- return TRUE;
-}
-
-gboolean
-gst_jpeg_parse_scan_hdr (GstJpegScanHdr * scan_hdr,
- const guint8 * data, gsize size, guint offset)
-{
- GstByteReader br;
- guint16 length;
- guint8 val;
- guint i;
-
- g_return_val_if_fail (scan_hdr != NULL, FALSE);
- g_return_val_if_fail (data != NULL, FALSE);
- g_return_val_if_fail (size > offset, FALSE);
-
- size -= offset;
- gst_byte_reader_init (&br, &data[offset], size);
- g_return_val_if_fail (size >= 3, FALSE);
-
- U_READ_UINT16 (&br, length); /* Ls */
- g_return_val_if_fail (size >= length, FALSE);
-
- U_READ_UINT8 (&br, scan_hdr->num_components);
- g_return_val_if_fail (scan_hdr->num_components <=
- GST_JPEG_MAX_SCAN_COMPONENTS, FALSE);
-
- length -= 3;
- g_return_val_if_fail (length >= 2 * scan_hdr->num_components, FALSE);
- for (i = 0; i < scan_hdr->num_components; i++) {
- U_READ_UINT8 (&br, scan_hdr->components[i].component_selector);
- U_READ_UINT8 (&br, val);
- scan_hdr->components[i].dc_selector = (val >> 4) & 0x0F;
- scan_hdr->components[i].ac_selector = val & 0x0F;
- g_return_val_if_fail ((scan_hdr->components[i].dc_selector < 4 &&
- scan_hdr->components[i].ac_selector < 4), FALSE);
- length -= 2;
- }
-
- /* FIXME: Ss, Se, Ah, Al */
- g_assert (length == 3);
- return TRUE;
-}
-
-gboolean
-gst_jpeg_parse_huffman_table (GstJpegHuffmanTables * huf_tables,
- const guint8 * data, gsize size, guint offset)
-{
- GstByteReader br;
- GstJpegHuffmanTable *huf_table;
- guint16 length;
- guint8 val, table_class, table_index;
- guint32 value_count;
- guint i;
-
- g_return_val_if_fail (huf_tables != NULL, FALSE);
- g_return_val_if_fail (data != NULL, FALSE);
- g_return_val_if_fail (size > offset, FALSE);
-
- size -= offset;
- gst_byte_reader_init (&br, &data[offset], size);
- g_return_val_if_fail (size >= 2, FALSE);
-
- U_READ_UINT16 (&br, length); /* Lh */
- g_return_val_if_fail (size >= length, FALSE);
-
- while (gst_byte_reader_get_remaining (&br)) {
- U_READ_UINT8 (&br, val);
- table_class = ((val >> 4) & 0x0F);
- table_index = (val & 0x0F);
- g_return_val_if_fail (table_index < GST_JPEG_MAX_SCAN_COMPONENTS, FALSE);
- if (table_class == 0) {
- huf_table = &huf_tables->dc_tables[table_index];
- } else {
- huf_table = &huf_tables->ac_tables[table_index];
- }
- READ_BYTES (&br, huf_table->huf_bits, 16);
- value_count = 0;
- for (i = 0; i < 16; i++)
- value_count += huf_table->huf_bits[i];
- READ_BYTES (&br, huf_table->huf_values, value_count);
- huf_table->valid = TRUE;
- }
- return TRUE;
-
-failed:
- return FALSE;
-}
-
-gboolean
-gst_jpeg_parse_quant_table (GstJpegQuantTables * quant_tables,
- const guint8 * data, gsize size, guint offset)
-{
- GstByteReader br;
- GstJpegQuantTable *quant_table;
- guint16 length;
- guint8 val, table_index;
- guint i;
-
- g_return_val_if_fail (quant_tables != NULL, FALSE);
- g_return_val_if_fail (data != NULL, FALSE);
- g_return_val_if_fail (size > offset, FALSE);
-
- size -= offset;
- gst_byte_reader_init (&br, &data[offset], size);
- g_return_val_if_fail (size >= 2, FALSE);
-
- U_READ_UINT16 (&br, length); /* Lq */
- g_return_val_if_fail (size >= length, FALSE);
-
- while (gst_byte_reader_get_remaining (&br)) {
- U_READ_UINT8 (&br, val);
- table_index = (val & 0x0f);
- g_return_val_if_fail (table_index < GST_JPEG_MAX_SCAN_COMPONENTS, FALSE);
- quant_table = &quant_tables->quant_tables[table_index];
- quant_table->quant_precision = ((val >> 4) & 0x0f);
-
- g_return_val_if_fail (gst_byte_reader_get_remaining (&br) >=
- GST_JPEG_MAX_QUANT_ELEMENTS * (1 + ! !quant_table->quant_precision),
- FALSE);
- for (i = 0; i < GST_JPEG_MAX_QUANT_ELEMENTS; i++) {
- if (!quant_table->quant_precision) { /* 8-bit values */
- U_READ_UINT8 (&br, val);
- quant_table->quant_table[i] = val;
- } else { /* 16-bit values */
- U_READ_UINT16 (&br, quant_table->quant_table[i]);
- }
- }
- quant_table->valid = TRUE;
- }
- return TRUE;
-}
-
-gboolean
-gst_jpeg_parse_restart_interval (guint * interval,
- const guint8 * data, gsize size, guint offset)
-{
- GstByteReader br;
- guint16 length, val;
-
- g_return_val_if_fail (interval != NULL, FALSE);
- g_return_val_if_fail (data != NULL, FALSE);
- g_return_val_if_fail (size > offset, FALSE);
-
- size -= offset;
- gst_byte_reader_init (&br, &data[offset], size);
- g_return_val_if_fail (size >= 4, FALSE);
-
- U_READ_UINT16 (&br, length); /* Lr */
- g_return_val_if_fail (size >= length, FALSE);
-
- U_READ_UINT16 (&br, val);
- *interval = val;
- return TRUE;
-}
-
-static int
-compare_huffman_table_entry (const void *a, const void *b)
-{
- const GstJpegHuffmanTableEntry *const e1 = *(GstJpegHuffmanTableEntry **) a;
- const GstJpegHuffmanTableEntry *const e2 = *(GstJpegHuffmanTableEntry **) b;
-
- if (e1->length == e2->length)
- return (gint) e1->value - (gint) e2->value;
- return (gint) e1->length - (gint) e2->length;
-}
-
-static void
-build_huffman_table (GstJpegHuffmanTable * huf_table,
- const GstJpegHuffmanTableEntry * entries, guint num_entries)
-{
- const GstJpegHuffmanTableEntry *sorted_entries[256];
- guint i, j, n;
-
- g_assert (num_entries <= G_N_ELEMENTS (sorted_entries));
-
- for (i = 0; i < num_entries; i++)
- sorted_entries[i] = &entries[i];
- qsort (sorted_entries, num_entries, sizeof (sorted_entries[0]),
- compare_huffman_table_entry);
-
- for (i = 0, j = 1, n = 0; i < num_entries; i++) {
- const GstJpegHuffmanTableEntry *const e = sorted_entries[i];
- if (e->length != j) {
- huf_table->huf_bits[j++ - 1] = n;
- for (; j < e->length; j++)
- huf_table->huf_bits[j - 1] = 0;
- n = 0;
- }
- huf_table->huf_values[i] = e->value;
- n++;
- }
-
- for (; j < G_N_ELEMENTS (huf_table->huf_bits); j++)
- huf_table->huf_bits[j] = 0;
- for (; i < G_N_ELEMENTS (huf_table->huf_values); i++)
- huf_table->huf_values[i] = 0;
- huf_table->valid = TRUE;
-}
-
-void
-gst_jpeg_get_default_huffman_tables (GstJpegHuffmanTables * huf_tables)
-{
- g_assert (huf_tables);
-
- /* Build DC tables */
- build_huffman_table (&huf_tables->dc_tables[0], default_luminance_dc_table,
- G_N_ELEMENTS (default_luminance_dc_table));
- build_huffman_table (&huf_tables->dc_tables[1], default_chrominance_dc_table,
- G_N_ELEMENTS (default_chrominance_dc_table));
- memcpy (&huf_tables->dc_tables[2], &huf_tables->dc_tables[1],
- sizeof (huf_tables->dc_tables[2]));
-
- /* Build AC tables */
- build_huffman_table (&huf_tables->ac_tables[0], default_luminance_ac_table,
- G_N_ELEMENTS (default_luminance_ac_table));
- build_huffman_table (&huf_tables->ac_tables[1], default_chrominance_ac_table,
- G_N_ELEMENTS (default_chrominance_ac_table));
- memcpy (&huf_tables->ac_tables[2], &huf_tables->ac_tables[1],
- sizeof (huf_tables->ac_tables[2]));
-}
-
-static void
-build_quant_table (GstJpegQuantTable * quant_table, const guint8 values[64])
-{
- guint i;
-
- for (i = 0; i < 64; i++)
- quant_table->quant_table[i] = values[zigzag_index[i]];
- quant_table->quant_precision = 0; /* Pq = 0 (8-bit precision) */
- quant_table->valid = TRUE;
-}
-
-void
-gst_jpeg_get_default_quantization_tables (GstJpegQuantTables * quant_tables)
-{
- g_assert (quant_tables);
-
- build_quant_table (&quant_tables->quant_tables[0],
- default_luminance_quant_table);
- build_quant_table (&quant_tables->quant_tables[1],
- default_chrominance_quant_table);
- build_quant_table (&quant_tables->quant_tables[2],
- default_chrominance_quant_table);
-}
-
-gboolean
-gst_jpeg_parse (GstJpegMarkerSegment * seg,
- const guint8 * data, gsize size, guint offset)
-{
- GstByteReader br;
- guint16 length;
-
- g_return_val_if_fail (seg != NULL, FALSE);
-
- if (size <= offset) {
- GST_DEBUG ("failed to parse from offset %u, buffer is too small", offset);
- return FALSE;
- }
-
- size -= offset;
- gst_byte_reader_init (&br, &data[offset], size);
-
- if (!jpeg_parse_to_next_marker (&br, &seg->marker)) {
- GST_DEBUG ("failed to find marker code");
- return FALSE;
- }
-
- seg->offset = offset + gst_byte_reader_get_pos (&br);
- seg->size = -1;
-
- /* Try to find end of segment */
- switch (seg->marker) {
- case GST_JPEG_MARKER_SOI:
- case GST_JPEG_MARKER_EOI:
- fixed_size_segment:
- seg->size = 2;
- break;
-
- case (GST_JPEG_MARKER_SOF_MIN + 0): /* Lf */
- case (GST_JPEG_MARKER_SOF_MIN + 1): /* Lf */
- case (GST_JPEG_MARKER_SOF_MIN + 2): /* Lf */
- case (GST_JPEG_MARKER_SOF_MIN + 3): /* Lf */
- case (GST_JPEG_MARKER_SOF_MIN + 9): /* Lf */
- case (GST_JPEG_MARKER_SOF_MIN + 10): /* Lf */
- case (GST_JPEG_MARKER_SOF_MIN + 11): /* Lf */
- case GST_JPEG_MARKER_SOS: /* Ls */
- case GST_JPEG_MARKER_DQT: /* Lq */
- case GST_JPEG_MARKER_DHT: /* Lh */
- case GST_JPEG_MARKER_DAC: /* La */
- case GST_JPEG_MARKER_DRI: /* Lr */
- case GST_JPEG_MARKER_COM: /* Lc */
- case GST_JPEG_MARKER_DNL: /* Ld */
- variable_size_segment:
- READ_UINT16 (&br, length);
- seg->size = length;
- break;
-
- default:
- /* Application data segment length (Lp) */
- if (seg->marker >= GST_JPEG_MARKER_APP_MIN &&
- seg->marker <= GST_JPEG_MARKER_APP_MAX)
- goto variable_size_segment;
-
- /* Restart markers (fixed size, two bytes only) */
- if (seg->marker >= GST_JPEG_MARKER_RST_MIN &&
- seg->marker <= GST_JPEG_MARKER_RST_MAX)
- goto fixed_size_segment;
-
- /* Fallback: scan for next marker */
- if (!jpeg_parse_to_next_marker (&br, NULL))
- goto failed;
- seg->size = gst_byte_reader_get_pos (&br) - seg->offset;
- break;
- }
- return TRUE;
-
-failed:
- return FALSE;
-}
diff --git a/gst-libs/gst/codecparsers/gstjpegparser.h b/gst-libs/gst/codecparsers/gstjpegparser.h
deleted file mode 100644
index 7237584e..00000000
--- a/gst-libs/gst/codecparsers/gstjpegparser.h
+++ /dev/null
@@ -1,414 +0,0 @@
-/*
- * gstjpegparser.h - JPEG parser
- *
- * Copyright (C) 2011-2012 Intel Corporation
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1
- * of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifndef GST_JPEG_PARSER_H
-#define GST_JPEG_PARSER_H
-
-#ifndef GST_USE_UNSTABLE_API
-# warning "The JPEG parsing library is unstable API and may change in future."
-# warning "You can define GST_USE_UNSTABLE_API to avoid this warning."
-#endif
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-/**
- * GST_JPEG_MAX_FRAME_COMPONENTS:
- *
- * Maximum number of image components in a frame (Nf).
- */
-#define GST_JPEG_MAX_FRAME_COMPONENTS 256
-
-/**
- * GST_JPEG_MAX_SCAN_COMPONENTS:
- *
- * Maximum number of image components in a scan (Ns).
- */
-#define GST_JPEG_MAX_SCAN_COMPONENTS 4
-
-/**
- * GST_JPEG_MAX_QUANT_ELEMENTS:
- *
- * Number of elements in the quantization table.
- */
-#define GST_JPEG_MAX_QUANT_ELEMENTS 64
-
-typedef struct _GstJpegQuantTable GstJpegQuantTable;
-typedef struct _GstJpegQuantTables GstJpegQuantTables;
-typedef struct _GstJpegHuffmanTable GstJpegHuffmanTable;
-typedef struct _GstJpegHuffmanTables GstJpegHuffmanTables;
-typedef struct _GstJpegScanComponent GstJpegScanComponent;
-typedef struct _GstJpegScanHdr GstJpegScanHdr;
-typedef struct _GstJpegFrameComponent GstJpegFrameComponent;
-typedef struct _GstJpegFrameHdr GstJpegFrameHdr;
-typedef struct _GstJpegMarkerSegment GstJpegMarkerSegment;
-
-/**
- * GstJpegMarkerCode:
- * @GST_JPEG_MARKER_SOF_MIN: Start of frame min marker code
- * @GST_JPEG_MARKER_SOF_MAX: Start of frame max marker code
- * @GST_JPEG_MARKER_DHT: Huffman tabler marker code
- * @GST_JPEG_MARKER_DAC: Arithmetic coding marker code
- * @GST_JPEG_MARKER_RST_MIN: Restart interval min marker code
- * @GST_JPEG_MARKER_RST_MAX: Restart interval max marker code
- * @GST_JPEG_MARKER_SOI: Start of image marker code
- * @GST_JPEG_MARKER_EOI: End of image marker code
- * @GST_JPEG_MARKER_SOS: Start of scan marker code
- * @GST_JPEG_MARKER_DQT: Define quantization table marker code
- * @GST_JPEG_MARKER_DNL: Define number of lines marker code
- * @GST_JPEG_MARKER_DRI: Define restart interval marker code
- * @GST_JPEG_MARKER_APP_MIN: Application segment min marker code
- * @GST_JPEG_MARKER_APP_MAX: Application segment max marker code
- * @GST_JPEG_MARKER_COM: Comment marker code
- *
- * Indicates the type of JPEG segment.
- */
-typedef enum {
- GST_JPEG_MARKER_SOF_MIN = 0xC0,
- GST_JPEG_MARKER_SOF_MAX = 0xCF,
- GST_JPEG_MARKER_DHT = 0xC4,
- GST_JPEG_MARKER_DAC = 0xCC,
- GST_JPEG_MARKER_RST_MIN = 0xD0,
- GST_JPEG_MARKER_RST_MAX = 0xD7,
- GST_JPEG_MARKER_SOI = 0xD8,
- GST_JPEG_MARKER_EOI = 0xD9,
- GST_JPEG_MARKER_SOS = 0xDA,
- GST_JPEG_MARKER_DQT = 0xDB,
- GST_JPEG_MARKER_DNL = 0xDC,
- GST_JPEG_MARKER_DRI = 0xDD,
- GST_JPEG_MARKER_APP_MIN = 0xE0,
- GST_JPEG_MARKER_APP_MAX = 0xEF,
- GST_JPEG_MARKER_COM = 0xFE,
-} GstJpegMarkerCode;
-
-/**
- * GstJpegProfile:
- * @GST_JPEG_PROFILE_BASELINE: Baseline DCT
- * @GST_JPEG_PROFILE_EXTENDED: Extended sequential DCT
- * @GST_JPEG_PROFILE_PROGRESSIVE: Progressive DCT
- * @GST_JPEG_PROFILE_LOSSLESS: Lossless (sequential)
- *
- * JPEG encoding processes.
- */
-typedef enum {
- GST_JPEG_PROFILE_BASELINE = 0x00,
- GST_JPEG_PROFILE_EXTENDED = 0x01,
- GST_JPEG_PROFILE_PROGRESSIVE = 0x02,
- GST_JPEG_PROFILE_LOSSLESS = 0x03,
-} GstJpegProfile;
-
-/**
- * GstJpegEntropyCodingMode:
- * @GST_JPEG_ENTROPY_CODING_HUFFMAN: Huffman coding
- * @GST_JPEG_ENTROPY_CODING_ARITHMETIC: arithmetic coding
- *
- * JPEG entropy coding mode.
- */
-typedef enum {
- GST_JPEG_ENTROPY_CODING_HUFFMAN = 0x00,
- GST_JPEG_ENTROPY_CODING_ARITHMETIC = 0x08
-} GstJpegEntropyCodingMode;
-
-/**
- * GstJpegQuantTable:
- * @quant_precision: Quantization table element precision (Pq)
- * @quant_table: Quantization table elements (Qk)
- * @valid: If the quantization table is valid, which means it has
- * already been parsed
- *
- * Quantization table.
- */
-struct _GstJpegQuantTable
-{
- guint8 quant_precision;
- guint16 quant_table[GST_JPEG_MAX_QUANT_ELEMENTS];
- gboolean valid;
-};
-
-/**
- * GstJpegQuantTables:
- * @quant_tables: All quantization tables
- *
- * Helper data structure that holds all quantization tables used to
- * decode an image.
- */
-struct _GstJpegQuantTables
-{
- GstJpegQuantTable quant_tables[GST_JPEG_MAX_SCAN_COMPONENTS];
-};
-
-/**
- * GstJpegHuffmanTable:
- * @huf_bits: Number of Huffman codes of length i + 1 (Li)
- * @huf_vales: Value associated with each Huffman code (Vij)
- * @valid: If the Huffman table is valid, which means it has already
- * been parsed
- *
- * Huffman table.
- */
-struct _GstJpegHuffmanTable
-{
- guint8 huf_bits[16];
- guint8 huf_values[256];
- gboolean valid;
-};
-
-/**
- * GstJpegHuffmanTables:
- * @dc_tables: DC Huffman tables
- * @ac_tables: AC Huffman tables
- *
- * Helper data structure that holds all AC/DC Huffman tables used to
- * decode an image.
- */
-struct _GstJpegHuffmanTables
-{
- GstJpegHuffmanTable dc_tables[GST_JPEG_MAX_SCAN_COMPONENTS];
- GstJpegHuffmanTable ac_tables[GST_JPEG_MAX_SCAN_COMPONENTS];
-};
-
-/**
- * GstJpegScanComponent:
- * @component_selector: Scan component selector (Csj)
- * @dc_selector: DC entropy coding table destination selector (Tdj)
- * @ac_selector: AC entropy coding table destination selector (Taj)
-
- * Component-specification parameters.
- */
-struct _GstJpegScanComponent
-{
- guint8 component_selector; /* 0 .. 255 */
- guint8 dc_selector; /* 0 .. 3 */
- guint8 ac_selector; /* 0 .. 3 */
-};
-
-/**
- * GstJpegScanHdr:
- * @num_components: Number of image components in scan (Ns)
- * @components: Image components
- *
- * Scan header.
- */
-struct _GstJpegScanHdr
-{
- guint8 num_components; /* 1 .. 4 */
- GstJpegScanComponent components[GST_JPEG_MAX_SCAN_COMPONENTS];
-};
-
-/**
- * GstJpegFrameComponent:
- * @identifier: Component identifier (Ci)
- * @horizontal_factor: Horizontal sampling factor (Hi)
- * @vertical_factor: Vertical sampling factor (Vi)
- * @quant_table_selector: Quantization table destination selector (Tqi)
- *
- * Component-specification parameters.
- */
-struct _GstJpegFrameComponent
-{
- guint8 identifier; /* 0 .. 255 */
- guint8 horizontal_factor; /* 1 .. 4 */
- guint8 vertical_factor; /* 1 .. 4 */
- guint8 quant_table_selector; /* 0 .. 3 */
-};
-
-/**
- * GstJpegFrameHdr:
- * @sample_precision: Sample precision (P)
- * @height: Number of lines (Y)
- * @width: Number of samples per line (X)
- * @num_components: Number of image components in frame (Nf)
- * @components: Image components
- * @restart_interval: Number of MCU in the restart interval (Ri)
- *
- * Frame header.
- */
-struct _GstJpegFrameHdr
-{
- guint8 sample_precision; /* 2 .. 16 */
- guint16 width; /* 1 .. 65535 */
- guint16 height; /* 0 .. 65535 */
- guint8 num_components; /* 1 .. 255 */
- GstJpegFrameComponent components[GST_JPEG_MAX_FRAME_COMPONENTS];
-};
-
-/**
- * GstJpegMarkerSegment:
- * @type: The type of the segment that starts at @offset
- * @offset: The offset to the segment start in bytes. This is the
- * exact start of the segment, no marker code included
- * @size: The size in bytes of the segment, or -1 if the end was not
- * found. It is the exact size of the segment, no marker code included
- *
- * A structure that contains the type of a segment, its offset and its size.
- */
-struct _GstJpegMarkerSegment
-{
- guint8 marker;
- guint offset;
- gint size;
-};
-
-/**
- * gst_jpeg_scan_for_marker_code:
- * @data: The data to parse
- * @size: The size of @data
- * @offset: The offset from which to start parsing
- *
- * Scans the JPEG bitstream contained in @data for the next marker
- * code. If found, the function returns an offset to the marker code,
- * including the 0xff prefix code but excluding any extra fill bytes.
- *
- * Returns: offset to the marker code if found, or -1 if not found.
- */
-gint gst_jpeg_scan_for_marker_code (const guint8 * data,
- gsize size,
- guint offset);
-
-/**
- * gst_jpeg_parse:
- * @data: The data to parse
- * @size: The size of @data
- * @offset: The offset from which to start parsing
- *
- * Parses the JPEG bitstream contained in @data, and returns the
- * detected segment as a #GstJpegMarkerSegment.
- *
- * Returns: TRUE if a packet start code was found.
- */
-gboolean gst_jpeg_parse (GstJpegMarkerSegment * seg,
- const guint8 * data,
- gsize size,
- guint offset);
-
-/**
- * gst_jpeg_parse_frame_hdr:
- * @hdr: (out): The #GstJpegFrameHdr structure to fill in
- * @data: The data from which to parse the frame header
- * @size: The size of @data
- * @offset: The offset in bytes from which to start parsing @data
- *
- * Parses the @hdr JPEG frame header structure members from @data.
- *
- * Returns: TRUE if the frame header was correctly parsed.
- */
-gboolean gst_jpeg_parse_frame_hdr (GstJpegFrameHdr * hdr,
- const guint8 * data,
- gsize size,
- guint offset);
-
-/**
- * gst_jpeg_parse_scan_hdr:
- * @hdr: (out): The #GstJpegScanHdr structure to fill in
- * @data: The data from which to parse the scan header
- * @size: The size of @data
- * @offset: The offset in bytes from which to start parsing @data
- *
- * Parses the @hdr JPEG scan header structure members from @data.
- *
- * Returns: TRUE if the scan header was correctly parsed
- */
-gboolean gst_jpeg_parse_scan_hdr (GstJpegScanHdr * hdr,
- const guint8 * data,
- gsize size,
- guint offset);
-
-/**
- * gst_jpeg_parse_quantization_table:
- * @quant_tables: (out): The #GstJpegQuantizationTable structure to fill in
- * @num_quant_tables: The number of allocated quantization tables in @quant_tables
- * @data: The data from which to parse the quantization table
- * @size: The size of @data
- * @offset: The offset in bytes from which to start parsing @data
- *
- * Parses the JPEG quantization table structure members from @data.
- *
- * Note: @quant_tables represents the complete set of possible
- * quantization tables. However, the parser will only write to the
- * quantization table specified by the table destination identifier
- * (Tq). While doing so, the @valid flag of the specified quantization
- * table will also be set to %TRUE.
- *
- * Returns: TRUE if the quantization table was correctly parsed.
- */
-gboolean gst_jpeg_parse_quant_table (GstJpegQuantTables *quant_tables,
- const guint8 * data,
- gsize size,
- guint offset);
-
-/**
- * gst_jpeg_parse_huffman_table:
- * @huf_tables: (out): The #GstJpegHuffmanTable structure to fill in
- * @data: The data from which to parse the Huffman table
- * @size: The size of @data
- * @offset: The offset in bytes from which to start parsing @data
- *
- * Parses the JPEG Huffman table structure members from @data.
- *
- * Note: @huf_tables represents the complete set of possible Huffman
- * tables. However, the parser will only write to the Huffman table
- * specified by the table destination identifier (Th). While doing so,
- * the @valid flag of the specified Huffman table will also be set to
- * %TRUE;
- *
- * Returns: TRUE if the Huffman table was correctly parsed.
- */
-gboolean gst_jpeg_parse_huffman_table (GstJpegHuffmanTables *huf_tables,
- const guint8 * data,
- gsize size,
- guint offset);
-
-/**
- * gst_jpeg_parse_restart_interval:
- * @interval: (out): The parsed restart interval value
- * @data: The data from which to parse the restart interval specification
- * @size: The size of @data
- * @offset: The offset in bytes from which to start parsing @data
- *
- * Returns: TRUE if the restart interval value was correctly parsed.
- */
-gboolean gst_jpeg_parse_restart_interval (guint * interval,
- const guint8 * data,
- gsize size,
- guint offset);
-
-/**
- * gst_jpeg_get_default_huffman_tables:
- * @huf_tables: (out): The default DC/AC Huffman tables to fill in
- *
- * Fills in @huf_tables with the default AC/DC Huffman tables, as
- * specified by the JPEG standard.
- */
-void gst_jpeg_get_default_huffman_tables (GstJpegHuffmanTables *huf_tables);
-
-/**
- * gst_jpeg_get_default_quantization_table:
- * @quant_tables: (out): The default luma/chroma quant-tables in zigzag mode
- *
- * Fills in @quant_tables with the default quantization tables, as
- * specified by the JPEG standard.
- */
-void gst_jpeg_get_default_quantization_tables (GstJpegQuantTables *quant_tables);
-
-G_END_DECLS
-
-#endif /* GST_JPEG_PARSER_H */
diff --git a/gst-libs/gst/vaapi/Makefile.am b/gst-libs/gst/vaapi/Makefile.am
index 9d7441f6..313d5500 100644
--- a/gst-libs/gst/vaapi/Makefile.am
+++ b/gst-libs/gst/vaapi/Makefile.am
@@ -22,6 +22,7 @@ libgstvaapi_includedir = \
libgstvaapi_cflags = \
-DGST_USE_UNSTABLE_API \
-I$(top_srcdir)/gst-libs \
+ -I$(top_builddir)/gst-libs \
$(GST_BASE_CFLAGS) \
$(GST_BASEVIDEO_CFLAGS) \
$(GST_VIDEO_CFLAGS) \
@@ -37,7 +38,7 @@ libgstvaapi_libs = \
$(GST_VIDEO_LIBS) \
$(GST_CODEC_PARSERS_LIBS) \
$(LIBVA_LIBS) \
- $(NULL)
+ $(top_builddir)/gst-libs/gst/codecparsers/libgstvaapi-codecparsers.la
libgstvaapi_source_c = \
gstvaapicodec_objects.c \
@@ -197,11 +198,6 @@ libgstvaapi_wayland_source_priv_h = \
gstvaapiutils.h \
$(NULL)
-if USE_LOCAL_CODEC_PARSERS
-libgstvaapi_libs += \
- $(top_builddir)/gst-libs/gst/codecparsers/libgstvaapi-codecparsers.la
-endif
-
libgstvaapi_@GST_MAJORMINOR@_la_SOURCES = \
$(libgstvaapi_source_c) \
$(libgstvaapi_source_priv_h) \