From: Ronald S. Bultje Date: Tue, 20 Oct 2015 15:56:56 +0000 (+0000) Subject: Merge "vp10: allow MV refs to point outside visible image." X-Git-Tag: v1.5.0~25 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1a645957804a8d090981d13e99897501409bda8f;hp=dea998997f46a3a15e07284452bd1d7407912bb4;p=platform%2Fupstream%2Flibvpx.git Merge "vp10: allow MV refs to point outside visible image." --- diff --git a/test/vp9_encoder_parms_get_to_decoder.cc b/test/vp9_encoder_parms_get_to_decoder.cc index 0984e6a..6dc7d2f 100644 --- a/test/vp9_encoder_parms_get_to_decoder.cc +++ b/test/vp9_encoder_parms_get_to_decoder.cc @@ -40,17 +40,17 @@ struct EncodeParameters { int32_t lossless; int32_t error_resilient; int32_t frame_parallel; - int32_t color_range; + vpx_color_range_t color_range; vpx_color_space_t cs; int render_size[2]; // TODO(JBB): quantizers / bitrate }; const EncodeParameters kVP9EncodeParameterSet[] = { - {0, 0, 0, 1, 0, 0, VPX_CS_BT_601}, - {0, 0, 0, 0, 0, 1, VPX_CS_BT_709}, - {0, 0, 1, 0, 0, 1, VPX_CS_BT_2020}, - {0, 2, 0, 0, 1, 0, VPX_CS_UNKNOWN, { 640, 480 }}, + {0, 0, 0, 1, 0, VPX_CR_STUDIO_RANGE, VPX_CS_BT_601}, + {0, 0, 0, 0, 0, VPX_CR_FULL_RANGE, VPX_CS_BT_709}, + {0, 0, 1, 0, 0, VPX_CR_FULL_RANGE, VPX_CS_BT_2020}, + {0, 2, 0, 0, 1, VPX_CR_STUDIO_RANGE, VPX_CS_UNKNOWN, { 640, 480 }}, // TODO(JBB): Test profiles (requires more work). }; diff --git a/vp10/vp10_cx_iface.c b/vp10/vp10_cx_iface.c index 409ed1c..6227708 100644 --- a/vp10/vp10_cx_iface.c +++ b/vp10/vp10_cx_iface.c @@ -1154,30 +1154,6 @@ static vpx_image_t *encoder_get_preview(vpx_codec_alg_priv_t *ctx) { } } -static vpx_codec_err_t ctrl_update_entropy(vpx_codec_alg_priv_t *ctx, - va_list args) { - const int update = va_arg(args, int); - - vp10_update_entropy(ctx->cpi, update); - return VPX_CODEC_OK; -} - -static vpx_codec_err_t ctrl_update_reference(vpx_codec_alg_priv_t *ctx, - va_list args) { - const int ref_frame_flags = va_arg(args, int); - - vp10_update_reference(ctx->cpi, ref_frame_flags); - return VPX_CODEC_OK; -} - -static vpx_codec_err_t ctrl_use_reference(vpx_codec_alg_priv_t *ctx, - va_list args) { - const int reference_flag = va_arg(args, int); - - vp10_use_as_reference(ctx->cpi, reference_flag); - return VPX_CODEC_OK; -} - static vpx_codec_err_t ctrl_set_roi_map(vpx_codec_alg_priv_t *ctx, va_list args) { (void)ctx; @@ -1274,9 +1250,6 @@ static vpx_codec_err_t ctrl_set_render_size(vpx_codec_alg_priv_t *ctx, static vpx_codec_ctrl_fn_map_t encoder_ctrl_maps[] = { {VP8_COPY_REFERENCE, ctrl_copy_reference}, - {VP8E_UPD_ENTROPY, ctrl_update_entropy}, - {VP8E_UPD_REFERENCE, ctrl_update_reference}, - {VP8E_USE_REFERENCE, ctrl_use_reference}, // Setters {VP8_SET_REFERENCE, ctrl_set_reference}, diff --git a/vp8/vp8_cx_iface.c b/vp8/vp8_cx_iface.c index 80ea6b4..c125ae8 100644 --- a/vp8/vp8_cx_iface.c +++ b/vp8/vp8_cx_iface.c @@ -1277,9 +1277,6 @@ static vpx_codec_ctrl_fn_map_t vp8e_ctf_maps[] = {VP8_SET_REFERENCE, vp8e_set_reference}, {VP8_COPY_REFERENCE, vp8e_get_reference}, {VP8_SET_POSTPROC, vp8e_set_previewpp}, - {VP8E_UPD_ENTROPY, vp8e_update_entropy}, - {VP8E_UPD_REFERENCE, vp8e_update_reference}, - {VP8E_USE_REFERENCE, vp8e_use_reference}, {VP8E_SET_FRAME_FLAGS, vp8e_set_frame_flags}, {VP8E_SET_TEMPORAL_LAYER_ID, vp8e_set_temporal_layer_id}, {VP8E_SET_ROI_MAP, vp8e_set_roi_map}, diff --git a/vp9/common/vp9_onyxc_int.h b/vp9/common/vp9_onyxc_int.h index 90bde55..ceffded 100644 --- a/vp9/common/vp9_onyxc_int.h +++ b/vp9/common/vp9_onyxc_int.h @@ -112,7 +112,7 @@ typedef struct BufferPool { typedef struct VP9Common { struct vpx_internal_error_info error; vpx_color_space_t color_space; - int color_range; + vpx_color_range_t color_range; int width; int height; int render_width; diff --git a/vp9/decoder/vp9_decodeframe.c b/vp9/decoder/vp9_decodeframe.c index 8f20686..f191663 100644 --- a/vp9/decoder/vp9_decodeframe.c +++ b/vp9/decoder/vp9_decodeframe.c @@ -1795,8 +1795,7 @@ static void read_bitdepth_colorspace_sampling( } cm->color_space = vpx_rb_read_literal(rb, 3); if (cm->color_space != VPX_CS_SRGB) { - // [16,235] (including xvycc) vs [0,255] range - cm->color_range = vpx_rb_read_bit(rb); + cm->color_range = (vpx_color_range_t)vpx_rb_read_bit(rb); if (cm->profile == PROFILE_1 || cm->profile == PROFILE_3) { cm->subsampling_x = vpx_rb_read_bit(rb); cm->subsampling_y = vpx_rb_read_bit(rb); @@ -1810,7 +1809,7 @@ static void read_bitdepth_colorspace_sampling( cm->subsampling_y = cm->subsampling_x = 1; } } else { - cm->color_range = 1; + cm->color_range = VPX_CR_FULL_RANGE; if (cm->profile == PROFILE_1 || cm->profile == PROFILE_3) { // Note if colorspace is SRGB then 4:4:4 chroma sampling is assumed. // 4:2:2 or 4:4:0 chroma sampling is not allowed. @@ -1916,7 +1915,7 @@ static size_t read_uncompressed_header(VP9Decoder *pbi, // specifies that the default color format should be YUV 4:2:0 in this // case (normative). cm->color_space = VPX_CS_BT_601; - cm->color_range = 0; + cm->color_range = VPX_CR_STUDIO_RANGE; cm->subsampling_y = cm->subsampling_x = 1; cm->bit_depth = VPX_BITS_8; #if CONFIG_VP9_HIGHBITDEPTH diff --git a/vp9/encoder/vp9_encoder.h b/vp9/encoder/vp9_encoder.h index 174e2b4..159c03a 100644 --- a/vp9/encoder/vp9_encoder.h +++ b/vp9/encoder/vp9_encoder.h @@ -238,7 +238,7 @@ typedef struct VP9EncoderConfig { int use_highbitdepth; #endif vpx_color_space_t color_space; - int color_range; + vpx_color_range_t color_range; int render_width; int render_height; VP9E_TEMPORAL_LAYERING_MODE temporal_layering_mode; diff --git a/vp9/vp9_cx_iface.c b/vp9/vp9_cx_iface.c index e36a044..6ccba0f 100644 --- a/vp9/vp9_cx_iface.c +++ b/vp9/vp9_cx_iface.c @@ -45,7 +45,7 @@ struct vp9_extracfg { vpx_bit_depth_t bit_depth; vp9e_tune_content content; vpx_color_space_t color_space; - int color_range; + vpx_color_range_t color_range; int render_width; int render_height; }; @@ -327,7 +327,8 @@ static vpx_codec_err_t validate_config(vpx_codec_alg_priv_t *ctx, ERROR("Codec bit-depth 8 not supported in profile > 1"); } RANGE_CHECK(extra_cfg, color_space, VPX_CS_UNKNOWN, VPX_CS_SRGB); - RANGE_CHECK(extra_cfg, color_range, 0, 2); + RANGE_CHECK(extra_cfg, color_range, + VPX_CR_STUDIO_RANGE, VPX_CR_FULL_RANGE); return VPX_CODEC_OK; } @@ -1266,30 +1267,6 @@ static vpx_image_t *encoder_get_preview(vpx_codec_alg_priv_t *ctx) { } } -static vpx_codec_err_t ctrl_update_entropy(vpx_codec_alg_priv_t *ctx, - va_list args) { - const int update = va_arg(args, int); - - vp9_update_entropy(ctx->cpi, update); - return VPX_CODEC_OK; -} - -static vpx_codec_err_t ctrl_update_reference(vpx_codec_alg_priv_t *ctx, - va_list args) { - const int ref_frame_flags = va_arg(args, int); - - vp9_update_reference(ctx->cpi, ref_frame_flags); - return VPX_CODEC_OK; -} - -static vpx_codec_err_t ctrl_use_reference(vpx_codec_alg_priv_t *ctx, - va_list args) { - const int reference_flag = va_arg(args, int); - - vp9_use_as_reference(ctx->cpi, reference_flag); - return VPX_CODEC_OK; -} - static vpx_codec_err_t ctrl_set_roi_map(vpx_codec_alg_priv_t *ctx, va_list args) { (void)ctx; @@ -1482,9 +1459,6 @@ static vpx_codec_err_t ctrl_set_render_size(vpx_codec_alg_priv_t *ctx, static vpx_codec_ctrl_fn_map_t encoder_ctrl_maps[] = { {VP8_COPY_REFERENCE, ctrl_copy_reference}, - {VP8E_UPD_ENTROPY, ctrl_update_entropy}, - {VP8E_UPD_REFERENCE, ctrl_update_reference}, - {VP8E_USE_REFERENCE, ctrl_use_reference}, // Setters {VP8_SET_REFERENCE, ctrl_set_reference}, diff --git a/vpx/vp8cx.h b/vpx/vp8cx.h index 287ecfe..bd99c6d 100644 --- a/vpx/vp8cx.h +++ b/vpx/vp8cx.h @@ -141,29 +141,11 @@ extern vpx_codec_iface_t *vpx_codec_vp10_cx(void); * \sa #vpx_codec_control */ enum vp8e_enc_control_id { - /*!\brief Codec control function to set mode of entropy update in encoder. - * - * Supported in codecs: VP8, VP9 - */ - VP8E_UPD_ENTROPY = 5, - - /*!\brief Codec control function to set reference update mode in encoder. - * - * Supported in codecs: VP8, VP9 - */ - VP8E_UPD_REFERENCE, - - /*!\brief Codec control function to set which reference frame encoder can use. - * - * Supported in codecs: VP8, VP9 - */ - VP8E_USE_REFERENCE, - /*!\brief Codec control function to pass an ROI map to encoder. * * Supported in codecs: VP8, VP9 */ - VP8E_SET_ROI_MAP, + VP8E_SET_ROI_MAP = 8, /*!\brief Codec control function to pass an Active map to encoder. * @@ -721,17 +703,6 @@ typedef struct vpx_svc_ref_frame_config { * */ - -/* These controls have been deprecated in favor of the flags parameter to - * vpx_codec_encode(). See the definition of VP8_EFLAG_* above. - */ -VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_UPD_ENTROPY, int) -#define VPX_CTRL_VP8E_UPD_ENTROPY -VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_UPD_REFERENCE, int) -#define VPX_CTRL_VP8E_UPD_REFERENCE -VPX_CTRL_USE_TYPE_DEPRECATED(VP8E_USE_REFERENCE, int) -#define VPX_CTRL_VP8E_USE_REFERENCE - VPX_CTRL_USE_TYPE(VP8E_SET_FRAME_FLAGS, int) #define VPX_CTRL_VP8E_SET_FRAME_FLAGS VPX_CTRL_USE_TYPE(VP8E_SET_TEMPORAL_LAYER_ID, int) diff --git a/vpx/vpx_image.h b/vpx/vpx_image.h index 5110059..e9e952c 100644 --- a/vpx/vpx_image.h +++ b/vpx/vpx_image.h @@ -78,11 +78,17 @@ extern "C" { VPX_CS_SRGB = 7 /**< sRGB */ } vpx_color_space_t; /**< alias for enum vpx_color_space */ + /*!\brief List of supported color range */ + typedef enum vpx_color_range { + VPX_CR_STUDIO_RANGE = 0, /**< Y [16..235], UV [16..240] */ + VPX_CR_FULL_RANGE = 1 /**< YUV/RGB [0..255] */ + } vpx_color_range_t; /**< alias for enum vpx_color_range */ + /**\brief Image Descriptor */ typedef struct vpx_image { vpx_img_fmt_t fmt; /**< Image Format */ vpx_color_space_t cs; /**< Color Space */ - int range; /**< Limited (0) vs. Full-range (1) sample data */ + vpx_color_range_t range; /**< Color Range */ /* Image storage dimensions */ unsigned int w; /**< Stored image width */ diff --git a/vpx_scale/yv12config.h b/vpx_scale/yv12config.h index 3a04452..37b255d 100644 --- a/vpx_scale/yv12config.h +++ b/vpx_scale/yv12config.h @@ -56,7 +56,7 @@ typedef struct yv12_buffer_config { int subsampling_y; unsigned int bit_depth; vpx_color_space_t color_space; - int color_range; + vpx_color_range_t color_range; int render_width; int render_height;