diff options
Diffstat (limited to 'vp8')
-rw-r--r-- | vp8/common/alloccommon.c | 18 | ||||
-rw-r--r-- | vp8/common/entropy.c | 6 | ||||
-rw-r--r-- | vp8/common/entropy.h | 4 | ||||
-rw-r--r-- | vp8/common/onyxc_int.h | 1 | ||||
-rw-r--r-- | vp8/common/reconintra4x4.c | 16 | ||||
-rw-r--r-- | vp8/decoder/detokenize.c | 24 | ||||
-rw-r--r-- | vp8/decoder/onyxd_int.h | 6 | ||||
-rw-r--r-- | vp8/encoder/psnr.c | 2 | ||||
-rw-r--r-- | vp8/vp8_cx_iface.c | 56 |
9 files changed, 94 insertions, 39 deletions
diff --git a/vp8/common/alloccommon.c b/vp8/common/alloccommon.c index 9dce8c8f6..5ab8e29ab 100644 --- a/vp8/common/alloccommon.c +++ b/vp8/common/alloccommon.c @@ -126,7 +126,16 @@ int vp8_alloc_frame_buffers(VP8_COMMON *oci, int width, int height) } void vp8_setup_version(VP8_COMMON *cm) { - switch (cm->version) + if (cm->version & 0x4) + { + if (!CONFIG_EXPERIMENTAL) + vpx_internal_error(&cm->error, VPX_CODEC_UNSUP_BITSTREAM, + "Bitstream was created by an experimental " + "encoder"); + cm->experimental = 1; + } + + switch (cm->version & 0x3) { case 0: cm->no_lpf = 0; @@ -152,13 +161,6 @@ void vp8_setup_version(VP8_COMMON *cm) cm->use_bilinear_mc_filter = 1; cm->full_pixel = 1; break; - default: - /*4,5,6,7 are reserved for future use*/ - cm->no_lpf = 0; - cm->simpler_lpf = 0; - cm->use_bilinear_mc_filter = 0; - cm->full_pixel = 0; - break; } } void vp8_create_common(VP8_COMMON *oci) diff --git a/vp8/common/entropy.c b/vp8/common/entropy.c index a1fe4f4ab..219483289 100644 --- a/vp8/common/entropy.c +++ b/vp8/common/entropy.c @@ -76,7 +76,7 @@ static const Prob Pcat3[] = { 173, 148, 140}; static const Prob Pcat4[] = { 176, 155, 140, 135}; static const Prob Pcat5[] = { 180, 157, 141, 134, 130}; static const Prob Pcat6[] = -{ 254, 254, 243, 230, 196, 177, 153, 140, 133, 130, 129}; +{ 254, 254, 252, 249, 243, 230, 196, 177, 153, 140, 133, 130, 129}; static vp8_tree_index cat1[2], cat2[4], cat3[6], cat4[8], cat5[10], cat6[22]; @@ -111,7 +111,7 @@ static void init_bit_trees() init_bit_tree(cat3, 3); init_bit_tree(cat4, 4); init_bit_tree(cat5, 5); - init_bit_tree(cat6, 11); + init_bit_tree(cat6, 13); } vp8_extra_bit_struct vp8_extra_bits[12] = @@ -126,7 +126,7 @@ vp8_extra_bit_struct vp8_extra_bits[12] = { cat3, Pcat3, 3, 11}, { cat4, Pcat4, 4, 19}, { cat5, Pcat5, 5, 35}, - { cat6, Pcat6, 11, 67}, + { cat6, Pcat6, 13, 67}, { 0, 0, 0, 0} }; #include "defaultcoefcounts.h" diff --git a/vp8/common/entropy.h b/vp8/common/entropy.h index d174e45b9..77f2673aa 100644 --- a/vp8/common/entropy.h +++ b/vp8/common/entropy.h @@ -27,7 +27,7 @@ #define DCT_VAL_CATEGORY3 7 /* 11-18 Extra Bits 3+1 */ #define DCT_VAL_CATEGORY4 8 /* 19-34 Extra Bits 4+1 */ #define DCT_VAL_CATEGORY5 9 /* 35-66 Extra Bits 5+1 */ -#define DCT_VAL_CATEGORY6 10 /* 67+ Extra Bits 11+1 */ +#define DCT_VAL_CATEGORY6 10 /* 67+ Extra Bits 13+1 */ #define DCT_EOB_TOKEN 11 /* EOB Extra Bits 0+0 */ #define vp8_coef_tokens 12 @@ -51,7 +51,7 @@ extern vp8_extra_bit_struct vp8_extra_bits[12]; /* indexed by token value */ #define PROB_UPDATE_BASELINE_COST 7 #define MAX_PROB 255 -#define DCT_MAX_VALUE 2048 +#define DCT_MAX_VALUE 8192 /* Coefficients are predicted via a 3-dimensional probability table. */ diff --git a/vp8/common/onyxc_int.h b/vp8/common/onyxc_int.h index e011ec99a..90d63e535 100644 --- a/vp8/common/onyxc_int.h +++ b/vp8/common/onyxc_int.h @@ -117,6 +117,7 @@ typedef struct VP8Common int mode_info_stride; /* profile settings */ + int experimental; int mb_no_coeff_skip; int no_lpf; int simpler_lpf; diff --git a/vp8/common/reconintra4x4.c b/vp8/common/reconintra4x4.c index db44fa190..d3d133836 100644 --- a/vp8/common/reconintra4x4.c +++ b/vp8/common/reconintra4x4.c @@ -81,10 +81,10 @@ void vp8_predict_intra4x4(BLOCKD *x, { unsigned int ap[4]; - ap[0] = (top_left + 2 * Above[0] + Above[1] + 2) >> 2; - ap[1] = (Above[0] + 2 * Above[1] + Above[2] + 2) >> 2; - ap[2] = (Above[1] + 2 * Above[2] + Above[3] + 2) >> 2; - ap[3] = (Above[2] + 2 * Above[3] + Above[4] + 2) >> 2; + ap[0] = Above[0]; + ap[1] = Above[1]; + ap[2] = Above[2]; + ap[3] = Above[3]; for (r = 0; r < 4; r++) { @@ -105,10 +105,10 @@ void vp8_predict_intra4x4(BLOCKD *x, { unsigned int lp[4]; - lp[0] = (top_left + 2 * Left[0] + Left[1] + 2) >> 2; - lp[1] = (Left[0] + 2 * Left[1] + Left[2] + 2) >> 2; - lp[2] = (Left[1] + 2 * Left[2] + Left[3] + 2) >> 2; - lp[3] = (Left[2] + 2 * Left[3] + Left[3] + 2) >> 2; + lp[0] = Left[0]; + lp[1] = Left[1]; + lp[2] = Left[2]; + lp[3] = Left[3]; for (r = 0; r < 4; r++) { diff --git a/vp8/decoder/detokenize.c b/vp8/decoder/detokenize.c index 7d013d240..1fdfdb783 100644 --- a/vp8/decoder/detokenize.c +++ b/vp8/decoder/detokenize.c @@ -38,23 +38,23 @@ typedef struct { INT16 min_val; INT16 Length; - UINT8 Probs[12]; + UINT8 Probs[14]; } TOKENEXTRABITS; */ DECLARE_ALIGNED(16, static const TOKENEXTRABITS, vp8d_token_extra_bits2[MAX_ENTROPY_TOKENS]) = { - { 0, -1, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, /* ZERO_TOKEN */ - { 1, 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, /* ONE_TOKEN */ - { 2, 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, /* TWO_TOKEN */ - { 3, 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, /* THREE_TOKEN */ - { 4, 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, /* FOUR_TOKEN */ - { 5, 0, { 159, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, /* DCT_VAL_CATEGORY1 */ - { 7, 1, { 145, 165, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, /* DCT_VAL_CATEGORY2 */ - { 11, 2, { 140, 148, 173, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, /* DCT_VAL_CATEGORY3 */ - { 19, 3, { 135, 140, 155, 176, 0, 0, 0, 0, 0, 0, 0, 0 } }, /* DCT_VAL_CATEGORY4 */ - { 35, 4, { 130, 134, 141, 157, 180, 0, 0, 0, 0, 0, 0, 0 } }, /* DCT_VAL_CATEGORY5 */ - { 67, 10, { 129, 130, 133, 140, 153, 177, 196, 230, 243, 254, 254, 0 } }, /* DCT_VAL_CATEGORY6 */ + { 0, -1, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, /* ZERO_TOKEN */ + { 1, 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, /* ONE_TOKEN */ + { 2, 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, /* TWO_TOKEN */ + { 3, 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, /* THREE_TOKEN */ + { 4, 0, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, /* FOUR_TOKEN */ + { 5, 0, { 159, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, /* DCT_VAL_CATEGORY1 */ + { 7, 1, { 145, 165, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, /* DCT_VAL_CATEGORY2 */ + { 11, 2, { 140, 148, 173, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, /* DCT_VAL_CATEGORY3 */ + { 19, 3, { 135, 140, 155, 176, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, /* DCT_VAL_CATEGORY4 */ + { 35, 4, { 130, 134, 141, 157, 180, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, /* DCT_VAL_CATEGORY5 */ + { 67, 12, { 129, 130, 133, 140, 153, 177, 196, 230, 243, 249, 252, 254, 254, 0 } }, /* DCT_VAL_CATEGORY6 */ { 0, -1, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }, /* EOB TOKEN */ }; diff --git a/vp8/decoder/onyxd_int.h b/vp8/decoder/onyxd_int.h index 7593edf27..5ac032b8b 100644 --- a/vp8/decoder/onyxd_int.h +++ b/vp8/decoder/onyxd_int.h @@ -41,9 +41,9 @@ typedef struct typedef struct { - INT16 min_val; - INT16 Length; - UINT8 Probs[12]; + INT16 min_val; + INT16 Length; + UINT8 Probs[14]; } TOKENEXTRABITS; typedef struct diff --git a/vp8/encoder/psnr.c b/vp8/encoder/psnr.c index dc2a03b69..ff0222e2d 100644 --- a/vp8/encoder/psnr.c +++ b/vp8/encoder/psnr.c @@ -13,7 +13,7 @@ #include "math.h" #include "systemdependent.h" /* for vp8_clear_system_state() */ -#define MAX_PSNR 60 +#define MAX_PSNR 100 double vp8_mse2psnr(double Samples, double Peak, double Mse) { diff --git a/vp8/vp8_cx_iface.c b/vp8/vp8_cx_iface.c index 903c56c88..6eefdee70 100644 --- a/vp8/vp8_cx_iface.c +++ b/vp8/vp8_cx_iface.c @@ -37,6 +37,7 @@ struct vp8_extracfg unsigned int arnr_max_frames; /* alt_ref Noise Reduction Max Frame Count */ unsigned int arnr_strength; /* alt_ref Noise Reduction Strength */ unsigned int arnr_type; /* alt_ref filter type */ + unsigned int experimental; vp8e_tuning tuning; unsigned int cq_level; /* constrained quality level */ @@ -69,6 +70,7 @@ static const struct extraconfig_map extracfg_map[] = 0, /* arnr_max_frames */ 3, /* arnr_strength */ 3, /* arnr_type*/ + 0, /* experimental mode */ 0, /* tuning*/ 10, /* cq_level */ } @@ -250,7 +252,8 @@ static vpx_codec_err_t set_vp8e_config(VP8_CONFIG *oxcf, struct vp8_extracfg vp8_cfg) { oxcf->multi_threaded = cfg.g_threads; - oxcf->Version = cfg.g_profile; + oxcf->Version = cfg.g_profile; + oxcf->Version |= vp8_cfg.experimental? 0x4 : 0; oxcf->Width = cfg.g_w; oxcf->Height = cfg.g_h; @@ -479,7 +482,10 @@ static vpx_codec_err_t set_param(vpx_codec_alg_priv_t *ctx, return res; #undef MAP } -static vpx_codec_err_t vp8e_init(vpx_codec_ctx_t *ctx) + + +static vpx_codec_err_t vp8e_common_init(vpx_codec_ctx_t *ctx, + int experimental) { vpx_codec_err_t res = VPX_DEC_OK; struct vpx_codec_alg_priv *priv; @@ -521,6 +527,7 @@ static vpx_codec_err_t vp8e_init(vpx_codec_ctx_t *ctx) priv->vp8_cfg = extracfg_map[i].cfg; priv->vp8_cfg.pkt_list = &priv->pkt_list.head; + priv->vp8_cfg.experimental = experimental; priv->cx_data_sz = priv->cfg.g_w * priv->cfg.g_h * 3 / 2 * 2; @@ -549,6 +556,21 @@ static vpx_codec_err_t vp8e_init(vpx_codec_ctx_t *ctx) return res; } + +static vpx_codec_err_t vp8e_init(vpx_codec_ctx_t *ctx) +{ + return vp8e_common_init(ctx, 0); +} + + +#if CONFIG_EXPERIMENTAL +static vpx_codec_err_t vp8e_exp_init(vpx_codec_ctx_t *ctx) +{ + return vp8e_common_init(ctx, 1); +} +#endif + + static vpx_codec_err_t vp8e_destroy(vpx_codec_alg_priv_t *ctx) { @@ -1137,6 +1159,36 @@ CODEC_INTERFACE(vpx_codec_vp8_cx) = }; +#if CONFIG_EXPERIMENTAL +vpx_codec_iface_t vpx_codec_vp8x_cx_algo = +{ + "VP8 Experimental Encoder" VERSION_STRING, + VPX_CODEC_INTERNAL_ABI_VERSION, + VPX_CODEC_CAP_ENCODER | VPX_CODEC_CAP_PSNR, + /* vpx_codec_caps_t caps; */ + vp8e_exp_init, /* vpx_codec_init_fn_t init; */ + vp8e_destroy, /* vpx_codec_destroy_fn_t destroy; */ + vp8e_ctf_maps, /* vpx_codec_ctrl_fn_map_t *ctrl_maps; */ + NOT_IMPLEMENTED, /* vpx_codec_get_mmap_fn_t get_mmap; */ + NOT_IMPLEMENTED, /* vpx_codec_set_mmap_fn_t set_mmap; */ + { + NOT_IMPLEMENTED, /* vpx_codec_peek_si_fn_t peek_si; */ + NOT_IMPLEMENTED, /* vpx_codec_get_si_fn_t get_si; */ + NOT_IMPLEMENTED, /* vpx_codec_decode_fn_t decode; */ + NOT_IMPLEMENTED, /* vpx_codec_frame_get_fn_t frame_get; */ + }, + { + vp8e_usage_cfg_map, /* vpx_codec_enc_cfg_map_t peek_si; */ + vp8e_encode, /* vpx_codec_encode_fn_t encode; */ + vp8e_get_cxdata, /* vpx_codec_get_cx_data_fn_t frame_get; */ + vp8e_set_config, + NOT_IMPLEMENTED, + vp8e_get_preview, + } /* encoder functions */ +}; +#endif + + /* * BEGIN BACKWARDS COMPATIBILITY SHIM. */ |