Commit aeb1e487 authored by Sebastien Alaiwan's avatar Sebastien Alaiwan Committed by Frédéric BARBIER

Don't repeat image plane width/height computation

Change-Id: Ia58759dec0c6d5e5d0e91166e2abf5204c3217f3
parent cdcf4b03
......@@ -93,16 +93,14 @@ class CompressedSource {
// lowers an aom_image_t to a easily comparable/printable form
std::vector<int16_t> Serialize(const aom_image_t *img) {
const int w_uv = ROUND_POWER_OF_TWO(img->d_w, img->x_chroma_shift);
const int h_uv = ROUND_POWER_OF_TWO(img->d_h, img->y_chroma_shift);
const int w[] = { static_cast<int>(img->d_w), w_uv, w_uv };
const int h[] = { static_cast<int>(img->d_h), h_uv, h_uv };
std::vector<int16_t> bytes;
bytes.reserve(img->d_w * img->d_h * 3);
for (int plane = 0; plane < 3; ++plane) {
for (int r = 0; r < h[plane]; ++r) {
for (int c = 0; c < w[plane]; ++c) {
const int w = aom_img_plane_width(img, plane);
const int h = aom_img_plane_height(img, plane);
for (int r = 0; r < h; ++r) {
for (int c = 0; c < w; ++c) {
const int offset = r * img->stride[plane] + c;
if (img->fmt & AOM_IMG_FMT_HIGHBITDEPTH)
bytes.push_back(img->planes[plane][offset * 2]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment