Commit Graph

107 Commits

Author SHA1 Message Date
James Zern
acb9460929 vp8: correct if/else '{' placement
swap '{' and c-style comments removing a few redundant ones along the
way; covers most leftovers from the clang-tidy run against an
x86_64-linux config.

Change-Id: I67a45596f80a12389faca49c5be440875092a7df
2017-10-27 12:27:10 -07:00
Peter Boström
d42e876164 Add atomics to vp8 synchronization primitives.
Fixes issue on iPad Pro 10.5 (and probably other places) where threads
are not properly synchronized. On x86 this data race was benign as load
and store instructions are atomic, they were being atomic in practice as
the program hasn't been observed to be miscompiled.

Such guarantees are not made outside x86, and real problems manifested
where libvpx reliably reproduced a broken bitstream for even just the
initial keyframe. This was detected in WebRTC where this device started
using multithreading (as its CPU count is higher than earlier devices,
where the problem did not manifest as single-threading was used in
practice).

This issue was not detected under thread-sanitizer bots as mutexes were
conditionally used under this platform to simulate the protected read
and write semantics that were in practice provided on x86 platforms.

This change also removes several mutexes, so encoder/decoder state is
lighter-weight after this change and we do not need to initialize so
many mutexes (this was done even on non-thread-sanitizer platforms where
they were unused).

Change-Id: If41fcb0d99944f7bbc8ec40877cdc34d672ae72a
2017-08-31 17:55:57 -07:00
James Zern
88a302e743 Merge changes from topic 'missing-proto'
* changes:
  onyxd_int.h: add missing prototypes
  onyxd.h: add vp8dx_references_buffer prototype
  vp[89],vpx_dsp: add missing includes
  vp8,encodeframe.h: correct prototypes
  vp8: add temporal_filter.h
  add picklpf.h
  add ethreading.h
  vp8,bitstream.h: add missing prototypes
  vp8: remove vp8_fast_quantize_b_mmx
  vp8,loopfilter_filters: make some functions static
  vp9_ratectrl: make adjust_gf_boost_lag_one_pass_vbr static
  vp9_encodeframe: make scale_part_thresh_sumdiff static
  vp9_alt_ref_aq: correct vp9_alt_ref_aq_create proto
  tiny_ssim: make some functions static
2017-06-23 05:44:24 +00:00
James Zern
7c0788b07f onyxd.h: add vp8dx_references_buffer prototype
quiets -Wmissing-prototypes

Change-Id: I6bee535f3fb67e54a390266d787a5a92127aeadc
2017-06-21 19:00:15 -07:00
James Zern
fbba31e241 vp8_dx_iface: clear -Wclobbered warnings
with gcc 6.x

Change-Id: Ib2070421603a6777892d4ea01f4b0921696f38b3
2017-06-21 15:09:58 -07:00
Johann
86fed469ec vp8_dx_iface: remove unused 'else' condition
Clears up static clang analysis warning regarding a dead store.

Change-Id: If4fe7a9a7f94c6e2001d46136944f90712e543b4
2017-02-15 00:05:41 +00:00
Peter Boström
297dfd8696 Add decoder getters for the last quantizer.
To be used for frame stats output of vpxdec.

Change-Id: I0739a01bd3635c4b3fedd58f3e27363ce8fb1b1e
2017-01-12 16:16:22 -05:00
James Zern
f38616e1a2 vp8,frame_buffers: remove unused use_frame_threads
this was never fully implemented

Change-Id: I4640cf84c40ea2cc9c6c12acf116d39df4b04578
2016-09-29 20:24:15 -07:00
Johann
1364cb58b4 Remove vp8_clear_system_state
Use vpx_clear_system_state instead.

Change-Id: Ia3e9122f69a2c690ddd7c7bc54f92ccb9ec18b3e
2016-09-29 13:22:49 -07:00
James Zern
3f72509587 vp8: remove VP8_SET_DBG* control support
the --enable-postproc-visualizer configure option remains as a no-op as
do the control names and values for compatibility
+ remove the corresponding debug flags from vpxdec: --pp-*

Change-Id: I4a001cd9962b59560d7d6bda6272d4ff32b8d37c
2016-09-20 20:19:36 -07:00
James Zern
13338a481f vp8_create_decoder_instances: add missing setjmp
vp8_decoder_create_threads() has allocations that expect one is set.

Change-Id: I423f2153a2969c88d48ba45cc9ead4a01443ce65
2016-08-23 18:29:42 -07:00
James Zern
0f42d1fa85 vp8: fix decoder crash with invalid leading keyframes
decoding the same invalid keyframe twice would result in a crash as the
second time through the decoder would be assumed to have been
initialized as there was no resolution change. in this case the
resolution was itself invalid (0x6), but vp8_peek_si() was only failing
in the case of 0x0.
invalid-vp80-00-comprehensive-018.ivf.2kf_0x6.ivf tests this case by
duplicating the first keyframe and additionally adds a valid one to
ensure decoding can resume without error.

BUG=b/30593765

Change-Id: If0859035908b7870d67a7f3f646b5a080252eb6d
2016-08-23 16:27:52 -07:00
James Zern
b5164f55a0 vp8: simplify a few #if's
bitstream.c: asserts are disabled when CONFIG_DEBUG is unset
vp8_dx_iface.c: split |s into 2 statements across #if bounds

Change-Id: I307d1e969134db5c9c0edd7690589b6b29116cbd
2016-07-19 20:45:28 -07:00
clang-tidy
7f3e07f1c8 vp8: apply clang-tidy google-readability-braces-around-statements
applied against an x86_64 configure

clang-tidy-3.7.1 \
  -checks='-*,google-readability-braces-around-statements' \
  -header-filter='.*' -fix
+ clang-format afterward

Change-Id: I6694edeaee89b58b8b3082187e6756561136b459
2016-07-19 12:38:03 -07:00
Jim Bankoski
3e04114f3d prepend ++ instead of post in for loops.
Applied the following regex  :
search for: (for.*\(.*;.*;) ([a-zA-Z_]*)\+\+\)
replace with: \1 ++\2)

This misses some for loops:
ie : for (mb_col = 0; mb_col < oci->mb_cols; mb_col++, mi++)

Change-Id: Icf5f6fb93cced0992e0bb71d2241780f7fb1f0a8
2016-07-18 06:54:50 -07:00
clang-format
81a6739533 vp8: apply clang-format
Change-Id: I7605b6678014a5426ceb45c27b54885e0c4e06ed
2016-07-15 19:28:44 -07:00
Johann
6f9982e3c2 vp8_[cd]x_iface.c: Initialize structures to 0
Use vp8_zero() or specify every element.

Cleans warning in Android build:
missing field 'deblocking_level' initializer
vp8_ppflags_t flags = {0};
                        ^
missing field 'sz' initializer
{0},                /* rc_twopass_stats_in */
  ^
missing field 'sz' initializer
{0},                /* rc_firstpass_mb_stats_in */
  ^
missing field 'layer_target_bitrate' initializer
}},
^
missing field 'deblocking_level' initializer
vp8_ppflags_t flags = {0};
                        ^
missing field 'mr_get_mem_loc' initializer
}
^

Change-Id: Iaedde9a77faac7a40316aee67d60d02ba7313500
2016-06-16 22:07:17 +00:00
James Zern
1bf7a0fb29 vp8_peek_si_internal: quiet static analysis warning
the vpx_decoder layer guarantees that when called directly this won't
receive NULL data and the reuse via decode() is protected by a NULL data
check and 0 size check (NULL data and non-zero data size is protected by
the vpx_decoder layer).

Change-Id: I7437fb5ca4e4aa431963d55b909d4d920f339be3
2016-03-25 10:00:30 -07:00
James Zern
02fe3ae907 vp8_dx_iface: add missing alloc checks
Change-Id: Id9f4022b0cb4b5d0b3dd8759fd491da4e2ba5cb1
2016-02-17 18:04:23 -08:00
Ronald S. Bultje
812945a8f1 vp9/10: improve support for render_width/height.
In the decoder, map this to the output variable vpx_image_t.r_w/h.
This is intended as an improved version of VP9D_GET_DISPLAY_SIZE,
which doesn't work with parallel frame decoding. In the encoder,
map this to a codec control func (VP9E_SET_RENDER_SIZE) that takes
a w/h pair argument in a int[2] (identical to VP9D_GET_DISPLAY_SIZE).

Also add render_size to the encoder_param_get_to_decoder unit test.

See issue 1030.

Change-Id: I12124c13602d832bf4c44090db08c1009c94c7e8
2015-09-25 22:18:22 -04:00
Johann
c5f11912ae Include vpx_dsp_common.h when using VPXMIN/MAX
Change-Id: I2e387a06484a06301f3cd6600c4ba2f4335b61ee
2015-08-31 14:36:35 -07:00
James Zern
820302a394 vp8: use VPX(MIN|MAX) from vpx_dsp_common.h
remove MIN/MAX defines in vp8/common/common.h

Change-Id: I41520f34af175e05b263ebd12198f4de29a967db
2015-08-27 15:31:24 -07:00
Johann
51b654e8f0 Remove vp8_priv_sz
This is a leftover of the XMA code which was removed a long time ago.

Found while looking for unused functions.

Change-Id: I07a3d542ae55440af59380dcdcf9a6c11cdfcb75
2015-08-26 17:10:41 +00:00
Johann
d5d9289800 Move shared SAD code to vpx_dsp
Create a new component, vpx_dsp, for code that can be shared
between codecs. Move the SAD code into the component.

This reduces the size of vpxenc/dec by 36k on x86_64 builds.

Change-Id: I73f837ddaecac6b350bf757af0cfe19c4ab9327a
2015-05-06 16:58:20 -07:00
James Zern
f58011ada5 vpx_mem: remove vpx_memset
vestigial. replace instances with memset() which they already were being
defined to.

Change-Id: Ie030cfaaa3e890dd92cf1a995fcb1927ba175201
2015-04-28 20:00:59 -07:00
Johann
14ef4aeafb Reorganize *_rtcd() calling conventions
Change-Id: Ib1e17d8aae9b713b87f560ab5e49952ee2bfdcc2
2015-04-15 11:12:05 -04:00
Yaowu Xu
4fcf726a0e Return error on wrong sync code
Not initialize codec stream info

This fixes vp8 fuzzing issue reported at build #56

Change-Id: I307ac839b4f4bda3a02a551019c0d688dba19c86
2015-01-05 17:19:32 -08:00
Johann
80b344dec5 Silence -Werror=unused-parameter
Cast away remaining issues so that new ones don't get lost in the noise.

Change-Id: Iacd6999b0686ce80f9835730d68db6382690fa92
2014-12-16 12:47:08 -08:00
hkuang
9353607ac8 Fix a bug that break the vp8 fragment decoder.
(issue #882).

Change-Id: I2ca7f96d390c4eaec0473c50cb01b903d0bd3ee6
2014-12-12 16:44:14 -08:00
Deb Mukherjee
a349ee3bf5 Resolves some lint errors
And also fixes some style consistency issues.

Change-Id: I3dc6d44e17d2d6075dc9b02c4255a7395046c5e0
2014-10-13 16:05:44 -07:00
Dmitry Kovalev
91998e638e Removing sz member from vpx_codec_priv.
Change-Id: I811526a9ee9f237604f72abe7fc677e39e0f457f
2014-09-04 14:47:42 -07:00
Dmitry Kovalev
b08fab8808 Consistent allocation of vpx_codec_alg_priv_t.
Change-Id: I5a03496de035fbcf31e4527cd25fcae4627a57a0
2014-09-03 11:01:21 -07:00
Dmitry Kovalev
73edeb03ea Removing alg_priv from vpx_codec_priv struct.
In order to understand memory layout consider the declaration of the
following structs. The first one is a part of our API:

struct vpx_codec_ctx {
  // ...
  struct vpx_codec_priv *priv;
};

The second one is defined in vpx_codec_internal.h:

struct vpx_codec_priv {
  // ...
};

The following struct is defined 4 times for encoder/decoder VP8/VP9:

struct vpx_codec_alg_priv {
  struct vpx_codec_priv base;
  // ... 
};

Private data allocation for the given ctx:

struct vpx_codec_ctx *ctx = <get>
struct vpx_codec_alg_priv *alg_priv = <allocate>
ctx->priv = (struct vpx_codec_priv *)alg_priv;

The cast works because vpx_codec_alg_priv has a
vpx_codec_priv instance as a first member 'base'.

Change-Id: I10d1afc8c9a7dfda50baade8c7b0296678bdb0d0
2014-08-28 13:51:37 -07:00
Dmitry Kovalev
eafa7126a0 Merge "Replacing NOT_IMPLMENTED with NULL." 2014-08-21 11:10:00 -07:00
Dmitry Kovalev
cd6d9846b0 Replacing NOT_IMPLMENTED with NULL.
We don’t need to introduce new macro for the null value.

Change-Id: I59dbae25feeebb4e8359095801aecc8bb17d7764
2014-08-20 17:16:28 -07:00
Dmitry Kovalev
f2e652396f Removing iface pointer from vpx_codec_priv.
The iface pointer is already in vpx_codec_ctx struct.

Change-Id: I9fffe27c613a7c94476f185a1e5a53ff6d99f1c6
2014-08-20 12:31:19 -07:00
Johann
69dc876b4e Set uv_crop_height/width in all the places
When configuring the buffer make sure to set all the (now) required
fields. Use the canonical variables and match the style from vpx_scale.

https://code.google.com/p/webm/issues/detail?id=841

Change-Id: I71b43d4a03756b8b2d6d60fdf8d7bf41b8041787
2014-08-15 14:55:21 -07:00
James Zern
7d9da93a97 VP8D_GET_FRAME_CORRUPTED: check frame pointer
if the decode of the first frame fails, frame_to_show may not be set.
fixes a crash in vpxdec with corrupt data.

Change-Id: I5ab9476d005778a13fd42a39d05876bb6c90a93c
2014-08-12 17:41:47 -07:00
Dmitry Kovalev
9a4cd41793 Merge "Removing legacy XMA features from libvpx." 2014-08-08 14:58:23 -07:00
Hangyu Kuang
7050074756 Make the api behavior conform to api spec.
When no more data is available, vpx_codec_decode should
be called with NULL as data and 0 as data_sz.

vpx_codec_get_frame iterates over a list of the frames
available for display. The iterator storage should be initialized
to NULL to start the iteration. Iteration is complete when this
function returns NULL.

Also change the unit test to conform to the api spec.

Change-Id: I4b258b309f5df3d37d10c82f01492c0394181c2a
2014-08-06 11:16:14 -07:00
Dmitry Kovalev
a42b5c2ffc Removing legacy XMA features from libvpx.
Change-Id: I60ffee7cf78e748792fa6d109322ec32f92e40a9
2014-08-05 16:34:09 -07:00
Jim Bankoski
8a774e14ff Changes interface to avoid uninitialized warnings in vp9_cx_iface.c.
Change-Id: I1092239e21c1cde188ee2dcb765f4c6fc8c5cdec
2014-07-31 06:27:57 -07:00
Deb Mukherjee
449e5f2aba Misc. bit-depth related changes
Sets the bit-depth field as default 8 in the image structure in vp8.
Generalizes yuv read in preparation for support for reading 422/444
for 8-bit and 10/12-bit.

Change-Id: I560c13c348b122fd028e408431156376b895058c
2014-07-14 11:48:04 -07:00
James Zern
61c3338516 call vp[89]_clear_system_state after longjmp
restore the environment post encode/decode failure

Change-Id: I3c72e2260a616432eaf1f9545d4fb4d8e45cc7b0
2014-07-10 12:36:28 -07:00
Dmitry Kovalev
8a8b662eaa Removing ctrl_id parameter from vpx_codec_control_fn_t.
Change-Id: I2b61c8c17ded1074dea92b4f6ad9be84d128b52a
2014-05-27 16:45:58 -07:00
Deb Mukherjee
caba78ef49 Fixes a bug for uninitialized frame buffers
Fixes a bug introduced in
https://gerrit.chromium.org/gerrit/#/c/69779/13, where
uninitialized frame buffers due to corrupt and short
buffer sizes, may cause a crash.

This patch fixes the currently failing
video/processing/static_image/vp8_convert_test

Change-Id: I1b09e21482f292c11a2bfb4e570aef1d643410a7
2014-05-23 01:26:01 -07:00
Joey Parrish
18c08607e0 Add VPXD_SET_DECRYPTOR support to the VP9 decoder.
Change-Id: I88f86c8ff9af34e0b6531028b691921b54c2fc48
2014-04-23 16:11:54 -07:00
Dmitry Kovalev
8503d72e6a Removing legacy XMA code from vp8.
Change-Id: Ib9f7fd3fd56e304e5f587f790c97ac34a3077265
2014-04-10 23:30:17 -07:00
Frank Galligan
a4f30a5023 Add VP9 decoder support for external frame buffers
Added support for external frame buffers to libvpx's VP9 decoder.
If the external frame buffer functions are set then libvpx will
call the get function whenever it needs a new frame buffer to
decode a frame into. And it will call the release function
whenever there are no more references to that buffer.

Change-Id: Id2934d005f606af6e052fb6db0d5b7c02f567522
2014-02-13 13:14:19 -08:00
Frank Galligan
b1c72b633e Revert external frame buffer code.
A future CL will add external frame buffers
differently.

Squash commit of four revert commits:
Revert "Increase required number of external frame buffers"

This reverts commit 9e41d569d7.

Revert "Add external constants."

This reverts commit bbf53047b0.

Revert "Add frame buffer lru cache."

This reverts commit fbada948fa.

Conflicts:
	vpxdec.c

Change-Id: I76fe42419923a6ea6c75d9997cbbf941d73d3005

Revert "Add support to pass in external frame buffers."

This reverts commit 10f891696b.

Conflicts:
	test/external_frame_buffer_test.cc
	vp9/common/vp9_alloccommon.c
	vp9/common/vp9_reconinter.c
	vp9/decoder/vp9_decodeframe.c
	vp9/encoder/vp9_onyx_if.c
	vp9/vp9_dx_iface.c
	vpx/vpx_decoder.h
	vpx/vpx_external_frame_buffer.h
	vpx_scale/generic/yv12config.c
	vpxdec.c

Change-Id: I7434cf590f1c852b38569980e4247fad0d939c2e
2014-01-24 10:10:20 -08:00