From 58927e8d8f272e5e8ddf22821820a3e2955bba01 Mon Sep 17 00:00:00 2001 From: "stefan@webrtc.org" Date: Wed, 7 Dec 2011 08:13:31 +0000 Subject: [PATCH] Disable deblocking temporarily due to Valgrind warnings. Also corrects the copying of the decoded image data for frames with odd width or height. BUG= TEST= Review URL: http://webrtc-codereview.appspot.com/307002 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1116 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../codecs/vp8/main/source/vp8.cc | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/modules/video_coding/codecs/vp8/main/source/vp8.cc b/src/modules/video_coding/codecs/vp8/main/source/vp8.cc index 705d8c6e8..0473d31fd 100644 --- a/src/modules/video_coding/codecs/vp8/main/source/vp8.cc +++ b/src/modules/video_coding/codecs/vp8/main/source/vp8.cc @@ -691,7 +691,6 @@ WebRtc_Word32 VP8Decoder::InitDecode(const VideoCodec* inst, WebRtc_Word32 numberOfCores) { - vp8_postproc_cfg_t ppcfg; WebRtc_Word32 retVal = Release(); if (retVal < 0 ) { @@ -712,23 +711,24 @@ VP8Decoder::InitDecode(const VideoCodec* inst, vpx_codec_flags_t flags = 0; #if WEBRTC_LIBVPX_VERSION >= 971 - flags = VPX_CODEC_USE_ERROR_CONCEALMENT; + flags = VPX_CODEC_USE_ERROR_CONCEALMENT | VPX_CODEC_USE_POSTPROC; #ifdef INDEPENDENT_PARTITIONS flags |= VPX_CODEC_USE_INPUT_PARTITION; #endif #endif - flags |= VPX_CODEC_USE_POSTPROC; - if (vpx_codec_dec_init(_decoder, vpx_codec_vp8_dx(), &cfg, flags)) { return WEBRTC_VIDEO_CODEC_MEMORY; } - ppcfg.post_proc_flag = VP8_DEMACROBLOCK | VP8_DEBLOCK; +#if WEBRTC_LIBVPX_VERSION >= 971 + vp8_postproc_cfg_t ppcfg; + ppcfg.post_proc_flag = VP8_DEBLOCK; // Strength of deblocking filter. Valid range:[0,16] ppcfg.deblocking_level = 3; vpx_codec_control(_decoder, VP8_SET_POSTPROC, &ppcfg); +#endif // Save VideoCodec instance for later; mainly for duplicating the decoder. if (inst && inst != _inst) @@ -976,17 +976,18 @@ VP8Decoder::ReturnFrame(const vpx_image_t* img, WebRtc_UWord32 timeStamp) } WebRtc_UWord8* buf; - WebRtc_UWord32 locCnt = 0; + WebRtc_UWord32 pos = 0; WebRtc_UWord32 plane, y; for (plane = 0; plane < 3; plane++) { + unsigned int width = (plane ? (img->d_w + 1) >> 1 : img->d_w); + unsigned int height = (plane ? (img->d_h + 1) >> 1 : img->d_h); buf = img->planes[plane]; - WebRtc_UWord32 shiftFactor = plane ? 1 : 0; - for(y = 0; y < img->d_h >> shiftFactor; y++) + for(y = 0; y < height; y++) { - memcpy(&_decodedImage._buffer[locCnt], buf, img->d_w >> shiftFactor); - locCnt += img->d_w >> shiftFactor; + memcpy(&_decodedImage._buffer[pos], buf, width); + pos += width; buf += img->stride[plane]; } }