diff options
author | John Koleszar <jkoleszar@google.com> | 2011-02-19 00:05:10 -0500 |
---|---|---|
committer | John Koleszar <jkoleszar@google.com> | 2011-02-19 00:05:11 -0500 |
commit | bbfca323fbc7b4ee5c94fc911af9527c31d194f5 (patch) | |
tree | fa14fb5e3aa66942ab884daae8ab3887f09e7ca7 /vp8 | |
parent | 4fafc4d985debd3e9ec41b1c0ab447e32d2a9db9 (diff) | |
parent | 945dad277d3c09708956d60bf7844d47e0eeed1f (diff) | |
download | libvpx-bbfca323fbc7b4ee5c94fc911af9527c31d194f5.tar libvpx-bbfca323fbc7b4ee5c94fc911af9527c31d194f5.tar.gz libvpx-bbfca323fbc7b4ee5c94fc911af9527c31d194f5.tar.bz2 libvpx-bbfca323fbc7b4ee5c94fc911af9527c31d194f5.zip |
Merge remote branch 'origin/master' into experimental
Change-Id: Ia3197f432b424213a34b20071e5171a413ba1aaf
Diffstat (limited to 'vp8')
-rw-r--r-- | vp8/common/alloccommon.c | 11 | ||||
-rw-r--r-- | vp8/common/boolcoder.h | 570 | ||||
-rw-r--r-- | vp8/common/codec_common_interface.h | 93 | ||||
-rw-r--r-- | vp8/common/fourcc.hpp | 121 | ||||
-rw-r--r-- | vp8/common/mac_specs.h | 31 | ||||
-rw-r--r-- | vp8/common/partialgfupdate.h | 19 | ||||
-rw-r--r-- | vp8/common/predictdc.c | 44 | ||||
-rw-r--r-- | vp8/common/predictdc.h | 18 | ||||
-rw-r--r-- | vp8/common/proposed.h | 71 | ||||
-rw-r--r-- | vp8/common/vfwsetting.hpp | 76 | ||||
-rw-r--r-- | vp8/common/vpx_ref_build_prefix.h | 24 | ||||
-rw-r--r-- | vp8/common/vpxblit.h | 112 | ||||
-rw-r--r-- | vp8/common/vpxblit_c64.h | 48 | ||||
-rw-r--r-- | vp8/common/vpxerrors.h | 13 | ||||
-rw-r--r-- | vp8/decoder/arm/dequantize_arm.c | 1 | ||||
-rw-r--r-- | vp8/decoder/decodframe.c | 1 | ||||
-rw-r--r-- | vp8/decoder/dequantize.c | 1 | ||||
-rw-r--r-- | vp8/decoder/x86/onyxdxv.c | 1080 | ||||
-rw-r--r-- | vp8/encoder/arm/quantize_arm.c | 1 | ||||
-rw-r--r-- | vp8/encoder/onyx_if.c | 89 | ||||
-rw-r--r-- | vp8/encoder/quantize.c | 1 | ||||
-rw-r--r-- | vp8/encoder/temporal_filter.c | 1 | ||||
-rw-r--r-- | vp8/encoder/x86/temporal_filter_apply_sse2.asm | 2 | ||||
-rw-r--r-- | vp8/vp8_common.mk | 3 |
24 files changed, 51 insertions, 2380 deletions
diff --git a/vp8/common/alloccommon.c b/vp8/common/alloccommon.c index 5ab8e29ab..3d2f753d9 100644 --- a/vp8/common/alloccommon.c +++ b/vp8/common/alloccommon.c @@ -16,7 +16,6 @@ #include "findnearmv.h" #include "entropymode.h" #include "systemdependent.h" -#include "vpxerrors.h" extern void vp8_init_scan_order_mask(); @@ -71,7 +70,7 @@ int vp8_alloc_frame_buffers(VP8_COMMON *oci, int width, int height) if (vp8_yv12_alloc_frame_buffer(&oci->yv12_fb[i], width, height, VP8BORDERINPIXELS) < 0) { vp8_de_alloc_frame_buffers(oci); - return ALLOC_FAILURE; + return 1; } } @@ -88,13 +87,13 @@ int vp8_alloc_frame_buffers(VP8_COMMON *oci, int width, int height) if (vp8_yv12_alloc_frame_buffer(&oci->temp_scale_frame, width, 16, VP8BORDERINPIXELS) < 0) { vp8_de_alloc_frame_buffers(oci); - return ALLOC_FAILURE; + return 1; } if (vp8_yv12_alloc_frame_buffer(&oci->post_proc_buffer, width, height, VP8BORDERINPIXELS) < 0) { vp8_de_alloc_frame_buffers(oci); - return ALLOC_FAILURE; + return 1; } oci->mb_rows = height >> 4; @@ -106,7 +105,7 @@ int vp8_alloc_frame_buffers(VP8_COMMON *oci, int width, int height) if (!oci->mip) { vp8_de_alloc_frame_buffers(oci); - return ALLOC_FAILURE; + return 1; } oci->mi = oci->mip + oci->mode_info_stride + 1; @@ -117,7 +116,7 @@ int vp8_alloc_frame_buffers(VP8_COMMON *oci, int width, int height) if (!oci->above_context) { vp8_de_alloc_frame_buffers(oci); - return ALLOC_FAILURE; + return 1; } vp8_update_mode_info_border(oci->mi, oci->mb_rows, oci->mb_cols); diff --git a/vp8/common/boolcoder.h b/vp8/common/boolcoder.h deleted file mode 100644 index 5658868a6..000000000 --- a/vp8/common/boolcoder.h +++ /dev/null @@ -1,570 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * 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 bool_coder_h -#define bool_coder_h 1 - -/* Arithmetic bool coder with largish probability range. - Timothy S Murphy 6 August 2004 */ - -/* So as not to force users to drag in too much of my idiosyncratic C++ world, - I avoid fancy storage management. */ - -#include <assert.h> - -#include <stddef.h> -#include <stdio.h> - -typedef unsigned char vp8bc_index_t; // probability index - -/* There are a couple of slight variants in the details of finite-precision - arithmetic coding. May be safely ignored by most users. */ - -enum vp8bc_rounding -{ - vp8bc_down = 0, // just like VP8 - vp8bc_down_full = 1, // handles minimum probability correctly - vp8bc_up = 2 -}; - -#if _MSC_VER - -/* Note that msvc by default does not inline _anything_ (regardless of the - setting of inline_depth) and that a command-line option (-Ob1 or -Ob2) - is required to inline even the smallest functions. */ - -# pragma inline_depth( 255) // I mean it when I inline something -# pragma warning( disable : 4099) // No class vs. struct harassment -# pragma warning( disable : 4250) // dominance complaints -# pragma warning( disable : 4284) // operator-> in templates -# pragma warning( disable : 4800) // bool conversion - -// don't let prefix ++,-- stand in for postfix, disaster would ensue - -# pragma warning( error : 4620 4621) - -#endif // _MSC_VER - - -#if __cplusplus - -// Sometimes one wishes to be definite about integer lengths. - -struct int_types -{ - typedef const bool cbool; - typedef const signed char cchar; - typedef const short cshort; - typedef const int cint; - typedef const int clong; - - typedef const double cdouble; - typedef const size_t csize_t; - - typedef unsigned char uchar; // 8 bits - typedef const uchar cuchar; - - typedef short int16; - typedef unsigned short uint16; - typedef const int16 cint16; - typedef const uint16 cuint16; - - typedef int int32; - typedef unsigned int uint32; - typedef const int32 cint32; - typedef const uint32 cuint32; - - typedef unsigned int uint; - typedef unsigned int ulong; - typedef const uint cuint; - typedef const ulong culong; - - - // All structs consume space, may as well have a vptr. - - virtual ~int_types(); -}; - - -struct bool_coder_spec; -struct bool_coder; -struct bool_writer; -struct bool_reader; - - -struct bool_coder_namespace : int_types -{ - typedef vp8bc_index_t Index; - typedef bool_coder_spec Spec; - typedef const Spec c_spec; - - enum Rounding - { - Down = vp8bc_down, - down_full = vp8bc_down_full, - Up = vp8bc_up - }; -}; - - -// Archivable specification of a bool coder includes rounding spec -// and probability mapping table. The latter replaces a uchar j -// (0 <= j < 256) with an arbitrary uint16 tbl[j] = p. -// p/65536 is then the probability of a zero. - -struct bool_coder_spec : bool_coder_namespace -{ - friend struct bool_coder; - friend struct bool_writer; - friend struct bool_reader; - friend struct bool_coder_spec_float; - friend struct bool_coder_spec_explicit_table; - friend struct bool_coder_spec_exponential_table; - friend struct BPsrc; -private: - uint w; // precision - Rounding r; - - uint ebits, mbits, ebias; - uint32 mmask; - - Index max_index, half_index; - - uint32 mantissa(Index i) const - { - assert(i < half_index); - return (1 << mbits) + (i & mmask); - } - uint exponent(Index i) const - { - assert(i < half_index); - return ebias - (i >> mbits); - } - - uint16 Ptbl[256]; // kinda clunky, but so is storage management. - - /* Cost in bits of encoding a zero at every probability, scaled by 2^20. - Assumes that index is at most 8 bits wide. */ - - uint32 Ctbl[256]; - - uint32 split(Index i, uint32 R) const // 1 <= split <= max( 1, R-1) - { - if (!ebias) - return 1 + (((R - 1) * Ptbl[i]) >> 16); - - if (i >= half_index) - return R - split(max_index - i, R); - - return 1 + (((R - 1) * mantissa(i)) >> exponent(i)); - } - - uint32 max_range() const - { - return (1 << w) - (r == down_full ? 0 : 1); - } - uint32 min_range() const - { - return (1 << (w - 1)) + (r == down_full ? 1 : 0); - } - uint32 Rinc() const - { - return r == Up ? 1 : 0; - } - - void check_prec() const; - - bool float_init(uint Ebits, uint Mbits); - - void cost_init(); - - bool_coder_spec( - uint prec, Rounding rr, uint Ebits = 0, uint Mbits = 0 - ) - : w(prec), r(rr) - { - float_init(Ebits, Mbits); - } -public: - // Read complete spec from file. - bool_coder_spec(FILE *); - - // Write spec to file. - void dump(FILE *) const; - - // return probability index best approximating prob. - Index operator()(double prob) const; - - // probability corresponding to index - double operator()(Index i) const; - - Index complement(Index i) const - { - return max_index - i; - } - - Index max_index() const - { - return max_index; - } - Index half_index() const - { - return half_index; - } - - uint32 cost_zero(Index i) const - { - return Ctbl[i]; - } - uint32 cost_one(Index i) const - { - return Ctbl[ max_index - i]; - } - uint32 cost_bit(Index i, bool b) const - { - return Ctbl[b? max_index-i:i]; - } -}; - - -/* Pseudo floating-point probability specification. - - At least one of Ebits and Mbits must be nonzero. - - Since all arithmetic is done at 32 bits, Ebits is at most 5. - - Total significant bits in index is Ebits + Mbits + 1. - - Below the halfway point (i.e. when the top significant bit is 0), - the index is (e << Mbits) + m. - - The exponent e is between 0 and (2**Ebits) - 1, - the mantissa m is between 0 and (2**Mbits) - 1. - - Prepending an implicit 1 to the mantissa, the probability is then - - (2**Mbits + m) >> (e - 2**Ebits - 1 - Mbits), - - which has (1/2)**(2**Ebits + 1) as a minimum - and (1/2) * [1 - 2**(Mbits + 1)] as a maximum. - - When the index is above the halfway point, the probability is the - complement of the probability associated to the complement of the index. - - Note that the probability increases with the index and that, because of - the symmetry, we cannot encode probability exactly 1/2; though we - can get as close to 1/2 as we like, provided we have enough Mbits. - - The latter is of course not a problem in practice, one never has - exact probabilities and entropy errors are second order, that is, the - "overcoding" of a zero will be largely compensated for by the - "undercoding" of a one (or vice-versa). - - Compared to arithmetic probability specs (a la VP8), this will do better - at very high and low probabilities and worse at probabilities near 1/2, - as well as facilitating the usage of wider or narrower probability indices. -*/ - -struct bool_coder_spec_float : bool_coder_spec -{ - bool_coder_spec_float( - uint Ebits = 3, uint Mbits = 4, Rounding rr = down_full, uint prec = 12 - ) - : bool_coder_spec(prec, rr, Ebits, Mbits) - { - cost_init(); - } -}; - - -struct bool_coder_spec_explicit_table : bool_coder_spec -{ - bool_coder_spec_explicit_table( - cuint16 probability_table[256] = 0, // default is tbl[i] = i << 8. - Rounding = down_full, - uint precision = 16 - ); -}; - -// Contruct table via multiplicative interpolation between -// p[128] = 1/2 and p[0] = (1/2)^x. -// Since we are working with 16-bit precision, x is at most 16. -// For probabilities to increase with i, we must have x > 1. -// For 0 <= i <= 128, p[i] = (1/2)^{ 1 + [1 - (i/128)]*[x-1] }. -// Finally, p[128+i] = 1 - p[128 - i]. - -struct bool_coder_spec_exponential_table : bool_coder_spec -{ - bool_coder_spec_exponential_table(uint x, Rounding = down_full, uint prec = 16); -}; - - -// Commonalities between writer and reader. - -struct bool_coder : bool_coder_namespace -{ - friend struct bool_writer; - friend struct bool_reader; - friend struct BPsrc; -private: - uint32 Low, Range; - cuint32 min_range; - cuint32 rinc; - c_spec spec; - - void _reset() - { - Low = 0; - Range = spec.max_range(); - } - - bool_coder(c_spec &s) - : min_range(s.min_range()), - rinc(s.Rinc()), - spec(s) - { - _reset(); - } - - uint32 half() const - { - return 1 + ((Range - 1) >> 1); - } -public: - c_spec &Spec() const - { - return spec; - } -}; - - -struct bool_writer : bool_coder -{ - friend struct BPsrc; -private: - uchar *Bstart, *Bend, *B; - int bit_lag; - bool is_toast; - void carry(); - void reset() - { - _reset(); - bit_lag = 32 - spec.w; - is_toast = 0; - } - void raw(bool value, uint32 split); -public: - bool_writer(c_spec &, uchar *Dest, size_t Len); - virtual ~bool_writer(); - - void operator()(Index p, bool v) - { - raw(v, spec.split(p, Range)); - } - - uchar *buf() const - { - return Bstart; - } - size_t bytes_written() const - { - return B - Bstart; - } - - // Call when done with input, flushes internal state. - // DO NOT write any more data after calling this. - - bool_writer &flush(); - - void write_bits(int n, uint val) - { - if (n) - { - uint m = 1 << (n - 1); - - do - { - raw((bool)(val & m), half()); - } - while (m >>= 1); - } - } - -# if 0 - // We are agnostic about storage management. - // By default, overflows throw an assert but user can - // override to provide an expanding buffer using ... - - virtual void overflow(uint Len) const; - - // ... this function copies already-written data into new buffer - // and retains new buffer location. - - void new_buffer(uchar *dest, uint Len); - - // Note that storage management is the user's responsibility. -# endif -}; - - -// This could be adjusted to use a little less lookahead. - -struct bool_reader : bool_coder -{ - friend struct BPsrc; -private: - cuchar *const Bstart; // for debugging - cuchar *B; - cuchar *const Bend; - cuint shf; - uint bct; - bool raw(uint32 split); -public: - bool_reader(c_spec &s, cuchar *src, size_t Len); - - bool operator()(Index p) - { - return raw(spec.split(p, Range)); - } - - uint read_bits(int num_bits) - { - uint v = 0; - - while (--num_bits >= 0) - v += v + (raw(half()) ? 1 : 0); - - return v; - } -}; - -extern "C" { - -#endif /* __cplusplus */ - - - /* C interface */ - - typedef struct bool_coder_spec bool_coder_spec; - typedef struct bool_writer bool_writer; - typedef struct bool_reader bool_reader; - - typedef const bool_coder_spec c_bool_coder_spec; - typedef const bool_writer c_bool_writer; - typedef const bool_reader c_bool_reader; - - - /* Optionally override default precision when constructing coder_specs. - Just pass a zero pointer if you don't care. - Precision is at most 16 bits for table specs, at most 23 otherwise. */ - - struct vp8bc_prec - { - enum vp8bc_rounding r; /* see top header file for def */ - unsigned int prec; /* range precision in bits */ - }; - - typedef const struct vp8bc_prec vp8bc_c_prec; - - /* bool_coder_spec contains mapping of uchars to actual probabilities - (16 bit uints) as well as (usually immaterial) selection of - exact finite-precision algorithm used (for now, the latter can only - be overridden using the C++ interface). - See comments above the corresponding C++ constructors for discussion, - especially of exponential probability table generation. */ - - bool_coder_spec *vp8bc_vp8spec(); // just like vp8 - - bool_coder_spec *vp8bc_literal_spec( - const unsigned short prob_map[256], // 0 is like vp8 w/more precision - vp8bc_c_prec* - ); - - bool_coder_spec *vp8bc_float_spec( - unsigned int exponent_bits, unsigned int mantissa_bits, vp8bc_c_prec* - ); - - bool_coder_spec *vp8bc_exponential_spec(unsigned int min_exp, vp8bc_c_prec *); - - bool_coder_spec *vp8bc_spec_from_file(FILE *); - - - void vp8bc_destroy_spec(c_bool_coder_spec *); - - void vp8bc_spec_to_file(c_bool_coder_spec *, FILE *); - - - /* Nearest index to supplied probability of zero, 0 <= prob <= 1. */ - - vp8bc_index_t vp8bc_index(c_bool_coder_spec *, double prob); - - vp8bc_index_t vp8bc_index_from_counts( - c_bool_coder_spec *p, unsigned int zero_ct, unsigned int one_ct - ); - - /* In case you want to look */ - - double vp8bc_probability(c_bool_coder_spec *, vp8bc_index_t); - - /* Opposite index */ - - vp8bc_index_t vp8bc_complement(c_bool_coder_spec *, vp8bc_index_t); - - /* Cost in bits of encoding a zero at given probability, scaled by 2^20. - (assumes that an int holds at least 32 bits). */ - - unsigned int vp8bc_cost_zero(c_bool_coder_spec *, vp8bc_index_t); - - unsigned int vp8bc_cost_one(c_bool_coder_spec *, vp8bc_index_t); - unsigned int vp8bc_cost_bit(c_bool_coder_spec *, vp8bc_index_t, int); - - - /* bool_writer interface */ - - /* Length = 0 disables checking for writes beyond buffer end. */ - - bool_writer *vp8bc_create_writer( - c_bool_coder_spec *, unsigned char *Destination, size_t Length - ); - - /* Flushes out any buffered data and returns total # of bytes written. */ - - size_t vp8bc_destroy_writer(bool_writer *); - - void vp8bc_write_bool(bool_writer *, int boolean_val, vp8bc_index_t false_prob); - - void vp8bc_write_bits( - bool_writer *, unsigned int integer_value, int number_of_bits - ); - - c_bool_coder_spec *vp8bc_writer_spec(c_bool_writer *); - - - /* bool_reader interface */ - - /* Length = 0 disables checking for reads beyond buffer end. */ - - bool_reader *vp8bc_create_reader( - c_bool_coder_spec *, const unsigned char *Source, size_t Length - ); - void vp8bc_destroy_reader(bool_reader *); - - int vp8bc_read_bool(bool_reader *, vp8bc_index_t false_prob); - - unsigned int vp8bc_read_bits(bool_reader *, int number_of_bits); - - c_bool_coder_spec *vp8bc_reader_spec(c_bool_reader *); - -#if __cplusplus -} -#endif - -#endif /* bool_coder_h */ diff --git a/vp8/common/codec_common_interface.h b/vp8/common/codec_common_interface.h deleted file mode 100644 index 7a7db3847..000000000 --- a/vp8/common/codec_common_interface.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * 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 CODEC_COMMON_INTERFACE_H -#define CODEC_COMMON_INTERFACE_H - -#define __export -#define _export -#define dll_export __declspec( dllexport ) -#define dll_import __declspec( dllimport ) - -// Playback ERROR Codes. -#define NO_DECODER_ERROR 0 -#define REMOTE_DECODER_ERROR -1 - -#define DFR_BAD_DCT_COEFF -100 -#define DFR_ZERO_LENGTH_FRAME -101 -#define DFR_FRAME_SIZE_INVALID -102 -#define DFR_OUTPUT_BUFFER_OVERFLOW -103 -#define DFR_INVALID_FRAME_HEADER -104 -#define FR_INVALID_MODE_TOKEN -110 -#define ETR_ALLOCATION_ERROR -200 -#define ETR_INVALID_ROOT_PTR -201 -#define SYNCH_ERROR -400 -#define BUFFER_UNDERFLOW_ERROR -500 -#define PB_IB_OVERFLOW_ERROR -501 - -// External error triggers -#define PB_HEADER_CHECKSUM_ERROR -601 -#define PB_DATA_CHECKSUM_ERROR -602 - -// DCT Error Codes -#define DDCT_EXPANSION_ERROR -700 -#define DDCT_INVALID_TOKEN_ERROR -701 - -// exception_errors -#define GEN_EXCEPTIONS -800 -#define EX_UNQUAL_ERROR -801 - -// Unrecoverable error codes -#define FATAL_PLAYBACK_ERROR -1000 -#define GEN_ERROR_CREATING_CDC -1001 -#define GEN_THREAD_CREATION_ERROR -1002 -#define DFR_CREATE_BMP_FAILED -1003 - -// YUV buffer configuration structure -typedef struct -{ - int y_width; - int y_height; - int y_stride; - - int uv_width; - int uv_height; - int uv_stride; - - unsigned char *y_buffer; - unsigned char *u_buffer; - unsigned char *v_buffer; - -} YUV_BUFFER_CONFIG; -typedef enum -{ - C_SET_KEY_FRAME, - C_SET_FIXED_Q, - C_SET_FIRSTPASS_FILE, - C_SET_EXPERIMENTAL_MIN, - C_SET_EXPERIMENTAL_MAX = C_SET_EXPERIMENTAL_MIN + 255, - C_SET_CHECKPROTECT, - C_SET_TESTMODE, - C_SET_INTERNAL_SIZE, - C_SET_RECOVERY_FRAME, - C_SET_REFERENCEFRAME, - C_SET_GOLDENFRAME - -#ifndef VP50_COMP_INTERFACE - // Specialist test facilities. -// C_VCAP_PARAMS, // DO NOT USE FOR NOW WITH VFW CODEC -#endif - -} C_SETTING; - -typedef unsigned long C_SET_VALUE; - - -#endif diff --git a/vp8/common/fourcc.hpp b/vp8/common/fourcc.hpp deleted file mode 100644 index c5826285e..000000000 --- a/vp8/common/fourcc.hpp +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * 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 FOURCC_HPP -#define FOURCC_HPP - -#include <iosfwd> -#include <cstring> - - -#if defined(__POWERPC__) || defined(__APPLE__) || defined(__MERKS__) -using namespace std; -#endif - -class four_cc -{ -public: - - four_cc(); - four_cc(const char*); - explicit four_cc(unsigned long); - - bool operator==(const four_cc&) const; - bool operator!=(const four_cc&) const; - - bool operator==(const char*) const; - bool operator!=(const char*) const; - - operator unsigned long() const; - unsigned long as_long() const; - - four_cc& operator=(unsigned long); - - char operator[](int) const; - - std::ostream& put(std::ostream&) const; - - bool printable() const; - -private: - - union - { - char code[4]; - unsigned long code_as_long; - }; - -}; - - -inline four_cc::four_cc() -{ -} - -inline four_cc::four_cc(unsigned long x) - : code_as_long(x) -{ -} - -inline four_cc::four_cc(const char* str) -{ - memcpy(code, str, 4); -} - - -inline bool four_cc::operator==(const four_cc& rhs) const -{ - return code_as_long == rhs.code_as_long; -} - -inline bool four_cc::operator!=(const four_cc& rhs) const -{ - return !operator==(rhs); -} - -inline bool four_cc::operator==(const char* rhs) const -{ - return (memcmp(code, rhs, 4) == 0); -} - -inline bool four_cc::operator!=(const char* rhs) const -{ - return !operator==(rhs); -} - - -inline four_cc::operator unsigned long() const -{ - return code_as_long; -} - -inline unsigned long four_cc::as_long() const -{ - return code_as_long; -} - -inline char four_cc::operator[](int i) const -{ - return code[i]; -} - -inline four_cc& four_cc::operator=(unsigned long val) -{ - code_as_long = val; - return *this; -} - -inline std::ostream& operator<<(std::ostream& os, const four_cc& rhs) -{ - return rhs.put(os); -} - -#endif diff --git a/vp8/common/mac_specs.h b/vp8/common/mac_specs.h deleted file mode 100644 index 4b8ee5877..000000000 --- a/vp8/common/mac_specs.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * 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. - */ - - -#if !defined(_mac_specs_h) -#define _mac_specs_h - - -#if defined(__cplusplus) -extern "C" { -#endif - - extern unsigned int vp8_read_tsc(); - - extern unsigned int vp8_get_processor_freq(); - - extern unsigned int vpx_has_altivec(); - -#if defined(__cplusplus) -} -#endif - - -#endif diff --git a/vp8/common/partialgfupdate.h b/vp8/common/partialgfupdate.h deleted file mode 100644 index 115134a53..000000000 --- a/vp8/common/partialgfupdate.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * 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 __INC_PARTIALGFUPDATE_H -#define __INC_PARTIALGFUPDATE_H - -#include "onyxc_int.h" - -extern void update_gf_selective(ONYX_COMMON *cm, MACROBLOCKD *x); - -#endif diff --git a/vp8/common/predictdc.c b/vp8/common/predictdc.c deleted file mode 100644 index f315f50e0..000000000 --- a/vp8/common/predictdc.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * 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 <stdlib.h> -#include "blockd.h" - - -void vp8_predict_dc(short *lastdc, short *thisdc, short quant, short *cons) -{ - int diff; - int sign; - int last_dc = *lastdc; - int this_dc = *thisdc; - - if (*cons > DCPREDCNTTHRESH) - { - this_dc += last_dc; - } - - diff = abs(last_dc - this_dc); - sign = (last_dc >> 31) ^(this_dc >> 31); - sign |= (!last_dc | !this_dc); - - if (sign) - { - *cons = 0; - } - else - { - if (diff <= DCPREDSIMTHRESH * quant) - (*cons)++ ; - } - - *thisdc = this_dc; - *lastdc = this_dc; -} diff --git a/vp8/common/predictdc.h b/vp8/common/predictdc.h deleted file mode 100644 index fa8596822..000000000 --- a/vp8/common/predictdc.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * 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 __PREDICTDC_H -#define __PREDICTDC_H - -void uvvp8_predict_dc(short *lastdc, short *thisdc, short quant, short *cons); -void vp8_predict_dc(short *lastdc, short *thisdc, short quant, short *cons); - -#endif diff --git a/vp8/common/proposed.h b/vp8/common/proposed.h deleted file mode 100644 index c9659902b..000000000 --- a/vp8/common/proposed.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * 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. - */ - - -typedef struct core_codec *codec_ptr; -typedef struct interface_table *interface_ptr; - -typedef struct -{ - void (*Initialize)(); - void (*Shutdown)(); - codec_ptr(*Create)(); - int (*compress_frame)(codec_ptr, unsigned int *frame_flags, YV12_BUFFER_CONFIG *sd, unsigned long *size, char *dest, INT64 time_stamp); - int (*show_frame)(codec_ptr , YV12_BUFFER_CONFIG *dest, int deblock_level, int noise_level, int flags); - void (*Remove)(codec_ptr *comp); - interface_ptr(*get_interface)(unsigned int id); - -} core_codec; - -typedef struct -{ - int (*set_bitrate)(codec_ptr, END_USAGE usage, int Datarate); - int (*get_bitrate)(codec_ptr, END_USAGE *usage, int *Datarate); - int (*set_mode)(codec_ptr, MODE mode, int Speed, char *File); - int (*get_mode)(codec_ptr, MODE *mode, int *Speed, char **File); -} codec_settings_basic; - -typedef struct -{ - int (*set_bitrate)(codec_ptr, END_USAGE usage, int Datarate); - int (*get_bitrate)(codec_ptr, END_USAGE *usage, int *Datarate); - int (*set_mode)(codec_ptr, MODE mode, int Speed, char *File); - int (*get_mode)(codec_ptr, MODE *mode, int *Speed, char **File); - int (*set_denoise)(codec_ptr, int Level); - int (*get_denoise)(codec_ptr, int *Level); - int (*set_sharpness)(codec_ptr, int sharpness); - int (*get_sharpness)(codec_ptr, int *sharpness); - int (*set_keyframing)(codec_ptr, int Auto, int max_distance); - int (*get_keyframing)(codec_ptr, int *Auto, int *max_distance); - int (*set_buffering)(codec_ptr, int buffer_level, int max_buffer_level); - int (*get_buffering)(codec_ptr, int *buffer_level, int *max_buffer_level); - int (*set_adjust_frame_rate)(codec_ptr, int Allowed, int at_buffer_level_pct); - int (*get_adjust_frame_rate)(codec_ptr, int *Allowed, int *at_buffer_level_pct); - int (*set_adjust_frame_size)(codec_ptr, int Allowed, int down_at_buffer_level_pct, int up_at_buffer_level_pct); - int (*get_adjust_frame_size)(codec_ptr, int *Allowed, int *down_at_buffer_level_pct, int *up_at_buffer_level_pct); - int (*set_adjust_quality)(codec_ptr, int Allowed, int min_quantizer, int max_quantizer); - int (*get_adjust_quality)(codec_ptr, int *Allowed, int *min_quantizer, int *max_quantizer); - int (*set_vbrparms)(codec_ptr, int Bias, int Min, int Max); - int (*get_vbrparms)(codec_ptr, int *Bias, int *Min, int *Max); - -} codec_settings_v1; - -typedef struct -{ - int (*request_recovery)(codec_ptr); - int (*request_droppable)(codec_ptr); - int (*internal_size)(codec_ptr, VPX_SCALING Vertical, VPX_SCALING Horizontal); - int (*update_last)(codec_ptr); - int (*update_gold)(codec_ptr); - int (*use_only_last)(codec_ptr); - int (*use_only_gold)(codec_ptr); - int (*update_entropy)(codec_ptr); - -} codec_realtime_requests; diff --git a/vp8/common/vfwsetting.hpp b/vp8/common/vfwsetting.hpp deleted file mode 100644 index 44869ecc7..000000000 --- a/vp8/common/vfwsetting.hpp +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * 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. - */ - - -#if !defined(VFWSETTING_HPP) -#define VFWSETTING_HPP -//______________________________________________________________________________ -// -// VFWSetting.hpp -// - -#include "four_cc.hpp" -#include <iosfwd> - -namespace vpxvp -{ - - //-------------------------------------- - class VFWSetting - { - friend std::ostream& operator<<(std::ostream& os, const VFWSetting& vfws); - - public: - - enum Mode - { - m_setting, - m_config - }; - - enum - { - header_size = 8, - Size = 16 - }; - - VFWSetting(four_cc fcc); - ~VFWSetting(); - - four_cc fcc() const; - Mode mode() const; - - int setting() const; - int value() const; - void setting_value(int i_setting, int i_value); // Sets mode to m_setting - - long size() const; - const void* data() const; - int data(const void* p_data, unsigned long ul_size); - - private: - - VFWSetting(const VFWSetting& vfws); // Not implemented - VFWSetting& operator=(const VFWSetting& vfws); // Not implemented - - int extract_(const void* p_data, unsigned long ul_size); - void update_() const; - - four_cc m_fcc; - Mode m_mode; - int m_i_setting; - int m_i_value; - - mutable unsigned char m_p_data[Size]; - }; - -} // namespace vpxvp - -#endif // VFWSETTING_HPP diff --git a/vp8/common/vpx_ref_build_prefix.h b/vp8/common/vpx_ref_build_prefix.h deleted file mode 100644 index a2fce65dc..000000000 --- a/vp8/common/vpx_ref_build_prefix.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * 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 _VPX_REF_BUILD_PREFIX_h -#define _VPX_REF_BUILD_PREFIX_h - -#if defined(__cplusplus) -extern "C" { -#endif - - -#if defined(__cplusplus) -} -#endif - -#endif /* include guards */ diff --git a/vp8/common/vpxblit.h b/vp8/common/vpxblit.h deleted file mode 100644 index a95d90574..000000000 --- a/vp8/common/vpxblit.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * 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 VPXBLIT_H_INCL -#define VPXBLIT_H_INCL -/*============================================================================== - Includes -==============================================================================*/ - -/*============================================================================== - Defines -==============================================================================*/ - - -#ifdef VPX_BIG_ENDIAN -#define BYTE_ZERO(X) ((X & 0xFF000000) >> (24 - 2) ) -#define BYTE_ONE(X) ((X & 0x00FF0000) >> (16 - 2) ) -#define BYTE_TWO(X) ((X & 0x0000FF00) >> (8 - 2) ) -#define BYTE_THREE(X) ((X & 0x000000FF) << (0 + 2) ) - -#define BYTE_ZERO_UV(X) ((X & 0x0000FF00) >> (8 - 2) ) -#define BYTE_ONE_UV(X) ((X & 0x000000FF) << (0 + 2) ) - -#define REREFERENCE(X) (*((int *) &(X))) - -#else - -#define BYTE_THREE(X) ((X & 0xFF000000) >> (24 - 2) ) -#define BYTE_TWO(X) ((X & 0x00FF0000) >> (16 - 2) ) -#define BYTE_ONE(X) ((X & 0x0000FF00) >> (8 - 2) ) -#define BYTE_ZERO(X) ((X & 0x000000FF) << (0 + 2) ) - -#define BYTE_ONE_UV(X) ((X & 0x0000FF00) >> (8 - 2) ) -#define BYTE_ZERO_UV(X) ((X & 0x000000FF) << (0 + 2) ) - -#define REREFERENCE(X) (*((int *) &(X))) - -#endif - - -/*============================================================================== - Type Definitions -==============================================================================*/ -typedef struct // YUV buffer configuration structure -{ - int y_width; - int y_height; - int y_stride; - - int uv_width; - int uv_height; - int uv_stride; - - char *y_buffer; - char *u_buffer; - char *v_buffer; - - char *uv_start; - int uv_dst_area; - int uv_used_area; - -} VPX_BLIT_CONFIG; - -typedef struct tx86_params -{ - unsigned int pushed_registers[6]; - unsigned int return_address; - unsigned int dst; - unsigned int scrn_pitch; - VPX_BLIT_CONFIG *buff_config; -} x86_params; - -/*============================================================================= - Enums -==============================================================================*/ - - -/*============================================================================== - Structures -==============================================================================*/ - -/*============================================================================== - Constants -==============================================================================*/ - - -/*============================================================================== - Variables -==============================================================================*/ - - - - -/*============================================================================== - Function Protoypes/MICROS -==============================================================================*/ -int vpx_get_size_of_pixel(unsigned int bd); -void *vpx_get_blitter(unsigned int bd); -void vpx_set_blit(void); -void vpx_destroy_blit(void); - - - -#endif //VPXBLIT_H_INCL diff --git a/vp8/common/vpxblit_c64.h b/vp8/common/vpxblit_c64.h deleted file mode 100644 index 4ee617f6c..000000000 --- a/vp8/common/vpxblit_c64.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * 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 _VPX_BLIT_C64_h -#define _VPX_BLIT_C64_h - -/**************************************************************************** -* Typedefs -****************************************************************************/ - -typedef struct // YUV buffer configuration structure -{ - int y_width; - int y_height; - int y_stride; - - int uv_width; - int uv_height; - int uv_stride; - - unsigned char *y_buffer; - unsigned char *u_buffer; - unsigned char *v_buffer; - - unsigned char *y_ptr_scrn; - unsigned char *u_ptr_scrn; - unsigned char *v_ptr_scrn; - -} DXV_YUV_BUFFER_CONFIG; - -typedef struct -{ - unsigned char *rgbptr_scrn; - unsigned char *y_ptr_scrn; - unsigned char *u_ptr_scrn; - unsigned char *v_ptr_scrn; - unsigned char *rgbptr_scrn2; -} DXV_FINAL_VIDEO; - -#endif /* include guards */ diff --git a/vp8/common/vpxerrors.h b/vp8/common/vpxerrors.h deleted file mode 100644 index b70f29673..000000000 --- a/vp8/common/vpxerrors.h +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * 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. - */ - - - -#define ALLOC_FAILURE -2 diff --git a/vp8/decoder/arm/dequantize_arm.c b/vp8/decoder/arm/dequantize_arm.c index b26af975f..d88adb729 100644 --- a/vp8/decoder/arm/dequantize_arm.c +++ b/vp8/decoder/arm/dequantize_arm.c @@ -11,7 +11,6 @@ #include "vpx_ports/config.h" #include "vp8/decoder/dequantize.h" -#include "vp8/common/predictdc.h" #include "vp8/common/idct.h" #include "vpx_mem/vpx_mem.h" diff --git a/vp8/decoder/decodframe.c b/vp8/decoder/decodframe.c index 5769100ec..c454bbc70 100644 --- a/vp8/decoder/decodframe.c +++ b/vp8/decoder/decodframe.c @@ -30,7 +30,6 @@ #include "vpx_mem/vpx_mem.h" #include "vp8/common/idct.h" #include "dequantize.h" -#include "vp8/common/predictdc.h" #include "vp8/common/threading.h" #include "decoderthreading.h" #include "dboolhuff.h" diff --git a/vp8/decoder/dequantize.c b/vp8/decoder/dequantize.c index 4e1a5e17a..dd0c13b7d 100644 --- a/vp8/decoder/dequantize.c +++ b/vp8/decoder/dequantize.c @@ -11,7 +11,6 @@ #include "vpx_ports/config.h" #include "dequantize.h" -#include "vp8/common/predictdc.h" #include "vp8/common/idct.h" #include "vpx_mem/vpx_mem.h" diff --git a/vp8/decoder/x86/onyxdxv.c b/vp8/decoder/x86/onyxdxv.c deleted file mode 100644 index ed38e2b9a..000000000 --- a/vp8/decoder/x86/onyxdxv.c +++ /dev/null @@ -1,1080 +0,0 @@ -/* - * Copyright (c) 2010 The WebM project authors. All Rights Reserved. - * - * 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. - */ - - -/**************************************************************************** -* -* Module Title : onyxdxv.c -* -* Description : VP80 interface to DXV. -* -***************************************************************************** -*/ -/**************************************************************************** -* Header Files -****************************************************************************/ -#include <math.h> // For Abs() -#include "vp8/common/pragmas.h" - -#include "vpxdxv.h" -#include "vpxdxv_plugin.h" - -#include "vp8/decoder/onyxd_int.h" -#include "vp8/common/onyx.h" -#include "vp8/common/codec_common_interface.h" -#include "vpx_scale/vpxscale.h" -#include "vpx_mem/vpx_mem.h" -#include "vp8/common/postproc.h" -#include "vp8/common/vpxblit.h" -#include "vp8/common/g_common.h" -#include "vpx_scale/yv12extend.h" - -#include <limits.h> -#include <stdio.h> -#include "scale_mode.h" -#include "onyx_pb_interface.h" - -/**************************************************************************** -* Macros -****************************************************************************/ - -#define VP8_FOURCC DXL_MKFOURCC( 'V', 'P', '8', '0') - -extern void vp8_blit_text(const char *msg, unsigned char *address, const int pitch); - - -/**************************************************************************** -* Typedefs -****************************************************************************/ - -typedef struct // YUV buffer configuration structure -{ - int y_width; - int y_height; - int y_stride; - - int uv_width; - int uv_height; - int uv_stride; - - char *y_buffer; - char *u_buffer; - char *v_buffer; - - char *uv_start; - int uv_dst_area; - int uv_used_area; - - unsigned char *y_ptr_scrn; - unsigned char *u_ptr_scrn; - unsigned char *v_ptr_scrn; - - -} DXV_YUV_BUFFER_CONFIG; - - -typedef void ((*vp8blit_func)(unsigned char *, int, YUV_BUFFER_CONFIG *)); - -/* define an x_image structure based on the core x_image struct */ -typedef struct t_ximage_codec -{ - DXV_YUV_BUFFER_CONFIG frame_buffer; - VP8D_COMP *my_pbi; - VP8_COMMON *common; - int owned; - int decompressed_once; - - int sizeof_pixel; - vp8blit_func blitter; - - unsigned int ppl_tag; - unsigned int bd_tag; - unsigned int *supported_output_format_list; - - int cpu_free; - int postproc; - int add_noise; - int deinterlace; - - int post_proc2time; - int post_proc4time; - - int hs; - int hr; - int vs; - int vr; - YV12_BUFFER_CONFIG this_buffer; - YV12_BUFFER_CONFIG scaled_buffer; - YV12_BUFFER_CONFIG *passed_in_buffer; - - int avgq; - int ppcount; - - -} VP8_XIMAGE, *VP8_XIMAGE_HANDLE; - - -/**************************************************************************** -* Modul Statics -****************************************************************************/ -static unsigned int g_vp8_preferred_output_format_list[] = -{ - VPXDXV_YUY2, - VPXDXV_UYVY, - VPXDXV_RGB8888, - VPXDXV_RGB888, - VPXDXV_RGB555, - VPXDXV_RGB565, - VPXDXV_YV12, - VPXDXV_I420, - -// VPXDXV_YV12, -// VPXDXV_YUY2, -// VPXDXV_RGB565, -// VPXDXV_UYVY, - 0 -}; - -/**************************************************************************** -* Forward declarationss -****************************************************************************/ -void onyx_set_parameter(XIMAGE_HANDLE src, int Command, unsigned int Parameter); - -static int onyx_get_output_format(XIMAGE_HANDLE src, unsigned int *bd_tag); -static int onyx_set_output_format(XIMAGE_HANDLE src, unsigned int bd_tag); - -static int vpx_get_size_of_pixel(unsigned int bd); - -/**************************************************************************** -* Imports -****************************************************************************/ - -#define __Clamp255(x) (unsigned char) ( (x) < 0 ? 0 : ( (x) <= 255 ? (x) : 255 ) ) - -/* -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*/ -/* -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*/ -void -convert_yv12_buffer_types(YV12_BUFFER_CONFIG *source, DXV_YUV_BUFFER_CONFIG *dest) -{ - dest->y_buffer = (char *)source->y_buffer; - dest->u_buffer = (char *)source->u_buffer; - dest->v_buffer = (char *)source->v_buffer; - dest->y_width = source->y_width; - dest->y_height = source->y_height; - dest->y_stride = source->y_stride; - dest->uv_width = source->uv_width; - dest->uv_height = source->uv_height; - dest->uv_stride = source->uv_stride; -} - -/* -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*/ - - -int onyx_blit -( - XIMAGE_HANDLE src, - VSCREEN_HANDLE v_screen, - DXV_YUV_BUFFER_CONFIG *frame_buffer, - int x, - int y -) -{ - VP8_XIMAGE_HANDLE tab = (VP8_XIMAGE_HANDLE)vpxdxv_get_algorithm_base_ptr(src); - VP8D_COMP *pbi; - VP8_COMMON *common = tab->common; - pbi = tab->my_pbi; - - if (v_screen) /* if there is a v_screen, blit to it */ - { - unsigned char *ptr_scrn; - int this_pitch, vs_height, vs_width; - unsigned int start_tick, stop_tick; - - vpxdxv_get_vscreen_attributes(v_screen, (void **)&ptr_scrn, &vs_width, &vs_height, &this_pitch); - - if (ptr_scrn) - { - int w, h; - - int p_size; - int view_x, view_y, view_w; - int hs, hr, vs, vr; - int neww, newh; - int cw, ch; - int microseconds_available = (int)(1000000 / 30); - - microseconds_available = microseconds_available * tab->cpu_free / 100; - - if (pbi) - { - microseconds_available -= pbi->decode_microseconds; - - if (tab->cpu_free == 0) - microseconds_available = INT_MAX; - - if (tab->post_proc2time == 0) - tab->post_proc2time = pbi->decode_microseconds * 1 / 2; - - if (tab->post_proc4time == 0) - tab->post_proc4time = pbi->decode_microseconds; - } - - - if (tab->ppcount == 0) - { - tab->post_proc2time = 0; - tab->post_proc4time = 0; - tab->ppcount = 64; - } - else - { - tab->ppcount --; - } - - vpxdxv_get_vscreen_view(v_screen, &view_x, &view_y, &view_w, NULL); - - Scale2Ratio(common->horiz_scale, &hr, &hs); - Scale2Ratio(common->vert_scale, &vr, &vs); - - if (tab->postproc && tab->passed_in_buffer == 0) - { - int show_text = 0; - - unsigned char message[512]; - - int pp = tab->postproc; - int q = (tab->avgq + 4) / 8; - int noise = 0; - - vp8_clear_system_state(); - - if (pp >= 1000) - { - pp -= 1000; - noise = pp / 100; - pp = pp - noise * 100; - } - - if (pp >= 300) - { - pp -= 300; - show_text = 3; - } - else if (pp >= 200) - { - pp -= 200; - show_text = 2; - } - else if (pp >= 100) - { - pp -= 100; - show_text = 1; - } - - if (pbi && (pbi->mb.segmentation_enabled & SEGMENT_PF) && tab->deinterlace) - { - de_interlace(common->frame_to_show->y_buffer, common->post_proc_buffer.y_buffer, - common->post_proc_buffer.y_width, common->post_proc_buffer.y_height, - common->post_proc_buffer.y_stride); - - de_interlace(common->frame_to_show->u_buffer, common->post_proc_buffer.u_buffer, - common->post_proc_buffer.uv_width, common->post_proc_buffer.uv_height, - common->post_proc_buffer.uv_stride); - de_interlace(common->frame_to_show->v_buffer, common->post_proc_buffer.v_buffer, - common->post_proc_buffer.uv_width, common->post_proc_buffer.uv_height, - common->post_proc_buffer.uv_stride); - } - else - { - if (pp >= 10 && pp <= 20) - { - q = q + (pp - 15) * 10; - - if (q < 0) - q = 0; - } - - start_tick = vp8_get_high_res_timer_tick(); - - if (pp > 3 && tab->post_proc4time < microseconds_available) - { - vp8_deblock_and_de_macro_block(common->frame_to_show, &common->post_proc_buffer, q, 1, 0); - - stop_tick = vp8_get_high_res_timer_tick(); - - if (pbi) - tab->post_proc4time = vp8_get_time_in_micro_sec(start_tick, stop_tick); - } - - else if (pp > 0 && tab->post_proc2time < microseconds_available) - { - vp8_deblock(common->frame_to_show, &common->post_proc_buffer, q , 1, 0); - stop_tick = vp8_get_high_res_timer_tick(); - - if (pbi) - tab->post_proc2time = vp8_get_time_in_micro_sec(start_tick, stop_tick); - } - else - { - vp8_yv12_copy_frame(common->frame_to_show, &common->post_proc_buffer); - } - - } - - vp8_clear_system_state(); - - if (tab->add_noise == 1) - { - - vp8_plane_add_noise(common->post_proc_buffer.y_buffer, - common->post_proc_buffer.y_width, common->post_proc_buffer.y_height, - common->post_proc_buffer.y_stride, 63 - q, noise); - } - - - if (show_text == 1) - { -#ifdef PACKET_TESTING - { - VP8_HEADER *oh2 = (VP8_HEADER *) pbi->Source; - sprintf(message, "%8d %d%d%d%d%d size:%d\n", - oh2->frame_number , - oh2->update_gold , - oh2->update_last , - oh2->uses_gold , - oh2->uses_last , - oh2->type, - vpxdxv_get_ximage_csize(src)); - } -#else - sprintf(message, "F:%1ldG:%1ldQ:%3ldF:%3ld,%3ldP:%d_s:%6ld,N:%d,", - (common->frame_type == KEY_FRAME), - common->refresh_golden_frame, - common->base_qindex, - common->filter_level, - q, - tab->postproc, - vpxdxv_get_ximage_csize(src), noise); -#endif - - vp8_blit_text(message, common->post_proc_buffer.y_buffer, common->post_proc_buffer.y_stride); - - } - else if (show_text == 2) - { - int i, j; - unsigned char *y_ptr; - YV12_BUFFER_CONFIG *post = &common->post_proc_buffer; - int mb_rows = post->y_height >> 4; - int mb_cols = post->y_width >> 4; - int mb_index = 0; - MODE_INFO *mi = common->mi; - - y_ptr = post->y_buffer + 4 * post->y_stride + 4; - - // vp8_filter each macro block - for (i = 0; i < mb_rows; i++) - { - for (j = 0; j < mb_cols; j++) - { - char zz[4]; - - if (pp == 4) - sprintf(zz, "%c", mi[mb_index].mbmi.mode + 'a'); - else - sprintf(zz, "%c", mi[mb_index].mbmi.ref_frame + 'a'); - - vp8_blit_text(zz, y_ptr, post->y_stride); - mb_index ++; - y_ptr += 16; - } - - mb_index ++; //border - y_ptr += post->y_stride * 16 - post->y_width; - - } - } - else if (show_text == 3) - { - int i, j; - unsigned char *y_ptr; - YV12_BUFFER_CONFIG *post = &common->post_proc_buffer; - int mb_rows = post->y_height >> 4; - int mb_cols = post->y_width >> 4; - int mb_index = 0; - MODE_INFO *mi = common->mi; - - y_ptr = post->y_buffer + 4 * post->y_stride + 4; - - // vp8_filter each macro block - for (i = 0; i < mb_rows; i++) - { - for (j = 0; j < mb_cols; j++) - { - char zz[4]; - - if (j == 0) - sprintf(zz, "%c", '0' + i % 10); - else - sprintf(zz, "%c", '0' + j % 10); - - vp8_blit_text(zz, y_ptr, post->y_stride); - mb_index ++; - y_ptr += 16; - } - - y_ptr += post->y_stride * 16 - post->y_width; - - } - } - - vpx_memcpy(&tab->this_buffer, &common->post_proc_buffer, sizeof(YV12_BUFFER_CONFIG)); - } - else - { - vpx_memcpy(&tab->this_buffer, common->frame_to_show, sizeof(YV12_BUFFER_CONFIG)); - } - - - /* get a frame pointer to the scaled and postprocessed reconstructed buffer */ - if (tab->passed_in_buffer == 0) - { - if (common->horiz_scale != NORMAL || common->vert_scale != NORMAL) - { - neww = hs * tab->this_buffer.y_width / hr; - newh = vs * tab->this_buffer.y_height / vr; - - neww += neww & 1; - - if (tab->hs != hs || tab->hr != hr || tab->vs != vs || tab->vr != vr) - { - vp8_yv12_alloc_frame_buffer(&tab->scaled_buffer, neww, newh , 8); - } - - vp8_yv12_scale_or_center(&tab->this_buffer, - &tab->scaled_buffer, - neww, newh, SCALE_TO_FIT, hs, hr, vs, vr); - - convert_yv12_buffer_types(&tab->scaled_buffer, frame_buffer); - - cw = hs * common->Width / hr; - ch = vs * common->Height / vr; - - } - else - { - convert_yv12_buffer_types(&tab->this_buffer, frame_buffer); - - cw = common->Width; - ch = common->Height; - } - } - else - { - convert_yv12_buffer_types(tab->passed_in_buffer, frame_buffer); - cw = common->Width; - ch = common->Height; - tab->passed_in_buffer = 0; - } - - frame_buffer->y_width = cw; - frame_buffer->y_height = ch; - frame_buffer->uv_width = cw / 2; - frame_buffer->uv_height = ch / 2; - - p_size = vpx_get_size_of_pixel(tab->bd_tag); - - /* remember to offset if requested */ - y += view_y; - x += view_x ; - - /* for planar destinations */ - w = view_w; - h = vs_height; - - if (w < frame_buffer->y_width) - { - frame_buffer->y_width = w; - frame_buffer->uv_width = (w + 1) / 2; - } - - if (h < frame_buffer->y_height) - { - frame_buffer->y_height = h; - frame_buffer->uv_height = (h + 1) / 2; - } - - if (frame_buffer->y_width < view_w) - x += (view_w - frame_buffer->y_width) / 2; - - if (x & 1) - x -= 1; - - if (frame_buffer->y_height < vs_height) - y += (vs_height - frame_buffer->y_height) / 2; - - - ptr_scrn += (x * p_size) + (y * this_pitch); - - frame_buffer->y_stride *= -1; - frame_buffer->uv_stride *= -1; - - if (tab->bd_tag == VPXDXV_YV12 || tab->bd_tag == VPXDXV_I420) - { - if (this_pitch < 0) - { - frame_buffer->uv_start = (char *)(ptr_scrn + abs(this_pitch) + abs(this_pitch) * h / 4 + this_pitch / 2); - frame_buffer->uv_dst_area = abs((this_pitch * h) / 4); - frame_buffer->uv_used_area = 0; - } - else - { - frame_buffer->uv_start = (char *)(ptr_scrn + (this_pitch * h)); - frame_buffer->uv_dst_area = (((this_pitch + 1) / 2) * ((h + 1) / 2)); - frame_buffer->uv_used_area = (((this_pitch + 1) / 2) * frame_buffer->uv_height); - } - } - - if ((pbi->mb.segmentation_enabled & SEGMENT_PF) && (tab->bd_tag != VPXDXV_YV12 && tab->bd_tag != VPXDXV_I420)) - { - int ypitch = frame_buffer->y_stride; - int uvpitch = frame_buffer->uv_stride; - - frame_buffer->y_stride <<= 1; - frame_buffer->y_height >>= 1; - frame_buffer->uv_stride <<= 1; - frame_buffer->uv_height >>= 1; - - ptr_scrn += this_pitch; - frame_buffer->y_buffer -= ypitch; - frame_buffer->u_buffer -= uvpitch; - frame_buffer->v_buffer -= uvpitch; - tab->blitter(ptr_scrn, 2 * this_pitch, (YUV_BUFFER_CONFIG *)(&tab->frame_buffer)); - - ptr_scrn -= this_pitch; - frame_buffer->y_buffer += ypitch; - frame_buffer->u_buffer += uvpitch; - frame_buffer->v_buffer += uvpitch; - tab->blitter(ptr_scrn, 2 * this_pitch, (YUV_BUFFER_CONFIG *)(&tab->frame_buffer)); - - } - else - { - /* blit the screen */ - tab->blitter(ptr_scrn, this_pitch, (YUV_BUFFER_CONFIG *)(&tab->frame_buffer)); - vpx_log("Decoder: Frame shown \n"); - } - - } - else - vpx_log("Decoder: Frame not shown scrn pointer 0\n"); - } - else - vpx_log("Decoder: Frame not shown vscreen 0\n"); - - return DXV_OK; -} -/**************************************************************************** - * - * ROUTINE : onyx_decompress - * - * INPUTS : None - * - * OUTPUTS : None - * - * RETURNS : None. - * - * FUNCTION : - * - * SPECIAL NOTES : - * - ****************************************************************************/ -static -int onyx_decompress(XIMAGE_HANDLE src, VSCREEN_HANDLE v_screen) -{ - VP8_XIMAGE_HANDLE this_algorithm_base = (VP8_XIMAGE_HANDLE)vpxdxv_get_algorithm_base_ptr(src); - unsigned char *c_addr; - unsigned int c_size; - int w, h, x, y; - int vp8_rv; - - c_addr = vpxdxv_get_ximage_cdata_addr(src); - c_size = vpxdxv_get_ximage_csize(src); - vpxdxv_get_ximage_xywh(src, &x, &y, &w, &h); - - // if we have a compressed frame decompress it ( otherwise we'll just redo - // the scaling and postprocessing from the last frame ) - if (c_addr) - { - if (c_size != 0) - { - int flags; - int ret_val; - - int f; - - // decode the frame - ret_val = vp8d_decompress_frame((VP8D_PTR) this_algorithm_base->my_pbi, - c_size, - (char *) c_addr, - &this_algorithm_base->this_buffer, - &flags); - - - f = this_algorithm_base->my_pbi->common.filter_level * 10 / 6; - - if (this_algorithm_base->my_pbi->common.frame_type == KEY_FRAME) - this_algorithm_base->avgq = 8 * f; - else - this_algorithm_base->avgq = this_algorithm_base->avgq * 7 / 8 + f; - - - - if (ret_val != 0) - { - if (ret_val == -1) - return DXV_VERSION_CONFLICT; - else - return DXV_BAD_DATA; - } - - } - } - - - vp8_rv = onyx_blit(src, v_screen, &this_algorithm_base->frame_buffer, x, y); - - - return vp8_rv; -} -/* -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*/ -static -int vp8_ximagedestroy(XIMAGE_HANDLE src) -{ - VP8_XIMAGE_HANDLE this_algorithm_base = (VP8_XIMAGE_HANDLE)vpxdxv_get_algorithm_base_ptr(src); - - if (this_algorithm_base) - { - - vp8_yv12_de_alloc_frame_buffer(&this_algorithm_base->scaled_buffer); - - /* safety check in case stopdecode was not called */ - if (this_algorithm_base->owned) - vp8dx_remove_decompressor((VP8D_PTR)(this_algorithm_base->my_pbi)); - - duck_free(this_algorithm_base); - } - - return DXV_OK; -} -/* -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*/ -static int -onyx_get_post_proc(XIMAGE_HANDLE src, unsigned int *ppl) -{ - VP8_XIMAGE_HANDLE this_algorithm_base = (VP8_XIMAGE_HANDLE)vpxdxv_get_algorithm_base_ptr(src); - - if (this_algorithm_base) - { - *ppl = this_algorithm_base->ppl_tag; - - return DXV_OK; - } - - return DXV_NULL_BASE; -} -/* -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*/ -static int -onyx_set_post_proc(XIMAGE_HANDLE src, unsigned int ppl) -{ - VP8_XIMAGE_HANDLE this_algorithm_base = (VP8_XIMAGE_HANDLE)vpxdxv_get_algorithm_base_ptr(src); - - if (this_algorithm_base) - { - this_algorithm_base->ppl_tag = ppl; - - return DXV_OK; - } - - return DXV_NULL_BASE; -} -/* -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*/ -static -int vp8_ximagestop_decode(XIMAGE_HANDLE src) -{ - VP8_XIMAGE_HANDLE this_algorithm_base = (VP8_XIMAGE_HANDLE)vpxdxv_get_algorithm_base_ptr(src); - - if (this_algorithm_base) - { - - vp8_yv12_de_alloc_frame_buffer(&this_algorithm_base->scaled_buffer); - - if (this_algorithm_base->owned) - vp8dx_remove_decompressor((VP8D_PTR)(this_algorithm_base->my_pbi)); - - this_algorithm_base->owned = 0; - } - - return DXV_OK; -} - - -/* -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*/ -static -int vp8_ximagestart_decode -( - XIMAGE_HANDLE src -) -{ - VP8_XIMAGE_HANDLE this_algorithm_base = (VP8_XIMAGE_HANDLE)vpxdxv_get_algorithm_base_ptr(src); - XIMAGE_INFO_PTR xinfo = vpxdxv_get_ximage_info(src); - VP8D_CONFIG ocf; - - if (xinfo) - { - ocf.Width = xinfo->width; - ocf.Height = xinfo->height; - } - - if (this_algorithm_base->common == 0) - { - this_algorithm_base->my_pbi = (VP8D_COMP *) vp8dx_create_decompressor(&ocf); - this_algorithm_base->owned = 1; - this_algorithm_base->common = &this_algorithm_base->my_pbi->common; - this_algorithm_base->avgq = 0; - - } - - this_algorithm_base->passed_in_buffer = 0; - this_algorithm_base->post_proc2time = 0; - this_algorithm_base->post_proc4time = 0; - this_algorithm_base->ppcount = 64; - - return DXV_OK; -} -/* -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*/ -static -DXV_HANDLE vp8_ximagecreate(XIMAGE_HANDLE src) -{ - VP8_XIMAGE_HANDLE this_algorithm_base; - - /* create a new algorithm base container */ - this_algorithm_base = (VP8_XIMAGE_HANDLE)duck_calloc(1, sizeof(VP8_XIMAGE), DMEM_GENERAL); - - if (this_algorithm_base == NULL) - return NULL; - - vp8_scale_machine_specific_config(); - - vpxdxv_register_ximage_start_decode(src, vp8_ximagestart_decode); - - vpxdxv_register_ximage_stop_decode(src, vp8_ximagestop_decode); - - vpxdxv_register_ximage_destroy(src, vp8_ximagedestroy); - - vpxdxv_register_ximage_dx(src, onyx_decompress); - - vpxdxv_register_ximage_set_parameter(src, onyx_set_parameter); - - vpxdxv_register_ximage_output_format_func(src, - onyx_get_output_format, - onyx_set_output_format); - - vpxdxv_register_ximage_post_proc_level_func(src, - onyx_get_post_proc, - onyx_set_post_proc); - - return (DXV_HANDLE)this_algorithm_base; -} - -/* -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*/ - -static int store_output_list(unsigned int supported, int count, - unsigned int *outlist) -{ - int i = 0, j = 0, - ret = DXV_OK; - - while (i < count) - { - while (supported && !(supported & 0x01)) - { - supported >>= 1; - ++j; - } - - *(outlist + i) = g_vp8_preferred_output_format_list[j]; - ++i; - ++j; - supported >>= 1; - } - - - return ret; -} - -/* -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*/ -static int onyx_get_output_list(XIMAGE_INFO_PTR xinfo, unsigned int *outlist, - unsigned int *size) -{ - int i, - ret = DXV_INVALID_REQUEST; - unsigned int supported = 0, - count = 0; - (void)xinfo; - - if (size) - { - for (i = 0; i < sizeof(g_vp8_preferred_output_format_list) / sizeof(unsigned int) && i < 32; ++i) - { - if (vpx_get_blitter(g_vp8_preferred_output_format_list[i]) != (void *)0xffffffff) - { - supported |= (1 << i); - ++count; - } - } - - if (outlist) - { - if (count && ((count + 1) == (*size / sizeof(int)))) - ret = store_output_list(supported, count, outlist); - else - *outlist = 0; - } - else - { - *size = (count + 1) * sizeof(int); - ret = DXV_OK; - } - } - - return ret; -} - -/* -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*/ -int onyx_init(void) -{ - int vp8_rv; - - /* register VPX blitters based on cpu */ - vpx_set_blit(); - - vp8_rv = vpxdxv_register_ximage(vp8_ximagecreate, onyx_get_output_list, VP8_FOURCC); - return vp8_rv; - - return DXV_OK; -} -/* -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*/ -int onyx_exit(void) -{ - - vpxdxv_un_register_ximage(VP8_FOURCC); - - return DXV_OK; -} -/**************************************************************************** - * - * ROUTINE : onyx_set_parameter - * - * INPUTS : XIMAGE_HANDLE src : - * int Command : - * unsigned long Parameter : - * - * OUTPUTS : None. - * - * RETURNS : void - * - * FUNCTION : - * - * - * SPECIAL NOTES : None. - * - ****************************************************************************/ -void onyx_set_parameter(XIMAGE_HANDLE src, int Command, unsigned int Parameter) -{ - VP8_XIMAGE_HANDLE this_algorithm_base = (VP8_XIMAGE_HANDLE)vpxdxv_get_algorithm_base_ptr(src); - - switch (Command) - { - case PBC_SET_CPUFREE: - this_algorithm_base->cpu_free = Parameter; - break; - case PBC_SET_POSTPROC: - this_algorithm_base->postproc = Parameter; - break; - - case PBC_SET_BLITBUFF: - this_algorithm_base->passed_in_buffer = (YV12_BUFFER_CONFIG *) Parameter; - break; - - case PBC_SET_REFERENCEFRAME: - { - VP8_XIMAGE_HANDLE tab = (VP8_XIMAGE_HANDLE)vpxdxv_get_algorithm_base_ptr(src); - VP8D_COMP *pbi; - pbi = tab->my_pbi; - vp8_yv12_copy_frame((YV12_BUFFER_CONFIG *) Parameter, &pbi->common.last_frame); - } - break; - - case PBC_SET_COMMON: - - if (Parameter) - { - this_algorithm_base->common = (VP8_COMMON *)Parameter; - } - - break; - case PBC_SET_ADDNOISE: - this_algorithm_base->add_noise = Parameter; - break; - case PBC_SET_DEINTERLACEMODE: - this_algorithm_base->deinterlace = Parameter; - break; - - } -} -/* -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*/ -static int -onyx_get_output_format(XIMAGE_HANDLE src, unsigned int *format_tag) -{ - VP8_XIMAGE_HANDLE this_algorithm_base = (VP8_XIMAGE_HANDLE)vpxdxv_get_algorithm_base_ptr(src); - - if (this_algorithm_base) - { - *format_tag = this_algorithm_base->bd_tag; - return DXV_OK; - } - - return DXV_NULL_BASE; -} - -/* -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*/ -static int -onyx_set_output_format(XIMAGE_HANDLE src, unsigned int bd_tag) -{ - VP8_XIMAGE_HANDLE this_algorithm_base = (VP8_XIMAGE_HANDLE)vpxdxv_get_algorithm_base_ptr(src); - int i; - unsigned int bd_tag_found; - - if (this_algorithm_base) - { - i = 0; - bd_tag_found = 0; - - while (g_vp8_preferred_output_format_list[i] != 0) - { - if (g_vp8_preferred_output_format_list[i] == bd_tag) - { - bd_tag_found = 1; - break; - } - - i++; - } - - if (bd_tag_found) - { - this_algorithm_base->blitter = (vp8blit_func)vpx_get_blitter(bd_tag); - this_algorithm_base->bd_tag = bd_tag; - return DXV_OK; - } - - return DXV_INVALID_BLIT; - } - - return DXV_NULL_BASE; -} - -/* -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -*/ -int -vpx_get_size_of_pixel(unsigned int bd) -{ - int vp8_rv; - - switch (bd) - { - case VPXDXV_YV12: - case VPXDXV_I420: - vp8_rv = 1; - break; - -#ifdef _ENABLE_SPLIT_PIXEL_ - case VPXDXV_SPLIT565: -#endif - case VPXDXV_RGB555: - case VPXDXV_RGB565: - case VPXDXV_YUY2: - case VPXDXV_UYVY: - case VPXDXV_YVYU: - vp8_rv = 2; - break; - - case VPXDXV_RGB888: - vp8_rv = 3; - break; - - case VPXDXV_RGB8888: - vp8_rv = 4; - break; - - default: - vp8_rv = -1; - break; - } - - return vp8_rv; -} diff --git a/vp8/encoder/arm/quantize_arm.c b/vp8/encoder/arm/quantize_arm.c index 75ec205cc..0e3334ac7 100644 --- a/vp8/encoder/arm/quantize_arm.c +++ b/vp8/encoder/arm/quantize_arm.c @@ -14,7 +14,6 @@ #include "vp8/encoder/quantize.h" #include "vp8/common/entropy.h" -#include "vp8/common/predictdc.h" DECLARE_ALIGNED(16, const short, vp8_rvsplus1_default_zig_zag1d[16]) = { diff --git a/vp8/encoder/onyx_if.c b/vp8/encoder/onyx_if.c index fcf03c320..65296886f 100644 --- a/vp8/encoder/onyx_if.c +++ b/vp8/encoder/onyx_if.c @@ -29,7 +29,6 @@ #include "vp8/common/swapyv12buffer.h" #include "vp8/common/threading.h" #include "vpx_ports/vpx_timer.h" -#include "vp8/common/vpxerrors.h" #include "temporal_filter.h" #if ARCH_ARM #include "vpx_ports/arm.h" @@ -1374,7 +1373,7 @@ static int vp8_alloc_partition_data(VP8_COMP *cpi) (cpi->common.mb_rows + 1), sizeof(PARTITION_INFO)); if(!cpi->mb.pip) - return ALLOC_FAILURE; + return 1; cpi->mb.pi = cpi->mb.pip + cpi->common.mode_info_stride + 1; @@ -3120,21 +3119,27 @@ static void set_quantizer(VP8_COMP *cpi, int Q) VP8_COMMON *cm = &cpi->common; MACROBLOCKD *mbd = &cpi->mb.e_mbd; int update = 0; - - update |= cm->base_qindex != Q; + int new_delta_q; cm->base_qindex = Q; + /* if any of the delta_q values are changing update flag has to be set */ + /* currently only y2dc_delta_q may change */ + cm->y1dc_delta_q = 0; - cm->y2dc_delta_q = 0; cm->y2ac_delta_q = 0; cm->uvdc_delta_q = 0; cm->uvac_delta_q = 0; - if(Q<4) + if (Q < 4) { - update |= cm->y2dc_delta_q != 4-Q; - cm->y2dc_delta_q = 4-Q; + new_delta_q = 4-Q; } + else + new_delta_q = 0; + + update |= cm->y2dc_delta_q != new_delta_q; + cm->y2dc_delta_q = new_delta_q; + // Set Segment specific quatizers mbd->segment_feature_data[MB_LVL_ALT_Q][0] = cpi->segment_feature_data[MB_LVL_ALT_Q][0]; @@ -3142,6 +3147,7 @@ static void set_quantizer(VP8_COMP *cpi, int Q) mbd->segment_feature_data[MB_LVL_ALT_Q][2] = cpi->segment_feature_data[MB_LVL_ALT_Q][2]; mbd->segment_feature_data[MB_LVL_ALT_Q][3] = cpi->segment_feature_data[MB_LVL_ALT_Q][3]; + /* quantizer has to be reinitialized for any delta_q changes */ if(update) vp8cx_init_quantizer(cpi); @@ -4491,53 +4497,48 @@ static void encode_frame_to_data_rate else cm->frame_to_show = &cm->yv12_fb[cm->new_fb_idx]; - //#pragma omp parallel sections + if (cm->no_lpf) { + cm->filter_level = 0; + } + else + { + struct vpx_usec_timer timer; - //#pragma omp section - { - - struct vpx_usec_timer timer; - - vpx_usec_timer_start(&timer); - - if (cpi->sf.auto_filter == 0) - vp8cx_pick_filter_level_fast(cpi->Source, cpi); - else - vp8cx_pick_filter_level(cpi->Source, cpi); + vpx_usec_timer_start(&timer); - vpx_usec_timer_mark(&timer); + if (cpi->sf.auto_filter == 0) + vp8cx_pick_filter_level_fast(cpi->Source, cpi); + else + vp8cx_pick_filter_level(cpi->Source, cpi); - cpi->time_pick_lpf += vpx_usec_timer_elapsed(&timer); + vpx_usec_timer_mark(&timer); - if (cm->no_lpf) - cm->filter_level = 0; + cpi->time_pick_lpf += vpx_usec_timer_elapsed(&timer); + } - if (cm->filter_level > 0) - { - vp8cx_set_alt_lf_level(cpi, cm->filter_level); - vp8_loop_filter_frame(cm, &cpi->mb.e_mbd, cm->filter_level); - cm->last_filter_type = cm->filter_type; - cm->last_sharpness_level = cm->sharpness_level; - } - /* Move storing frame_type out of the above loop since it is also needed in motion search besides loopfilter */ - cm->last_frame_type = cm->frame_type; + if (cm->filter_level > 0) + { + vp8cx_set_alt_lf_level(cpi, cm->filter_level); + vp8_loop_filter_frame(cm, &cpi->mb.e_mbd, cm->filter_level); + cm->last_filter_type = cm->filter_type; + cm->last_sharpness_level = cm->sharpness_level; + } - vp8_yv12_extend_frame_borders_ptr(cm->frame_to_show); + /* Move storing frame_type out of the above loop since it is also + * needed in motion search besides loopfilter */ + cm->last_frame_type = cm->frame_type; - if (cpi->oxcf.error_resilient_mode == 1) - { - cm->refresh_entropy_probs = 0; - } + vp8_yv12_extend_frame_borders_ptr(cm->frame_to_show); - } -//#pragma omp section - { - // build the bitstream - vp8_pack_bitstream(cpi, dest, size); - } + if (cpi->oxcf.error_resilient_mode == 1) + { + cm->refresh_entropy_probs = 0; } + // build the bitstream + vp8_pack_bitstream(cpi, dest, size); + { YV12_BUFFER_CONFIG *lst_yv12 = &cm->yv12_fb[cm->lst_fb_idx]; YV12_BUFFER_CONFIG *new_yv12 = &cm->yv12_fb[cm->new_fb_idx]; diff --git a/vp8/encoder/quantize.c b/vp8/encoder/quantize.c index 02b9d7bd9..803e3a51d 100644 --- a/vp8/encoder/quantize.c +++ b/vp8/encoder/quantize.c @@ -14,7 +14,6 @@ #include "quantize.h" #include "vp8/common/entropy.h" -#include "vp8/common/predictdc.h" #define EXACT_QUANT diff --git a/vp8/encoder/temporal_filter.c b/vp8/encoder/temporal_filter.c index 9ff8887e5..0f8e654a0 100644 --- a/vp8/encoder/temporal_filter.c +++ b/vp8/encoder/temporal_filter.c @@ -29,7 +29,6 @@ #include "vp8/common/swapyv12buffer.h" #include "vp8/common/threading.h" #include "vpx_ports/vpx_timer.h" -#include "vp8/common/vpxerrors.h" #include <math.h> #include <limits.h> diff --git a/vp8/encoder/x86/temporal_filter_apply_sse2.asm b/vp8/encoder/x86/temporal_filter_apply_sse2.asm index f2adcccba..0127b012e 100644 --- a/vp8/encoder/x86/temporal_filter_apply_sse2.asm +++ b/vp8/encoder/x86/temporal_filter_apply_sse2.asm @@ -84,7 +84,7 @@ temporal_filter_apply_load_8: jmp temporal_filter_apply_load_finished temporal_filter_apply_load_16: - movdqu xmm0, [rsi] ; src (frame1) + movdqa xmm0, [rsi] ; src (frame1) lea rsi, [rsi + rbp] ; += stride movdqa xmm1, xmm0 punpcklbw xmm0, xmm7 ; src[ 0- 7] diff --git a/vp8/vp8_common.mk b/vp8/vp8_common.mk index 822af83a4..4daadee32 100644 --- a/vp8/vp8_common.mk +++ b/vp8/vp8_common.mk @@ -11,7 +11,6 @@ VP8_COMMON_SRCS-yes += vp8_common.mk VP8_COMMON_SRCS-yes += common/type_aliases.h VP8_COMMON_SRCS-yes += common/pragmas.h -VP8_COMMON_SRCS-yes += common/vpxerrors.h VP8_COMMON_SRCS-yes += common/ppflags.h VP8_COMMON_SRCS-yes += common/onyx.h VP8_COMMON_SRCS-yes += common/onyxd.h @@ -45,7 +44,6 @@ VP8_COMMON_SRCS-yes += common/loopfilter.h VP8_COMMON_SRCS-yes += common/modecont.h VP8_COMMON_SRCS-yes += common/mv.h VP8_COMMON_SRCS-yes += common/onyxc_int.h -VP8_COMMON_SRCS-yes += common/predictdc.h VP8_COMMON_SRCS-yes += common/quant_common.h VP8_COMMON_SRCS-yes += common/recon.h VP8_COMMON_SRCS-yes += common/reconinter.h @@ -63,7 +61,6 @@ VP8_COMMON_SRCS-yes += common/loopfilter_filters.c VP8_COMMON_SRCS-yes += common/mbpitch.c VP8_COMMON_SRCS-yes += common/modecont.c VP8_COMMON_SRCS-yes += common/modecontext.c -VP8_COMMON_SRCS-yes += common/predictdc.c VP8_COMMON_SRCS-yes += common/quant_common.c VP8_COMMON_SRCS-yes += common/recon.c VP8_COMMON_SRCS-yes += common/reconinter.c |