Use uint8 pointer instead of std::vector in NV12Scale.

To prepare for landing 536773.

Bug: webrtc:7785
Change-Id: I841218dca3fb9d83f362f7f2b9076f3f189e7c15
Reviewed-on: https://chromium-review.googlesource.com/539577
Commit-Queue: Anders Carlsson <andersc@webrtc.org>
Reviewed-by: Magnus Jedvert <magjed@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#18662}
This commit is contained in:
Anders Carlsson
2017-06-19 16:46:31 +02:00
committed by Commit Bot
parent 652abc9a47
commit bfe45c29c5
4 changed files with 33 additions and 12 deletions

View File

@ -148,7 +148,20 @@ bool CoreVideoFrameBuffer::CropAndScaleTo(
src_y += src_y_stride * crop_y_ + crop_x_;
src_uv += src_uv_stride * (crop_y_ / 2) + crop_x_;
NV12Scale(tmp_buffer,
if (crop_width_ == dst_width && crop_height_ == dst_height) {
tmp_buffer->clear();
tmp_buffer->shrink_to_fit();
} else {
const int src_chroma_width = (crop_width_ + 1) / 2;
const int src_chroma_height = (crop_height_ + 1) / 2;
const int dst_chroma_width = (dst_width + 1) / 2;
const int dst_chroma_height = (dst_height + 1) / 2;
tmp_buffer->resize(src_chroma_width * src_chroma_height * 2 +
dst_chroma_width * dst_chroma_height * 2);
tmp_buffer->shrink_to_fit();
}
NV12Scale(tmp_buffer->data(),
src_y, src_y_stride,
src_uv, src_uv_stride,
crop_width_, crop_height_,