diff options
author | James Zern <jzern@google.com> | 2015-09-15 23:14:34 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-09-15 23:14:34 +0000 |
commit | c667593e1ec6f43f9655ef5b41819df2e988dcbb (patch) | |
tree | f00c43a18718826dafe3c5398753960e5015a05f | |
parent | 9c82fc457e878d707c4ead686f2b6bb6be213b7f (diff) | |
parent | ba317bc9dc1e3b03793689a3f2af622a018a9eeb (diff) | |
download | libvpx-c667593e1ec6f43f9655ef5b41819df2e988dcbb.tar libvpx-c667593e1ec6f43f9655ef5b41819df2e988dcbb.tar.gz libvpx-c667593e1ec6f43f9655ef5b41819df2e988dcbb.tar.bz2 libvpx-c667593e1ec6f43f9655ef5b41819df2e988dcbb.zip |
Merge changes from topic 'fix-vp9-bitstream-test'
* changes:
vp9_encoder_parms_get_to_decoder: cosmetics
vp9...parms_get_to_decoder: remove unneeded func
vp9...parms_get_to_decoder: fix EXPECT param order
vp9_encoder_parms_get_to_decoder: delete dead code
fix BitstreamParms test
vp9_encoder_parms_get_to_decoder: remove vp10
yuvconfig2image(): add explicit cast to avoid conv warning
vp9/10 decoder_init: add missing alloc cast
vp9/10: set color_space on preview frame
vp10: add extern "C" to headers
vp9: add extern "C" to headers
-rw-r--r-- | test/vp9_encoder_parms_get_to_decoder.cc | 125 | ||||
-rw-r--r-- | vp10/common/thread_common.h | 8 | ||||
-rw-r--r-- | vp10/decoder/dthread.h | 8 | ||||
-rw-r--r-- | vp10/encoder/context_tree.h | 8 | ||||
-rw-r--r-- | vp10/encoder/encoder.c | 1 | ||||
-rw-r--r-- | vp10/encoder/ethread.h | 8 | ||||
-rw-r--r-- | vp10/encoder/resize.h | 9 | ||||
-rw-r--r-- | vp10/vp10_dx_iface.c | 3 | ||||
-rw-r--r-- | vp10/vp10_iface_common.h | 2 | ||||
-rw-r--r-- | vp9/common/vp9_thread_common.h | 8 | ||||
-rw-r--r-- | vp9/decoder/vp9_dthread.h | 8 | ||||
-rw-r--r-- | vp9/encoder/vp9_context_tree.h | 8 | ||||
-rw-r--r-- | vp9/encoder/vp9_encoder.c | 1 | ||||
-rw-r--r-- | vp9/encoder/vp9_ethread.h | 8 | ||||
-rw-r--r-- | vp9/encoder/vp9_resize.h | 9 | ||||
-rw-r--r-- | vp9/vp9_dx_iface.c | 3 | ||||
-rw-r--r-- | vp9/vp9_iface_common.h | 2 |
17 files changed, 126 insertions, 93 deletions
diff --git a/test/vp9_encoder_parms_get_to_decoder.cc b/test/vp9_encoder_parms_get_to_decoder.cc index a02070e43..1ceff1e7e 100644 --- a/test/vp9_encoder_parms_get_to_decoder.cc +++ b/test/vp9_encoder_parms_get_to_decoder.cc @@ -14,38 +14,12 @@ #include "test/encode_test_driver.h" #include "test/util.h" #include "test/y4m_video_source.h" -#include "test/yuv_video_source.h" #include "vp9/decoder/vp9_decoder.h" -typedef vpx_codec_stream_info_t vp9_stream_info_t; -struct vpx_codec_alg_priv { - vpx_codec_priv_t base; - vpx_codec_dec_cfg_t cfg; - vp9_stream_info_t si; - struct VP9Decoder *pbi; - int postproc_cfg_set; - vp8_postproc_cfg_t postproc_cfg; - vpx_decrypt_cb decrypt_cb; - void *decrypt_state; - vpx_image_t img; - int img_avail; - int flushed; - int invert_tile_order; - int frame_parallel_decode; - - // External frame buffer info to save for VP9 common. - void *ext_priv; // Private data associated with the external frame buffers. - vpx_get_frame_buffer_cb_fn_t get_ext_fb_cb; - vpx_release_frame_buffer_cb_fn_t release_ext_fb_cb; -}; - -static vpx_codec_alg_priv_t *get_alg_priv(vpx_codec_ctx_t *ctx) { - return (vpx_codec_alg_priv_t *)ctx->priv; -} +#include "vp9/vp9_dx_iface.c" namespace { -const unsigned int kFramerate = 50; const int kCpuUsed = 2; struct EncodePerfTestVideo { @@ -71,30 +45,20 @@ struct EncodeParameters { }; const EncodeParameters kVP9EncodeParameterSet[] = { - {0, 0, 0, 1, 0, VPX_CS_BT_601}, - {0, 0, 0, 0, 0, VPX_CS_BT_709}, - {0, 0, 1, 0, 0, VPX_CS_BT_2020}, - {0, 2, 0, 0, 1, VPX_CS_UNKNOWN}, - // TODO(JBB): Test profiles (requires more work). + {0, 0, 0, 1, 0, VPX_CS_BT_601}, + {0, 0, 0, 0, 0, VPX_CS_BT_709}, + {0, 0, 1, 0, 0, VPX_CS_BT_2020}, + {0, 2, 0, 0, 1, VPX_CS_UNKNOWN}, + // TODO(JBB): Test profiles (requires more work). }; -int is_extension_y4m(const char *filename) { - const char *dot = strrchr(filename, '.'); - if (!dot || dot == filename) - return 0; - else - return !strcmp(dot, ".y4m"); -} - class VpxEncoderParmsGetToDecoder : public ::libvpx_test::EncoderTest, - public ::libvpx_test::CodecTestWith2Params<EncodeParameters, \ + public ::libvpx_test::CodecTestWith2Params<EncodeParameters, EncodePerfTestVideo> { protected: VpxEncoderParmsGetToDecoder() - : EncoderTest(GET_PARAM(0)), - encode_parms(GET_PARAM(1)) { - } + : EncoderTest(GET_PARAM(0)), encode_parms(GET_PARAM(1)) {} virtual ~VpxEncoderParmsGetToDecoder() {} @@ -126,33 +90,33 @@ class VpxEncoderParmsGetToDecoder } virtual bool HandleDecodeResult(const vpx_codec_err_t res_dec, - const libvpx_test::VideoSource& video, + const libvpx_test::VideoSource &video, libvpx_test::Decoder *decoder) { - vpx_codec_ctx_t* vp9_decoder = decoder->GetDecoder(); - vpx_codec_alg_priv_t* priv = - (vpx_codec_alg_priv_t*) get_alg_priv(vp9_decoder); - - VP9Decoder* pbi = priv->pbi; - VP9_COMMON* common = &pbi->common; + vpx_codec_ctx_t *const vp9_decoder = decoder->GetDecoder(); + vpx_codec_alg_priv_t *const priv = + reinterpret_cast<vpx_codec_alg_priv_t *>(vp9_decoder->priv); + FrameWorkerData *const worker_data = + reinterpret_cast<FrameWorkerData *>(priv->frame_workers[0].data1); + VP9_COMMON *const common = &worker_data->pbi->common; if (encode_parms.lossless) { - EXPECT_EQ(common->base_qindex, 0); - EXPECT_EQ(common->y_dc_delta_q, 0); - EXPECT_EQ(common->uv_dc_delta_q, 0); - EXPECT_EQ(common->uv_ac_delta_q, 0); - EXPECT_EQ(common->tx_mode, ONLY_4X4); + EXPECT_EQ(0, common->base_qindex); + EXPECT_EQ(0, common->y_dc_delta_q); + EXPECT_EQ(0, common->uv_dc_delta_q); + EXPECT_EQ(0, common->uv_ac_delta_q); + EXPECT_EQ(ONLY_4X4, common->tx_mode); } - EXPECT_EQ(common->error_resilient_mode, encode_parms.error_resilient); + EXPECT_EQ(encode_parms.error_resilient, common->error_resilient_mode); if (encode_parms.error_resilient) { - EXPECT_EQ(common->frame_parallel_decoding_mode, 1); - EXPECT_EQ(common->use_prev_frame_mvs, 0); + EXPECT_EQ(1, common->frame_parallel_decoding_mode); + EXPECT_EQ(0, common->use_prev_frame_mvs); } else { - EXPECT_EQ(common->frame_parallel_decoding_mode, - encode_parms.frame_parallel); + EXPECT_EQ(encode_parms.frame_parallel, + common->frame_parallel_decoding_mode); } - EXPECT_EQ(common->color_space, encode_parms.cs); - EXPECT_EQ(common->log2_tile_cols, encode_parms.tile_cols); - EXPECT_EQ(common->log2_tile_rows, encode_parms.tile_rows); + EXPECT_EQ(encode_parms.cs, common->color_space); + EXPECT_EQ(encode_parms.tile_cols, common->log2_tile_cols); + EXPECT_EQ(encode_parms.tile_rows, common->log2_tile_rows); EXPECT_EQ(VPX_CODEC_OK, res_dec) << decoder->DecodeError(); return VPX_CODEC_OK == res_dec; @@ -164,35 +128,18 @@ class VpxEncoderParmsGetToDecoder EncodeParameters encode_parms; }; -// TODO(hkuang): This test conflicts with frame parallel decode. So disable it -// for now until fix. -TEST_P(VpxEncoderParmsGetToDecoder, DISABLED_BitstreamParms) { +TEST_P(VpxEncoderParmsGetToDecoder, BitstreamParms) { init_flags_ = VPX_CODEC_USE_PSNR; - libvpx_test::VideoSource *video; - if (is_extension_y4m(test_video_.name)) { - video = new libvpx_test::Y4mVideoSource(test_video_.name, - 0, test_video_.frames); - } else { - video = new libvpx_test::YUVVideoSource(test_video_.name, - VPX_IMG_FMT_I420, - test_video_.width, - test_video_.height, - kFramerate, 1, 0, - test_video_.frames); - } + libvpx_test::VideoSource *const video = + new libvpx_test::Y4mVideoSource(test_video_.name, 0, test_video_.frames); + ASSERT_TRUE(video != NULL); ASSERT_NO_FATAL_FAILURE(RunLoop(video)); - delete(video); + delete video; } -VP9_INSTANTIATE_TEST_CASE( - VpxEncoderParmsGetToDecoder, - ::testing::ValuesIn(kVP9EncodeParameterSet), - ::testing::ValuesIn(kVP9EncodePerfTestVectors)); - -VP10_INSTANTIATE_TEST_CASE( - VpxEncoderParmsGetToDecoder, - ::testing::ValuesIn(kVP9EncodeParameterSet), - ::testing::ValuesIn(kVP9EncodePerfTestVectors)); +VP9_INSTANTIATE_TEST_CASE(VpxEncoderParmsGetToDecoder, + ::testing::ValuesIn(kVP9EncodeParameterSet), + ::testing::ValuesIn(kVP9EncodePerfTestVectors)); } // namespace diff --git a/vp10/common/thread_common.h b/vp10/common/thread_common.h index 6388c7a28..a401ddcb2 100644 --- a/vp10/common/thread_common.h +++ b/vp10/common/thread_common.h @@ -14,6 +14,10 @@ #include "vp10/common/loopfilter.h" #include "vpx_util/vpx_thread.h" +#ifdef __cplusplus +extern "C" { +#endif + struct VP10Common; struct FRAME_COUNTS; @@ -54,4 +58,8 @@ void vp10_loop_filter_frame_mt(YV12_BUFFER_CONFIG *frame, void vp10_accumulate_frame_counts(struct VP10Common *cm, struct FRAME_COUNTS *counts, int is_dec); +#ifdef __cplusplus +} // extern "C" +#endif + #endif // VP10_COMMON_LOOPFILTER_THREAD_H_ diff --git a/vp10/decoder/dthread.h b/vp10/decoder/dthread.h index 7332aada2..1b0dc0191 100644 --- a/vp10/decoder/dthread.h +++ b/vp10/decoder/dthread.h @@ -15,6 +15,10 @@ #include "vpx_util/vpx_thread.h" #include "vpx/internal/vpx_codec_internal.h" +#ifdef __cplusplus +extern "C" { +#endif + struct VP10Common; struct VP10Decoder; @@ -63,4 +67,8 @@ void vp10_frameworker_broadcast(RefCntBuffer *const buf, int row); void vp10_frameworker_copy_context(VPxWorker *const dst_worker, VPxWorker *const src_worker); +#ifdef __cplusplus +} // extern "C" +#endif + #endif // VP10_DECODER_DTHREAD_H_ diff --git a/vp10/encoder/context_tree.h b/vp10/encoder/context_tree.h index 9310d1fc3..67a07cb50 100644 --- a/vp10/encoder/context_tree.h +++ b/vp10/encoder/context_tree.h @@ -14,6 +14,10 @@ #include "vp10/common/blockd.h" #include "vp10/encoder/block.h" +#ifdef __cplusplus +extern "C" { +#endif + struct VP10_COMP; struct VP10Common; struct ThreadData; @@ -84,4 +88,8 @@ typedef struct PC_TREE { void vp10_setup_pc_tree(struct VP10Common *cm, struct ThreadData *td); void vp10_free_pc_tree(struct ThreadData *td); +#ifdef __cplusplus +} // extern "C" +#endif + #endif /* VP10_ENCODER_CONTEXT_TREE_H_ */ diff --git a/vp10/encoder/encoder.c b/vp10/encoder/encoder.c index 06cce93c0..58c6423cb 100644 --- a/vp10/encoder/encoder.c +++ b/vp10/encoder/encoder.c @@ -3623,6 +3623,7 @@ static void encode_frame_to_data_rate(VP10_COMP *cpi, cpi->refresh_last_frame = 1; cm->frame_to_show = get_frame_new_buffer(cm); + cm->frame_to_show->color_space = cm->color_space; // Pick the loop filter level for the frame. loopfilter_frame(cpi, cm); diff --git a/vp10/encoder/ethread.h b/vp10/encoder/ethread.h index 997df0d04..d72816cd5 100644 --- a/vp10/encoder/ethread.h +++ b/vp10/encoder/ethread.h @@ -11,6 +11,10 @@ #ifndef VP10_ENCODER_ETHREAD_H_ #define VP10_ENCODER_ETHREAD_H_ +#ifdef __cplusplus +extern "C" { +#endif + struct VP10_COMP; struct ThreadData; @@ -22,4 +26,8 @@ typedef struct EncWorkerData { void vp10_encode_tiles_mt(struct VP10_COMP *cpi); +#ifdef __cplusplus +} // extern "C" +#endif + #endif // VP10_ENCODER_ETHREAD_H_ diff --git a/vp10/encoder/resize.h b/vp10/encoder/resize.h index 131fc80ca..bf6377097 100644 --- a/vp10/encoder/resize.h +++ b/vp10/encoder/resize.h @@ -14,6 +14,10 @@ #include <stdio.h> #include "vpx/vpx_integer.h" +#ifdef __cplusplus +extern "C" { +#endif + void vp10_resize_plane(const uint8_t *const input, int height, int width, @@ -121,4 +125,9 @@ void vp10_highbd_resize_frame444(const uint8_t *const y, int owidth, int bd); #endif // CONFIG_VP9_HIGHBITDEPTH + +#ifdef __cplusplus +} // extern "C" +#endif + #endif // VP10_ENCODER_RESIZE_H_ diff --git a/vp10/vp10_dx_iface.c b/vp10/vp10_dx_iface.c index e2feca7b9..a8f9aa351 100644 --- a/vp10/vp10_dx_iface.c +++ b/vp10/vp10_dx_iface.c @@ -88,7 +88,8 @@ static vpx_codec_err_t decoder_init(vpx_codec_ctx_t *ctx, (void)data; if (!ctx->priv) { - vpx_codec_alg_priv_t *const priv = vpx_calloc(1, sizeof(*priv)); + vpx_codec_alg_priv_t *const priv = + (vpx_codec_alg_priv_t *)vpx_calloc(1, sizeof(*priv)); if (priv == NULL) return VPX_CODEC_MEM_ERROR; diff --git a/vp10/vp10_iface_common.h b/vp10/vp10_iface_common.h index 4bc34372d..8e1bfc2bd 100644 --- a/vp10/vp10_iface_common.h +++ b/vp10/vp10_iface_common.h @@ -56,7 +56,7 @@ static void yuvconfig2image(vpx_image_t *img, const YV12_BUFFER_CONFIG *yv12, if (yv12->flags & YV12_FLAG_HIGHBITDEPTH) { // vpx_image_t uses byte strides and a pointer to the first byte // of the image. - img->fmt |= VPX_IMG_FMT_HIGHBITDEPTH; + img->fmt = (vpx_img_fmt_t)(img->fmt | VPX_IMG_FMT_HIGHBITDEPTH); img->bit_depth = yv12->bit_depth; img->planes[VPX_PLANE_Y] = (uint8_t*)CONVERT_TO_SHORTPTR(yv12->y_buffer); img->planes[VPX_PLANE_U] = (uint8_t*)CONVERT_TO_SHORTPTR(yv12->u_buffer); diff --git a/vp9/common/vp9_thread_common.h b/vp9/common/vp9_thread_common.h index 07af1bc4c..04666b62c 100644 --- a/vp9/common/vp9_thread_common.h +++ b/vp9/common/vp9_thread_common.h @@ -14,6 +14,10 @@ #include "vp9/common/vp9_loopfilter.h" #include "vpx_util/vpx_thread.h" +#ifdef __cplusplus +extern "C" { +#endif + struct VP9Common; struct FRAME_COUNTS; @@ -54,4 +58,8 @@ void vp9_loop_filter_frame_mt(YV12_BUFFER_CONFIG *frame, void vp9_accumulate_frame_counts(struct VP9Common *cm, struct FRAME_COUNTS *counts, int is_dec); +#ifdef __cplusplus +} // extern "C" +#endif + #endif // VP9_COMMON_VP9_LOOPFILTER_THREAD_H_ diff --git a/vp9/decoder/vp9_dthread.h b/vp9/decoder/vp9_dthread.h index f6cdccd9c..ba7c38a51 100644 --- a/vp9/decoder/vp9_dthread.h +++ b/vp9/decoder/vp9_dthread.h @@ -15,6 +15,10 @@ #include "vpx_util/vpx_thread.h" #include "vpx/internal/vpx_codec_internal.h" +#ifdef __cplusplus +extern "C" { +#endif + struct VP9Common; struct VP9Decoder; @@ -63,4 +67,8 @@ void vp9_frameworker_broadcast(RefCntBuffer *const buf, int row); void vp9_frameworker_copy_context(VPxWorker *const dst_worker, VPxWorker *const src_worker); +#ifdef __cplusplus +} // extern "C" +#endif + #endif // VP9_DECODER_VP9_DTHREAD_H_ diff --git a/vp9/encoder/vp9_context_tree.h b/vp9/encoder/vp9_context_tree.h index ac2449772..8e365ce33 100644 --- a/vp9/encoder/vp9_context_tree.h +++ b/vp9/encoder/vp9_context_tree.h @@ -14,6 +14,10 @@ #include "vp9/common/vp9_blockd.h" #include "vp9/encoder/vp9_block.h" +#ifdef __cplusplus +extern "C" { +#endif + struct VP9_COMP; struct VP9Common; struct ThreadData; @@ -84,4 +88,8 @@ typedef struct PC_TREE { void vp9_setup_pc_tree(struct VP9Common *cm, struct ThreadData *td); void vp9_free_pc_tree(struct ThreadData *td); +#ifdef __cplusplus +} // extern "C" +#endif + #endif /* VP9_ENCODER_VP9_CONTEXT_TREE_H_ */ diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 8e83903c6..60c6cec19 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -3816,6 +3816,7 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi, cpi->refresh_last_frame = 1; cm->frame_to_show = get_frame_new_buffer(cm); + cm->frame_to_show->color_space = cm->color_space; // Pick the loop filter level for the frame. loopfilter_frame(cpi, cm); diff --git a/vp9/encoder/vp9_ethread.h b/vp9/encoder/vp9_ethread.h index e87c50bc7..1efa4dcde 100644 --- a/vp9/encoder/vp9_ethread.h +++ b/vp9/encoder/vp9_ethread.h @@ -11,6 +11,10 @@ #ifndef VP9_ENCODER_VP9_ETHREAD_H_ #define VP9_ENCODER_VP9_ETHREAD_H_ +#ifdef __cplusplus +extern "C" { +#endif + struct VP9_COMP; struct ThreadData; @@ -22,4 +26,8 @@ typedef struct EncWorkerData { void vp9_encode_tiles_mt(struct VP9_COMP *cpi); +#ifdef __cplusplus +} // extern "C" +#endif + #endif // VP9_ENCODER_VP9_ETHREAD_H_ diff --git a/vp9/encoder/vp9_resize.h b/vp9/encoder/vp9_resize.h index 067af53f9..b5feb3860 100644 --- a/vp9/encoder/vp9_resize.h +++ b/vp9/encoder/vp9_resize.h @@ -14,6 +14,10 @@ #include <stdio.h> #include "vpx/vpx_integer.h" +#ifdef __cplusplus +extern "C" { +#endif + void vp9_resize_plane(const uint8_t *const input, int height, int width, @@ -121,4 +125,9 @@ void vp9_highbd_resize_frame444(const uint8_t *const y, int owidth, int bd); #endif // CONFIG_VP9_HIGHBITDEPTH + +#ifdef __cplusplus +} // extern "C" +#endif + #endif // VP9_ENCODER_VP9_RESIZE_H_ diff --git a/vp9/vp9_dx_iface.c b/vp9/vp9_dx_iface.c index 8119df85f..eb2371e2c 100644 --- a/vp9/vp9_dx_iface.c +++ b/vp9/vp9_dx_iface.c @@ -88,7 +88,8 @@ static vpx_codec_err_t decoder_init(vpx_codec_ctx_t *ctx, (void)data; if (!ctx->priv) { - vpx_codec_alg_priv_t *const priv = vpx_calloc(1, sizeof(*priv)); + vpx_codec_alg_priv_t *const priv = + (vpx_codec_alg_priv_t *)vpx_calloc(1, sizeof(*priv)); if (priv == NULL) return VPX_CODEC_MEM_ERROR; diff --git a/vp9/vp9_iface_common.h b/vp9/vp9_iface_common.h index 58bb7d5d6..da7ae0eda 100644 --- a/vp9/vp9_iface_common.h +++ b/vp9/vp9_iface_common.h @@ -56,7 +56,7 @@ static void yuvconfig2image(vpx_image_t *img, const YV12_BUFFER_CONFIG *yv12, if (yv12->flags & YV12_FLAG_HIGHBITDEPTH) { // vpx_image_t uses byte strides and a pointer to the first byte // of the image. - img->fmt |= VPX_IMG_FMT_HIGHBITDEPTH; + img->fmt = (vpx_img_fmt_t)(img->fmt | VPX_IMG_FMT_HIGHBITDEPTH); img->bit_depth = yv12->bit_depth; img->planes[VPX_PLANE_Y] = (uint8_t*)CONVERT_TO_SHORTPTR(yv12->y_buffer); img->planes[VPX_PLANE_U] = (uint8_t*)CONVERT_TO_SHORTPTR(yv12->u_buffer); |