History

Fix image width alignment. Enable ImageSizeSetting test.

BUG=b/64710201

Jerome Jiang committed 9 years ago

Commit 5a40c8f1 parent d203a912 files · +17 −9Browse files

Unified · Split

2 files
  1. test/encode_api_test.cc +1 −1
  2. vpx/src/vpx_image.c +16 −8
test/encode_api_test.cc+1−1
@@ -80,7 +80,7 @@ TEST(EncodeAPI, HighBitDepthCapability) { · 79 unmodified lines
80}80}
81 81
82#if CONFIG_VP8_ENCODER82#if CONFIG_VP8_ENCODER
83TEST(EncodeAPI, DISABLED_ImageSizeSetting) {83TEST(EncodeAPI, ImageSizeSetting) {
84 const int width = 711;84 const int width = 711;
85 const int height = 360;85 const int height = 360;
86 const int bps = 12;86 const int bps = 12;
vpx/src/vpx_image.c+16−8
@@ -88,11 +88,10 @@ static vpx_image_t *img_alloc_helper(vpx_image_t *img, vpx_img_fmt_t fmt, · 87 unmodified lines
88 default: ycs = 0; break;88 default: ycs = 0; break;
89 }89 }
90 90
91 /* Calculate storage sizes given the chroma subsampling */91 /* Calculate storage sizes. If the buffer was allocated externally, the width
92 align = (1 << xcs) - 1;92 * and height shouldn't be adjusted. */
93 w = (d_w + align) & ~align;93 w = d_w;
94 align = (1 << ycs) - 1;94 h = d_h;
95 h = (d_h + align) & ~align;
96 s = (fmt & VPX_IMG_FMT_PLANAR) ? w : bps * w / 8;95 s = (fmt & VPX_IMG_FMT_PLANAR) ? w : bps * w / 8;
97 s = (s + stride_align - 1) & ~(stride_align - 1);96 s = (s + stride_align - 1) & ~(stride_align - 1);
98 stride_in_bytes = (fmt & VPX_IMG_FMT_HIGHBITDEPTH) ? s * 2 : s;97 stride_in_bytes = (fmt & VPX_IMG_FMT_HIGHBITDEPTH) ? s * 2 : s;
@@ -111,9 +110,18 @@ static vpx_image_t *img_alloc_helper(vpx_image_t *img, vpx_img_fmt_t fmt, · 12 unmodified lines
111 img->img_data = img_data;110 img->img_data = img_data;
112 111
113 if (!img_data) {112 if (!img_data) {
114 const uint64_t alloc_size = (fmt & VPX_IMG_FMT_PLANAR)113 uint64_t alloc_size;
115 ? (uint64_t)h * s * bps / 8114 /* Calculate storage sizes given the chroma subsampling */
116 : (uint64_t)h * s;115 align = xcs ? (1 << xcs) - 1 : 1;
116 w = (d_w + align - 1) & ~(align - 1);
117 align = ycs ? (1 << ycs) - 1 : 1;
118 h = (d_h + align - 1) & ~(align - 1);
119
120 s = (fmt & VPX_IMG_FMT_PLANAR) ? w : bps * w / 8;
121 s = (s + stride_align - 1) & ~(stride_align - 1);
122 stride_in_bytes = (fmt & VPX_IMG_FMT_HIGHBITDEPTH) ? s * 2 : s;
123 alloc_size = (fmt & VPX_IMG_FMT_PLANAR) ? (uint64_t)h * s * bps / 8
124 : (uint64_t)h * s;
117 125
118 if (alloc_size != (size_t)alloc_size) goto fail;126 if (alloc_size != (size_t)alloc_size) goto fail;
119 127

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t