From: Gwenole Beauchesne Date: Thu, 13 Feb 2014 20:17:23 +0000 (+0100) Subject: vp8: use range decoder from libvpx. X-Git-Tag: 1.19.3~503^2~2191 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b36eade7f3203630738fa44f00d415e805077dde;p=platform%2Fupstream%2Fgstreamer.git vp8: use range decoder from libvpx. Add libvpx submodule that tracks the upstream version 1.3.0. This is needed to build a libgstcodecparsers_vpx.so library with all symbols placed into the GSTREAMER namespace. --- diff --git a/.gitmodules b/.gitmodules index bad3c46..b4b4ef7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,6 @@ [submodule "ext/videoutils"] path = ext/videoutils url = git://gitorious.org/vaapi/gstreamer-videoutils.git +[submodule "ext/libvpx/upstream"] + path = ext/libvpx/upstream + url = https://chromium.googlesource.com/webm/libvpx diff --git a/autogen.sh b/autogen.sh index b4a63f3..d7213af 100755 --- a/autogen.sh +++ b/autogen.sh @@ -26,6 +26,7 @@ else submodule_init="yes" fi done + [ -f ext/libvpx/upstream/configure ] || submodule_init="yes" if test "$submodule_init" = "yes"; then $GIT submodule init fi diff --git a/configure.ac b/configure.ac index 52d268d..d6928f1 100644 --- a/configure.ac +++ b/configure.ac @@ -95,6 +95,12 @@ AC_ARG_VAR([GIT], [Path to git program, if any]) AC_PATH_PROG([GIT], [git]) AM_CONDITIONAL([HAVE_GIT], [test -n "$GIT"]) +AC_ARG_VAR([YASM], [Path to yasm program, if any]) +AC_PATH_PROG([YASM], [yasm]) +if test -z "$YASM"; then + AC_MSG_ERROR([yasm is needed to build libvpx sources]) +fi + dnl Initialize libtool LT_PREREQ([2.2]) LT_INIT @@ -834,6 +840,7 @@ debian.upstream/libgstvaapi-x11.install.in docs/reference/plugins/Makefile docs/reference/plugins/plugins-docs.xml ext/Makefile + ext/libvpx/Makefile gst-libs/Makefile gst-libs/gst/Makefile gst-libs/gst/base/Makefile diff --git a/ext/Makefile.am b/ext/Makefile.am index 62f3ec4..9c20bcd 100644 --- a/ext/Makefile.am +++ b/ext/Makefile.am @@ -1,3 +1,5 @@ +SUBDIRS = libvpx + EXTRA_DIST = codecparsers_srcdir = \ diff --git a/ext/libvpx/Makefile.am b/ext/libvpx/Makefile.am new file mode 100644 index 0000000..9211a21 --- /dev/null +++ b/ext/libvpx/Makefile.am @@ -0,0 +1,141 @@ +# Makefile.am - Rules for the built-in libvpx sources +# +# INTEL CONFIDENTIAL, FOR INTERNAL USE ONLY +# Copyright (C) 2014 Intel Corporation +# Author: Gwenole Beauchesne +# +# @BEGIN_LICENSE@ +# The source code contained or described herein and all documents +# related to the source code ("Material") are owned by Intel +# Corporation or its suppliers or licensors. Title to the Material +# remains with Intel Corporation or its suppliers and licensors. The +# Material contains trade secrets and proprietary and confidential +# information of Intel or its suppliers and licensors. The Material +# is protected by worldwide copyright and trade secret laws and +# treaty provisions. No part of the Material may be used, copied, +# reproduced, modified, published, uploaded, posted, transmitted, +# distributed, or disclosed in any way without Intel’s prior express +# written permission. +# +# No license under any patent, copyright, trade secret or other +# intellectual property right is granted to or conferred upon you by +# disclosure or delivery of the Materials, either expressly, by +# implication, inducement, estoppel or otherwise. Any license under +# such intellectual property rights must be express and approved by +# Intel in writing. +# @END_LICENSE@ + +lib_LTLIBRARIES = +if USE_LOCAL_CODEC_PARSERS_VP8 +lib_LTLIBRARIES += libgstcodecparsers_vpx.la +endif + +gst_vpx_source_c = gstlibvpx.c +gst_vpx_source_h = gstlibvpx.h + +vpx_upstream = upstream +vpx_srcdir = $(srcdir)/$(vpx_upstream) +vpx_builddir = $(builddir)/$(vpx_upstream) +vpx_versions = libgstcodecparsers_vpx.vers + +vpx_cflags = \ + -I$(vpx_srcdir) \ + -I$(vpx_builddir) \ + $(NULL) + +vpx_libs = \ + -Wl,-Bsymbolic \ + -Wl,--whole-archive \ + -Wl,$(vpx_builddir)/libvpx.a \ + -Wl,--no-whole-archive \ + -Wl,--version-script,$(srcdir)/$(vpx_versions) \ + -Wl,-lpthread \ + -Wl,-lm \ + $(NULL) + +libgstcodecparsers_vpx_la_SOURCES = $(gst_vpx_source_c) +libgstcodecparsers_vpx_la_CFLAGS = $(vpx_cflags) +libgstcodecparsers_vpx_la_DEPENDENCIES = vpx.build +libgstcodecparsers_vpx_la_LINK = $(LINK) $(vpx_libs) +EXTRA_libgstcodecparsers_vpx_la_DEPENDENCIES = $(srcdir)/$(vpx_versions) + +VPX_DEBUG = yes + +# Codecs +VP8_DECODER = enable +VP8_ENCODER = disable +VP9_DECODER = disable +VP9_ENCODER = disable + +clean-local: vpx.clean +maintainer-clean-local: vpx.maintainer.clean + +vpx.build: vpx.configure.stamp + @$(MAKE) -C $(vpx_builddir) + +vpx.clean: + @[ -d $(vpx_builddir) ] && \ + $(MAKE) -C $(vpx_builddir) clean || : + rm -f vpx.build.stamp vpx.configure.stamp + +vpx.maintainer.clean: vpx.clean + rm -rf $(vpx_builddir) + +vpx.configure.stamp: + @[ -d $(vpx_builddir) ] || mkdir $(vpx_builddir); \ + cd $(vpx_builddir) ; \ + test "$(VPX_DEBUG)" = "yes" && \ + CONFIGURE_FLAGS="$$CONFIGURE_FLAGS --enable-debug" ; \ + $(abs_srcdir)/$(vpx_upstream)/configure $$CONFIGURE_FLAGS \ + --enable-static \ + --enable-pic \ + --disable-shared \ + --$(VP8_DECODER)-vp8-decoder \ + --$(VP8_ENCODER)-vp8-encoder \ + --$(VP9_DECODER)-vp9-decoder \ + --$(VP9_ENCODER)-vp9-encoder \ + --enable-runtime-cpu-detect \ + --disable-md5 \ + --disable-examples \ + --disable-docs \ + --disable-unit-tests && \ + cd .. && \ + touch $@ + +CLEANFILES = vpx.build.stamp + +# Files for packaging +include $(srcdir)/sources.frag + +vpx_sources = \ + $(vpx_srcdir)/AUTHORS \ + $(vpx_srcdir)/CHANGELOG \ + $(vpx_srcdir)/LICENSE \ + $(vpx_srcdir)/PATENTS \ + $(vpx_srcdir)/build/make/Makefile \ + $(vpx_srcdir)/build/make/ads2gas.pl \ + $(vpx_srcdir)/build/make/ads2gas_apple.pl \ + $(vpx_srcdir)/build/make/configure.sh \ + $(vpx_srcdir)/build/make/gen_asm_deps.sh \ + $(vpx_srcdir)/build/make/obj_int_extract.c \ + $(vpx_srcdir)/build/make/rtcd.sh \ + $(vpx_srcdir)/build/make/version.sh \ + $(vpx_srcdir)/configure \ + $(vpx_srcdir)/vp8/common/rtcd_defs.sh \ + $(vpx_srcdir)/vp9/common/vp9_rtcd_defs.sh \ + $(vpx_srcdir)/vpx_scale/vpx_scale_rtcd.sh \ + $(vpx_source_mak:%.mk=$(vpx_srcdir)/%.mk) \ + $(vpx_source_c:%.c=$(vpx_srcdir)/%.c) \ + $(vpx_source_h:%.h=$(vpx_srcdir)/%.h) \ + $(vpx_source_asm:%.asm=$(vpx_srcdir)/%.asm) \ + $(NULL) + +EXTRA_DIST = \ + sources.frag \ + $(gst_vpx_source_h) \ + $(vpx_sources) \ + $(vpx_versions) \ + $(NULL) + +# Extra clean files so that maintainer-clean removes *everything* +MAINTAINERCLEANFILES = Makefile.in vpx.configure.stamp diff --git a/ext/libvpx/gstlibvpx.c b/ext/libvpx/gstlibvpx.c new file mode 100644 index 0000000..fc376e1 --- /dev/null +++ b/ext/libvpx/gstlibvpx.c @@ -0,0 +1,119 @@ +/* + * gstlibvpx.c - GStreamer/libvpx glue + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#include +#include +#include +#include +#include +#include +#include "gstlibvpx.h" + +#define BOOL_DECODER_CAST(bd) \ + ((BOOL_DECODER *)(&(bd)->private[1])) + +bool +vp8_bool_decoder_init (vp8_bool_decoder * bd, const uint8_t * buf, + unsigned int buf_size) +{ + assert ((sizeof (*bd) - sizeof (bd->private[0])) >= sizeof (BOOL_DECODER)); + + bd->private[0] = (uintptr_t)buf; + return vp8dx_start_decode (BOOL_DECODER_CAST (bd), buf, buf_size, + NULL, NULL) == 0; +} + +int +vp8_bool_decoder_read (vp8_bool_decoder * bd, uint8_t prob) +{ + return vp8dx_decode_bool (BOOL_DECODER_CAST (bd), prob); +} + +int +vp8_bool_decoder_read_literal (vp8_bool_decoder * bd, int bits) +{ + return vp8_decode_value (BOOL_DECODER_CAST (bd), bits); +} + +unsigned int +vp8_bool_decoder_get_pos (vp8_bool_decoder * bd_) +{ + BOOL_DECODER *const bd = BOOL_DECODER_CAST (bd_); + + return ((uintptr_t)bd->user_buffer - bd_->private[0]) * 8 - (8 + bd->count); +} + +void +vp8_bool_decoder_get_state (vp8_bool_decoder * bd_, + vp8_bool_decoder_state * state) +{ + BOOL_DECODER *const bd = BOOL_DECODER_CAST (bd_); + + if (bd->count < 0) + vp8dx_bool_decoder_fill (bd); + + state->range = bd->range; + state->value = (uint8_t) ((bd->value) >> (VP8_BD_VALUE_SIZE - 8)); + state->count = (8 + bd->count) % 8; +} + +void +vp8_init_token_update_probs (uint8_t + probs[BLOCK_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES]) +{ + memcpy (probs, vp8_coef_update_probs, sizeof (vp8_coef_update_probs)); +} + +void +vp8_init_default_token_probs (uint8_t + probs[BLOCK_TYPES][COEF_BANDS][PREV_COEF_CONTEXTS][ENTROPY_NODES]) +{ + memcpy (probs, default_coef_probs, sizeof (default_coef_probs)); +} + +void +vp8_init_mv_update_probs (uint8_t probs[2][MVPcount]) +{ + memcpy (probs[0], vp8_mv_update_probs[0].prob, + sizeof (vp8_mv_update_probs[0].prob)); + memcpy (probs[1], vp8_mv_update_probs[1].prob, + sizeof (vp8_mv_update_probs[1].prob)); +} + +void +vp8_init_default_mv_probs (uint8_t probs[2][MVPcount]) +{ + memcpy (probs[0], vp8_default_mv_context[0].prob, + sizeof (vp8_default_mv_context[0].prob)); + memcpy (probs[1], vp8_default_mv_context[1].prob, + sizeof (vp8_default_mv_context[1].prob)); +} + +void +vp8_init_default_intra_mode_probs (uint8_t y_probs[VP8_YMODES-1], + uint8_t uv_probs[VP8_UV_MODES-1]) +{ + extern const uint8_t vp8_kf_ymode_prob[VP8_YMODES-1]; + extern const uint8_t vp8_kf_uv_mode_prob[VP8_UV_MODES-1]; + + memcpy (y_probs, vp8_kf_ymode_prob, sizeof (vp8_kf_ymode_prob)); + memcpy (uv_probs, vp8_kf_uv_mode_prob, sizeof (vp8_kf_uv_mode_prob)); +} + +void +vp8_init_default_inter_mode_probs (uint8_t y_probs[VP8_YMODES-1], + uint8_t uv_probs[VP8_UV_MODES-1]) +{ + extern const uint8_t vp8_ymode_prob[VP8_YMODES-1]; + extern const uint8_t vp8_uv_mode_prob[VP8_UV_MODES-1]; + + memcpy (y_probs, vp8_ymode_prob, sizeof (vp8_ymode_prob)); + memcpy (uv_probs, vp8_uv_mode_prob, sizeof (vp8_uv_mode_prob)); +} diff --git a/ext/libvpx/gstlibvpx.h b/ext/libvpx/gstlibvpx.h new file mode 100644 index 0000000..d4bd784 --- /dev/null +++ b/ext/libvpx/gstlibvpx.h @@ -0,0 +1,65 @@ +/* + * gstlibvpx.h - GStreamer/libvpx glue + * + * Use of this source code is governed by a BSD-style license + * that can be found in the LICENSE file in the root of the source + * tree. An additional intellectual property rights grant can be found + * in the file PATENTS. All contributing project authors may + * be found in the AUTHORS file in the root of the source tree. + */ + +#ifndef GST_LIBVPX_H +#define GST_LIBVPX_H + +#include +#include + +typedef struct _vp8_bool_decoder vp8_bool_decoder; +typedef struct _vp8_bool_decoder_state vp8_bool_decoder_state; + +struct _vp8_bool_decoder { + uintptr_t private[16]; +}; + +struct _vp8_bool_decoder_state { + uint8_t range; /* Current "range" value (<= 255) */ + uint8_t value; /* Current "value" value */ + uint8_t count; /* Number of bits shifted out of value (<= 7) */ +}; + +bool +vp8_bool_decoder_init (vp8_bool_decoder * bd, const uint8_t * buf, + unsigned int buf_size); + +int +vp8_bool_decoder_read (vp8_bool_decoder * bd, uint8_t prob); + +int +vp8_bool_decoder_read_literal (vp8_bool_decoder * bd, int bits); + +unsigned int +vp8_bool_decoder_get_pos (vp8_bool_decoder * bd); + +void +vp8_bool_decoder_get_state (vp8_bool_decoder * bd, + vp8_bool_decoder_state * state); + +void +vp8_init_token_update_probs (uint8_t probs[4][8][3][11]); + +void +vp8_init_default_token_probs (uint8_t probs[4][8][3][11]); + +void +vp8_init_mv_update_probs (uint8_t probs[2][19]); + +void +vp8_init_default_mv_probs (uint8_t probs[2][19]); + +void +vp8_init_default_intra_mode_probs (uint8_t y_probs[4], uint8_t uv_probs[3]); + +void +vp8_init_default_inter_mode_probs (uint8_t y_probs[4], uint8_t uv_probs[3]); + +#endif /* GST_LIBVPX_H */ diff --git a/ext/libvpx/libgstcodecparsers_vpx.vers b/ext/libvpx/libgstcodecparsers_vpx.vers new file mode 100644 index 0000000..6c178e7 --- /dev/null +++ b/ext/libvpx/libgstcodecparsers_vpx.vers @@ -0,0 +1,16 @@ +GSTREAMER { +global: + vp8_bool_decoder_init; + vp8_bool_decoder_read; + vp8_bool_decoder_read_literal; + vp8_bool_decoder_get_pos; + vp8_bool_decoder_get_state; + vp8_init_token_update_probs; + vp8_init_default_token_probs; + vp8_init_mv_update_probs; + vp8_init_default_mv_probs; + vp8_init_default_intra_mode_probs; + vp8_init_default_inter_mode_probs; +local: + *; +}; diff --git a/ext/libvpx/sources.frag b/ext/libvpx/sources.frag new file mode 100644 index 0000000..d96f6d2 --- /dev/null +++ b/ext/libvpx/sources.frag @@ -0,0 +1,278 @@ +# sources.frag - Generated list of source files for libvpx (-*- makefile -*-) +# +# INTEL CONFIDENTIAL, FOR INTERNAL USE ONLY +# Copyright (C) 2014 Intel Corporation +# Author: Gwenole Beauchesne +# +# @BEGIN_LICENSE@ +# The source code contained or described herein and all documents +# related to the source code ("Material") are owned by Intel +# Corporation or its suppliers or licensors. Title to the Material +# remains with Intel Corporation or its suppliers and licensors. The +# Material contains trade secrets and proprietary and confidential +# information of Intel or its suppliers and licensors. The Material +# is protected by worldwide copyright and trade secret laws and +# treaty provisions. No part of the Material may be used, copied, +# reproduced, modified, published, uploaded, posted, transmitted, +# distributed, or disclosed in any way without Intel’s prior express +# written permission. +# +# No license under any patent, copyright, trade secret or other +# intellectual property right is granted to or conferred upon you by +# disclosure or delivery of the Materials, either expressly, by +# implication, inducement, estoppel or otherwise. Any license under +# such intellectual property rights must be express and approved by +# Intel in writing. +# @END_LICENSE@ + +vpx_source_mak = \ + docs.mk \ + examples.mk \ + libs.mk \ + solution.mk \ + test/test.mk \ + vp8/vp8_common.mk \ + vp8/vp8cx.mk \ + vp8/vp8cx_arm.mk \ + vp8/vp8dx.mk \ + vp9/vp9_common.mk \ + vp9/vp9cx.mk \ + vp9/vp9dx.mk \ + vpx/vpx_codec.mk \ + vpx_mem/vpx_mem.mk \ + vpx_ports/vpx_ports.mk \ + vpx_scale/vpx_scale.mk \ + $(NULL) + +vpx_source_c = \ + vp8/common/alloccommon.c \ + vp8/common/blockd.c \ + vp8/common/debugmodes.c \ + vp8/common/dequantize.c \ + vp8/common/entropy.c \ + vp8/common/entropymode.c \ + vp8/common/entropymv.c \ + vp8/common/extend.c \ + vp8/common/filter.c \ + vp8/common/findnearmv.c \ + vp8/common/generic/systemdependent.c \ + vp8/common/idct_blk.c \ + vp8/common/idctllm.c \ + vp8/common/loopfilter.c \ + vp8/common/loopfilter_filters.c \ + vp8/common/mbpitch.c \ + vp8/common/mfqe.c \ + vp8/common/modecont.c \ + vp8/common/postproc.c \ + vp8/common/quant_common.c \ + vp8/common/reconinter.c \ + vp8/common/reconintra.c \ + vp8/common/reconintra4x4.c \ + vp8/common/rtcd.c \ + vp8/common/sad_c.c \ + vp8/common/setupintrarecon.c \ + vp8/common/swapyv12buffer.c \ + vp8/common/treecoder.c \ + vp8/common/variance_c.c \ + vp8/common/x86/filter_x86.c \ + vp8/common/x86/idct_blk_mmx.c \ + vp8/common/x86/idct_blk_sse2.c \ + vp8/common/x86/loopfilter_x86.c \ + vp8/common/x86/postproc_x86.c \ + vp8/common/x86/recon_wrapper_sse2.c \ + vp8/common/x86/variance_mmx.c \ + vp8/common/x86/variance_sse2.c \ + vp8/common/x86/variance_ssse3.c \ + vp8/common/x86/vp8_asm_stubs.c \ + vp8/decoder/dboolhuff.c \ + vp8/decoder/decodemv.c \ + vp8/decoder/decodframe.c \ + vp8/decoder/detokenize.c \ + vp8/decoder/onyxd_if.c \ + vp8/decoder/threading.c \ + vp8/vp8_dx_iface.c \ + vp9/common/generic/vp9_systemdependent.c \ + vp9/common/vp9_alloccommon.c \ + vp9/common/vp9_common_data.c \ + vp9/common/vp9_convolve.c \ + vp9/common/vp9_debugmodes.c \ + vp9/common/vp9_entropy.c \ + vp9/common/vp9_entropymode.c \ + vp9/common/vp9_entropymv.c \ + vp9/common/vp9_extend.c \ + vp9/common/vp9_filter.c \ + vp9/common/vp9_findnearmv.c \ + vp9/common/vp9_idct.c \ + vp9/common/vp9_loopfilter.c \ + vp9/common/vp9_loopfilter_filters.c \ + vp9/common/vp9_mvref_common.c \ + vp9/common/vp9_pred_common.c \ + vp9/common/vp9_quant_common.c \ + vp9/common/vp9_reconinter.c \ + vp9/common/vp9_reconintra.c \ + vp9/common/vp9_rtcd.c \ + vp9/common/vp9_scale.c \ + vp9/common/vp9_scan.c \ + vp9/common/vp9_seg_common.c \ + vp9/common/vp9_tile_common.c \ + vp9/common/vp9_treecoder.c \ + vp9/common/x86/vp9_asm_stubs.c \ + vp9/common/x86/vp9_idct_intrin_sse2.c \ + vp9/common/x86/vp9_loopfilter_intrin_sse2.c \ + vp9/decoder/vp9_dboolhuff.c \ + vp9/decoder/vp9_decodemv.c \ + vp9/decoder/vp9_decodframe.c \ + vp9/decoder/vp9_detokenize.c \ + vp9/decoder/vp9_dsubexp.c \ + vp9/decoder/vp9_onyxd_if.c \ + vp9/decoder/vp9_thread.c \ + vp9/vp9_dx_iface.c \ + vpx/src/vpx_codec.c \ + vpx/src/vpx_decoder.c \ + vpx/src/vpx_encoder.c \ + vpx/src/vpx_image.c \ + vpx_mem/vpx_mem.c \ + vpx_ports/x86_cpuid.c \ + vpx_scale/generic/gen_scalers.c \ + vpx_scale/generic/vpx_scale.c \ + vpx_scale/generic/yv12config.c \ + vpx_scale/generic/yv12extend.c \ + vpx_scale/vpx_scale_asm_offsets.c \ + vpx_scale/vpx_scale_rtcd.c \ + $(NULL) + +vpx_source_h = \ + vp8/common/alloccommon.h \ + vp8/common/blockd.h \ + vp8/common/coefupdateprobs.h \ + vp8/common/common.h \ + vp8/common/default_coef_probs.h \ + vp8/common/entropy.h \ + vp8/common/entropymode.h \ + vp8/common/entropymv.h \ + vp8/common/extend.h \ + vp8/common/filter.h \ + vp8/common/findnearmv.h \ + vp8/common/header.h \ + vp8/common/invtrans.h \ + vp8/common/loopfilter.h \ + vp8/common/modecont.h \ + vp8/common/mv.h \ + vp8/common/onyxc_int.h \ + vp8/common/onyxd.h \ + vp8/common/postproc.h \ + vp8/common/ppflags.h \ + vp8/common/pragmas.h \ + vp8/common/quant_common.h \ + vp8/common/reconinter.h \ + vp8/common/reconintra4x4.h \ + vp8/common/setupintrarecon.h \ + vp8/common/swapyv12buffer.h \ + vp8/common/systemdependent.h \ + vp8/common/threading.h \ + vp8/common/treecoder.h \ + vp8/common/variance.h \ + vp8/common/vp8_entropymodedata.h \ + vp8/common/x86/filter_x86.h \ + vp8/decoder/dboolhuff.h \ + vp8/decoder/decodemv.h \ + vp8/decoder/decoderthreading.h \ + vp8/decoder/detokenize.h \ + vp8/decoder/onyxd_int.h \ + vp8/decoder/treereader.h \ + vp9/common/vp9_alloccommon.h \ + vp9/common/vp9_blockd.h \ + vp9/common/vp9_common.h \ + vp9/common/vp9_common_data.h \ + vp9/common/vp9_convolve.h \ + vp9/common/vp9_default_coef_probs.h \ + vp9/common/vp9_entropy.h \ + vp9/common/vp9_entropymode.h \ + vp9/common/vp9_entropymv.h \ + vp9/common/vp9_enums.h \ + vp9/common/vp9_extend.h \ + vp9/common/vp9_filter.h \ + vp9/common/vp9_findnearmv.h \ + vp9/common/vp9_idct.h \ + vp9/common/vp9_loopfilter.h \ + vp9/common/vp9_mv.h \ + vp9/common/vp9_mvref_common.h \ + vp9/common/vp9_onyxc_int.h \ + vp9/common/vp9_ppflags.h \ + vp9/common/vp9_pred_common.h \ + vp9/common/vp9_quant_common.h \ + vp9/common/vp9_reconinter.h \ + vp9/common/vp9_reconintra.h \ + vp9/common/vp9_scale.h \ + vp9/common/vp9_scan.h \ + vp9/common/vp9_seg_common.h \ + vp9/common/vp9_systemdependent.h \ + vp9/common/vp9_tile_common.h \ + vp9/common/vp9_treecoder.h \ + vp9/decoder/vp9_dboolhuff.h \ + vp9/decoder/vp9_decodemv.h \ + vp9/decoder/vp9_decodframe.h \ + vp9/decoder/vp9_detokenize.h \ + vp9/decoder/vp9_dsubexp.h \ + vp9/decoder/vp9_onyxd.h \ + vp9/decoder/vp9_onyxd_int.h \ + vp9/decoder/vp9_read_bit_buffer.h \ + vp9/decoder/vp9_thread.h \ + vp9/decoder/vp9_thread.h \ + vp9/decoder/vp9_treereader.h \ + vp9/vp9_iface_common.h \ + vpx/internal/vpx_codec_internal.h \ + vpx/vp8.h \ + vpx/vp8dx.h \ + vpx/vpx_codec.h \ + vpx/vpx_decoder.h \ + vpx/vpx_encoder.h \ + vpx/vpx_image.h \ + vpx/vpx_integer.h \ + vpx_mem/include/vpx_mem_intrnl.h \ + vpx_mem/vpx_mem.h \ + vpx_ports/asm_offsets.h \ + vpx_ports/emmintrin_compat.h \ + vpx_ports/mem.h \ + vpx_ports/vpx_once.h \ + vpx_ports/vpx_timer.h \ + vpx_ports/x86.h \ + vpx_scale/vpx_scale.h \ + vpx_scale/yv12config.h \ + $(NULL) + +vpx_source_asm = \ + third_party/x86inc/x86inc.asm \ + vp8/common/x86/dequantize_mmx.asm \ + vp8/common/x86/idctllm_mmx.asm \ + vp8/common/x86/idctllm_sse2.asm \ + vp8/common/x86/iwalsh_mmx.asm \ + vp8/common/x86/iwalsh_sse2.asm \ + vp8/common/x86/loopfilter_block_sse2.asm \ + vp8/common/x86/loopfilter_mmx.asm \ + vp8/common/x86/loopfilter_sse2.asm \ + vp8/common/x86/mfqe_sse2.asm \ + vp8/common/x86/postproc_mmx.asm \ + vp8/common/x86/postproc_sse2.asm \ + vp8/common/x86/recon_mmx.asm \ + vp8/common/x86/recon_sse2.asm \ + vp8/common/x86/sad_mmx.asm \ + vp8/common/x86/sad_sse2.asm \ + vp8/common/x86/sad_sse3.asm \ + vp8/common/x86/sad_sse4.asm \ + vp8/common/x86/sad_ssse3.asm \ + vp8/common/x86/subpixel_mmx.asm \ + vp8/common/x86/subpixel_sse2.asm \ + vp8/common/x86/subpixel_ssse3.asm \ + vp8/common/x86/variance_impl_mmx.asm \ + vp8/common/x86/variance_impl_sse2.asm \ + vp8/common/x86/variance_impl_ssse3.asm \ + vp9/common/x86/vp9_copy_sse2.asm \ + vp9/common/x86/vp9_intrapred_sse2.asm \ + vp9/common/x86/vp9_intrapred_ssse3.asm \ + vp9/common/x86/vp9_loopfilter_mmx.asm \ + vp9/common/x86/vp9_subpixel_8t_sse2.asm \ + vp9/common/x86/vp9_subpixel_8t_ssse3.asm \ + vpx_ports/emms.asm \ + vpx_ports/x86_abi_support.asm \ + $(NULL) diff --git a/ext/libvpx/upstream b/ext/libvpx/upstream new file mode 160000 index 0000000..2e88f2f --- /dev/null +++ b/ext/libvpx/upstream @@ -0,0 +1 @@ +Subproject commit 2e88f2f2ec777259bda1714e72f1ecd2519bceb5 diff --git a/gst-libs/gst/codecparsers/Makefile.am b/gst-libs/gst/codecparsers/Makefile.am index 3d414d9..ece46ef 100644 --- a/gst-libs/gst/codecparsers/Makefile.am +++ b/gst-libs/gst/codecparsers/Makefile.am @@ -18,6 +18,8 @@ libgstvaapi_codecparsers_libs = \ $(GST_LIBS) \ $(NULL) +add_source_c = +add_source_h = gen_source_c = parserutils.c nalutils.c gen_source_h = parserutils.h nalutils.h @@ -43,9 +45,17 @@ endif if USE_LOCAL_CODEC_PARSERS_VP8 gen_source_c += gstvp8parser.c gen_source_h += gstvp8parser.h gstvp8rangedecoder.h vp8utils.h +#gen_source_c += dboolhuff.c gstvp8rangedecoder.c vp8utils.c +#gen_source_h += dboolhuff.h +add_source_c += gstvaapilibvpx.c -gen_source_c += dboolhuff.c gstvp8rangedecoder.c vp8utils.c -gen_source_h += dboolhuff.h +libgstvaapi_codecparsers_cflags += \ + -I$(top_srcdir)/ext/libvpx \ + -I$(top_srcdir)/ext/libvpx/upstream \ + -I$(top_builddir)/ext/libvpx/upstream + +libgstvaapi_codecparsers_libs += \ + $(top_builddir)/ext/libvpx/libgstcodecparsers_vpx.la endif GENFILES = \ @@ -57,6 +67,7 @@ nodist_EXTRA_libgstvaapi_codecparsers_la_SOURCES = dummy.c nodist_libgstvaapi_codecparsers_la_SOURCES = \ $(gen_source_c) \ + $(add_source_c) \ $(NULL) libgstvaapi_codecparsers_la_CFLAGS = \ @@ -80,6 +91,12 @@ $(gen_source_c): %.c: $(local_codecparsers_srcdir)/%.c $(gen_source_h) $(LN_S) -f $< $@ $(gen_source_h): %.h: $(local_codecparsers_srcdir)/%.h $(LN_S) -f $< $@ +$(top_builddir)/ext/libvpx/libgstcodecparsers_vpx.la: + $(MAKE) -C $(top_builddir)/ext/libvpx + +EXTRA_DIST = \ + $(add_source_c) \ + $(NULL) DISTCLEANFILES = $(GENFILES) .timestamp.symlinks diff --git a/gst-libs/gst/codecparsers/gstvaapilibvpx.c b/gst-libs/gst/codecparsers/gstvaapilibvpx.c new file mode 100644 index 0000000..81baeb0 --- /dev/null +++ b/gst-libs/gst/codecparsers/gstvaapilibvpx.c @@ -0,0 +1,104 @@ +/* + * gstvaapilibvpx.c - libvpx wrapper for gstreamer-vaapi + * + * Copyright (C) 2014 Intel Corporation + * Author: Gwenole Beauchesne + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#include "gstvp8rangedecoder.h" +#include "vp8utils.h" +#include "gstlibvpx.h" + +#define BOOL_DECODER_CAST(rd) \ + ((vp8_bool_decoder *)(&(rd)->_gst_reserved[0])) + +#define BOOL_DECODER_STATE_CAST(s) \ + ((vp8_bool_decoder_state *)(s)) + +gboolean +gst_vp8_range_decoder_init (GstVp8RangeDecoder * rd, const guchar * buf, + guint buf_size) +{ + vp8_bool_decoder *const bd = BOOL_DECODER_CAST (rd); + + g_return_val_if_fail (sizeof (rd->_gst_reserved) >= sizeof (*bd), FALSE); + + rd->buf = buf; + rd->buf_size = buf_size; + return vp8_bool_decoder_init (bd, buf, buf_size); +} + +gint +gst_vp8_range_decoder_read (GstVp8RangeDecoder * rd, guint8 prob) +{ + return vp8_bool_decoder_read (BOOL_DECODER_CAST (rd), prob); +} + +gint +gst_vp8_range_decoder_read_literal (GstVp8RangeDecoder * rd, gint bits) +{ + return vp8_bool_decoder_read_literal (BOOL_DECODER_CAST (rd), bits); +} + +guint +gst_vp8_range_decoder_get_pos (GstVp8RangeDecoder * rd) +{ + return vp8_bool_decoder_get_pos (BOOL_DECODER_CAST (rd)); +} + +void +gst_vp8_range_decoder_get_state (GstVp8RangeDecoder * rd, + GstVp8RangeDecoderState * state) +{ + vp8_bool_decoder_get_state (BOOL_DECODER_CAST (rd), + BOOL_DECODER_STATE_CAST (state)); +} + +void +gst_vp8_token_update_probs_init (GstVp8TokenProbs * probs) +{ + vp8_init_token_update_probs (probs->prob); +} + +void +gst_vp8_token_probs_init_defaults (GstVp8TokenProbs * probs) +{ + vp8_init_default_token_probs (probs->prob); +} + +void +gst_vp8_mv_update_probs_init (GstVp8MvProbs * probs) +{ + vp8_init_mv_update_probs (probs->prob); +} + +void +gst_vp8_mv_probs_init_defaults (GstVp8MvProbs * probs) +{ + vp8_init_default_mv_probs (probs->prob); +} + +void +gst_vp8_mode_probs_init_defaults (GstVp8ModeProbs * probs, gboolean key_frame) +{ + if (key_frame) { + vp8_init_default_intra_mode_probs (probs->y_prob, probs->uv_prob); + } else { + vp8_init_default_inter_mode_probs (probs->y_prob, probs->uv_prob); + } +}