VP8 wrapper: updating raw image allocation.
As we set the pointers to the data, there is no need to allocate that memory. Review URL: https://webrtc-codereview.appspot.com/964021 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3175 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -177,11 +177,11 @@ int VP8EncoderImpl::InitEncode(const VideoCodec* inst,
|
|||||||
encoded_image_._buffer = new uint8_t[encoded_image_._size];
|
encoded_image_._buffer = new uint8_t[encoded_image_._size];
|
||||||
encoded_image_._completeFrame = true;
|
encoded_image_._completeFrame = true;
|
||||||
|
|
||||||
unsigned int align = 1;
|
// Creating a wrapper to the image - setting image data to NULL. Actual
|
||||||
if (codec_.width % 32 == 0) {
|
// pointer will be set in encode. Setting align to 1, as it is meaningless
|
||||||
align = 32;
|
// (actual memory is not allocated).
|
||||||
}
|
raw_ = vpx_img_wrap(NULL, IMG_FMT_I420, codec_.width, codec_.height,
|
||||||
raw_ = vpx_img_alloc(NULL, IMG_FMT_I420, codec_.width, codec_.height, align);
|
1, NULL);
|
||||||
// populate encoder configuration with default values
|
// populate encoder configuration with default values
|
||||||
if (vpx_codec_enc_config_default(vpx_codec_vp8_cx(), config_, 0)) {
|
if (vpx_codec_enc_config_default(vpx_codec_vp8_cx(), config_, 0)) {
|
||||||
return WEBRTC_VIDEO_CODEC_ERROR;
|
return WEBRTC_VIDEO_CODEC_ERROR;
|
||||||
@@ -970,10 +970,7 @@ VideoDecoder* VP8DecoderImpl::Copy() {
|
|||||||
if (!ref_frame_) {
|
if (!ref_frame_) {
|
||||||
ref_frame_ = new vpx_ref_frame_t;
|
ref_frame_ = new vpx_ref_frame_t;
|
||||||
|
|
||||||
unsigned int align = 1;
|
unsigned int align = 16;
|
||||||
if (decoded_image_.width() % 32 == 0) {
|
|
||||||
align = 32;
|
|
||||||
}
|
|
||||||
if (!vpx_img_alloc(&ref_frame_->img,
|
if (!vpx_img_alloc(&ref_frame_->img,
|
||||||
static_cast<vpx_img_fmt_t>(image_format_),
|
static_cast<vpx_img_fmt_t>(image_format_),
|
||||||
decoded_image_.width(), decoded_image_.height(),
|
decoded_image_.width(), decoded_image_.height(),
|
||||||
|
|||||||
Reference in New Issue
Block a user