Test extreme inputs in frame scale functions
Change-Id: Ic149e3cb59be2ee0f98a3fcfd83226ad5ea30c99
This commit is contained in:
parent
16166bfdaa
commit
1fa3ec3023
@ -15,11 +15,14 @@
|
||||
|
||||
#include "./vpx_config.h"
|
||||
#include "./vpx_scale_rtcd.h"
|
||||
#include "test/acm_random.h"
|
||||
#include "test/clear_system_state.h"
|
||||
#include "test/register_state_check.h"
|
||||
#include "vpx_mem/vpx_mem.h"
|
||||
#include "vpx_scale/yv12config.h"
|
||||
|
||||
using libvpx_test::ACMRandom;
|
||||
|
||||
namespace libvpx_test {
|
||||
|
||||
class VpxScaleBase {
|
||||
@ -65,12 +68,12 @@ class VpxScaleBase {
|
||||
ResetScaleImage(&img_, src_width, src_height);
|
||||
ResetScaleImage(&ref_img_, dst_width, dst_height);
|
||||
ResetScaleImage(&dst_img_, dst_width, dst_height);
|
||||
FillPlane(img_.y_buffer, img_.y_crop_width, img_.y_crop_height,
|
||||
img_.y_stride);
|
||||
FillPlane(img_.u_buffer, img_.uv_crop_width, img_.uv_crop_height,
|
||||
img_.uv_stride);
|
||||
FillPlane(img_.v_buffer, img_.uv_crop_width, img_.uv_crop_height,
|
||||
img_.uv_stride);
|
||||
FillPlaneExtreme(img_.y_buffer, img_.y_crop_width, img_.y_crop_height,
|
||||
img_.y_stride);
|
||||
FillPlaneExtreme(img_.u_buffer, img_.uv_crop_width, img_.uv_crop_height,
|
||||
img_.uv_stride);
|
||||
FillPlaneExtreme(img_.v_buffer, img_.uv_crop_width, img_.uv_crop_height,
|
||||
img_.uv_stride);
|
||||
}
|
||||
|
||||
void DeallocImages() {
|
||||
@ -89,7 +92,8 @@ class VpxScaleBase {
|
||||
static const int kBufFiller = 123;
|
||||
static const int kBufMax = kBufFiller - 1;
|
||||
|
||||
static void FillPlane(uint8_t *buf, int width, int height, int stride) {
|
||||
static void FillPlane(uint8_t *const buf, const int width, const int height,
|
||||
const int stride) {
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (int x = 0; x < width; ++x) {
|
||||
buf[x + (y * stride)] = (x + (width * y)) % kBufMax;
|
||||
@ -97,6 +101,16 @@ class VpxScaleBase {
|
||||
}
|
||||
}
|
||||
|
||||
static void FillPlaneExtreme(uint8_t *const buf, const int width,
|
||||
const int height, const int stride) {
|
||||
ACMRandom rnd;
|
||||
for (int y = 0; y < height; ++y) {
|
||||
for (int x = 0; x < width; ++x) {
|
||||
buf[x + (y * stride)] = rnd.Rand8() % 2 ? 255 : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ExtendPlane(uint8_t *buf, int crop_width, int crop_height,
|
||||
int width, int height, int stride, int padding) {
|
||||
// Copy the outermost visible pixel to a distance of at least 'padding.'
|
||||
|
Loading…
x
Reference in New Issue
Block a user