Прошло 2 года.
This commit is contained in:
3
lib/epdiy/test/CMakeLists.txt
Normal file
3
lib/epdiy/test/CMakeLists.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
idf_component_register(SRC_DIRS "."
|
||||
INCLUDE_DIRS "."
|
||||
REQUIRES unity epdiy)
|
||||
184
lib/epdiy/test/test_diff.c
Normal file
184
lib/epdiy/test/test_diff.c
Normal file
@@ -0,0 +1,184 @@
|
||||
#include <esp_heap_caps.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <unity.h>
|
||||
#include "esp_timer.h"
|
||||
|
||||
#define DEFAULT_EXAMPLE_LEN 704
|
||||
|
||||
bool _epd_interlace_line(
|
||||
const uint8_t* to,
|
||||
const uint8_t* from,
|
||||
uint8_t* interlaced,
|
||||
uint8_t* col_dirtyness,
|
||||
int fb_width
|
||||
);
|
||||
|
||||
static const uint8_t from_pattern[8] = { 0xFF, 0xF0, 0x0F, 0x01, 0x55, 0xAA, 0xFF, 0x80 };
|
||||
static const uint8_t to_pattern[8] = { 0xFF, 0xFF, 0x0F, 0x10, 0xAA, 0x55, 0xFF, 0x00 };
|
||||
|
||||
static const uint8_t expected_interlaced_pattern[16]
|
||||
= { 0xFF, 0xFF, 0xF0, 0xFF, 0xFF, 0x00, 0x01, 0x10,
|
||||
0xA5, 0xA5, 0x5A, 0x5A, 0xFF, 0xFF, 0x00, 0x08 };
|
||||
static const uint8_t expected_col_dirtyness_pattern[8]
|
||||
= { 0x00, 0x0F, 0x00, 0x11, 0xFF, 0xFF, 0x00, 0x80 };
|
||||
|
||||
typedef struct {
|
||||
uint8_t* from;
|
||||
uint8_t* to;
|
||||
uint8_t* interlaced;
|
||||
uint8_t* col_dirtyness;
|
||||
uint8_t* expected_interlaced;
|
||||
uint8_t* expected_col_dirtyness;
|
||||
} DiffTestBuffers;
|
||||
|
||||
/**
|
||||
* (Re-)fill buffers with example data, clear result buffers.
|
||||
*/
|
||||
static void diff_test_buffers_fill(DiffTestBuffers* bufs, int example_len) {
|
||||
// initialize test and check patterns
|
||||
for (int i = 0; i < example_len / 8; i++) {
|
||||
memcpy(bufs->from + (8 * i), from_pattern, 8);
|
||||
memcpy(bufs->to + (8 * i), to_pattern, 8);
|
||||
memcpy(bufs->expected_interlaced + (16 * i), expected_interlaced_pattern, 16);
|
||||
memcpy(bufs->expected_col_dirtyness + (8 * i), expected_col_dirtyness_pattern, 8);
|
||||
}
|
||||
|
||||
memset(bufs->col_dirtyness, 0, example_len);
|
||||
memset(bufs->interlaced, 0, example_len * 2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocates and populates buffers for diff tests.
|
||||
*/
|
||||
static void diff_test_buffers_init(DiffTestBuffers* bufs, int example_len) {
|
||||
bufs->from = heap_caps_aligned_alloc(16, example_len, MALLOC_CAP_DEFAULT);
|
||||
bufs->to = heap_caps_aligned_alloc(16, example_len, MALLOC_CAP_DEFAULT);
|
||||
bufs->interlaced = heap_caps_aligned_alloc(16, 2 * example_len, MALLOC_CAP_DEFAULT);
|
||||
bufs->col_dirtyness = heap_caps_aligned_alloc(16, example_len, MALLOC_CAP_DEFAULT);
|
||||
bufs->expected_interlaced = malloc(2 * example_len);
|
||||
bufs->expected_col_dirtyness = malloc(example_len);
|
||||
|
||||
diff_test_buffers_fill(bufs, example_len);
|
||||
}
|
||||
|
||||
/**
|
||||
* Free buffers used for diff testing.
|
||||
*/
|
||||
static void diff_test_buffers_free(DiffTestBuffers* bufs) {
|
||||
heap_caps_free(bufs->from);
|
||||
heap_caps_free(bufs->to);
|
||||
heap_caps_free(bufs->interlaced);
|
||||
heap_caps_free(bufs->col_dirtyness);
|
||||
free(bufs->expected_interlaced);
|
||||
free(bufs->expected_col_dirtyness);
|
||||
}
|
||||
|
||||
TEST_CASE("simple aligned diff works", "[epdiy,unit]") {
|
||||
// length of the example buffers in bytes (i.e., half the length in pixels)
|
||||
const int example_len = DEFAULT_EXAMPLE_LEN;
|
||||
DiffTestBuffers bufs;
|
||||
bool dirty;
|
||||
|
||||
diff_test_buffers_init(&bufs, example_len);
|
||||
|
||||
// This should trigger use of vector extensions on the S3
|
||||
TEST_ASSERT((uint32_t)bufs.to % 16 == 0);
|
||||
|
||||
// fully aligned
|
||||
dirty = _epd_interlace_line(
|
||||
bufs.to, bufs.from, bufs.interlaced, bufs.col_dirtyness, 2 * example_len
|
||||
);
|
||||
|
||||
TEST_ASSERT(dirty == true);
|
||||
TEST_ASSERT_EQUAL_UINT8_ARRAY(bufs.expected_col_dirtyness, bufs.col_dirtyness, example_len);
|
||||
TEST_ASSERT_EQUAL_UINT8_ARRAY(bufs.expected_interlaced, bufs.interlaced, 2 * example_len);
|
||||
|
||||
diff_test_buffers_free(&bufs);
|
||||
}
|
||||
|
||||
TEST_CASE("dirtynes for diff without changes is correct", "[epdiy,unit]") {
|
||||
const int example_len = DEFAULT_EXAMPLE_LEN;
|
||||
const uint8_t NULL_ARRAY[DEFAULT_EXAMPLE_LEN * 2] = { 0 };
|
||||
DiffTestBuffers bufs;
|
||||
bool dirty;
|
||||
|
||||
diff_test_buffers_init(&bufs, example_len);
|
||||
|
||||
// This should trigger use of vector extensions on the S3
|
||||
TEST_ASSERT((uint32_t)bufs.to % 16 == 0);
|
||||
|
||||
// both use "from" buffer
|
||||
dirty = _epd_interlace_line(
|
||||
bufs.from, bufs.from, bufs.interlaced, bufs.col_dirtyness, 2 * example_len
|
||||
);
|
||||
|
||||
TEST_ASSERT(dirty == false);
|
||||
TEST_ASSERT_EQUAL_UINT8_ARRAY(NULL_ARRAY, bufs.col_dirtyness, example_len);
|
||||
|
||||
// both use "to" buffer, misaligned by 4 bytes
|
||||
dirty = _epd_interlace_line(
|
||||
bufs.to + 4, bufs.to + 4, bufs.interlaced, bufs.col_dirtyness, 2 * (example_len - 4)
|
||||
);
|
||||
|
||||
TEST_ASSERT(dirty == false);
|
||||
TEST_ASSERT_EQUAL_UINT8_ARRAY(NULL_ARRAY, bufs.col_dirtyness + 4, example_len - 4);
|
||||
|
||||
diff_test_buffers_free(&bufs);
|
||||
}
|
||||
|
||||
TEST_CASE("different 4-byte alignments work", "[epdiy,unit]") {
|
||||
const int example_len = DEFAULT_EXAMPLE_LEN;
|
||||
DiffTestBuffers bufs;
|
||||
bool dirty;
|
||||
|
||||
diff_test_buffers_init(&bufs, example_len);
|
||||
|
||||
// test all combinations of start / end missalignment
|
||||
for (int start_offset = 0; start_offset <= 16; start_offset += 4) {
|
||||
for (int end_offset = 0; end_offset <= 16; end_offset += 4) {
|
||||
int unaligned_len = example_len - end_offset - start_offset;
|
||||
|
||||
diff_test_buffers_fill(&bufs, example_len);
|
||||
|
||||
// before and after the designated range the buffer shoulld be clear
|
||||
memset(bufs.expected_col_dirtyness, 0, start_offset);
|
||||
memset(bufs.expected_interlaced, 0, 2 * start_offset);
|
||||
memset(bufs.expected_col_dirtyness + start_offset + unaligned_len, 0, end_offset);
|
||||
memset(
|
||||
bufs.expected_interlaced + (start_offset + unaligned_len) * 2, 0, end_offset * 2
|
||||
);
|
||||
|
||||
printf(
|
||||
"testing with alignment (in px): (%d, %d)... ", 2 * start_offset, 2 * unaligned_len
|
||||
);
|
||||
uint64_t start = esp_timer_get_time();
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
dirty = _epd_interlace_line(
|
||||
bufs.to + start_offset,
|
||||
bufs.from + start_offset,
|
||||
bufs.interlaced + 2 * start_offset,
|
||||
bufs.col_dirtyness + start_offset,
|
||||
2 * unaligned_len
|
||||
);
|
||||
}
|
||||
|
||||
uint64_t end = esp_timer_get_time();
|
||||
|
||||
printf("took %.2fus per iter.\n", (end - start) / 100.0);
|
||||
|
||||
TEST_ASSERT(dirty == true);
|
||||
|
||||
TEST_ASSERT_EQUAL_UINT8_ARRAY(
|
||||
bufs.expected_col_dirtyness, bufs.col_dirtyness, example_len
|
||||
);
|
||||
TEST_ASSERT_EQUAL_UINT8_ARRAY(bufs.expected_interlaced, bufs.interlaced, example_len);
|
||||
}
|
||||
}
|
||||
|
||||
diff_test_buffers_free(&bufs);
|
||||
}
|
||||
46
lib/epdiy/test/test_initialization.c
Normal file
46
lib/epdiy/test/test_initialization.c
Normal file
@@ -0,0 +1,46 @@
|
||||
#include <assert.h>
|
||||
#include <unity.h>
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/task.h"
|
||||
|
||||
#include "epd_board.h"
|
||||
#include "epd_display.h"
|
||||
#include "epdiy.h"
|
||||
|
||||
// choose the default demo board depending on the architecture
|
||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||
#define TEST_BOARD epd_board_v6
|
||||
#elif defined(CONFIG_IDF_TARGET_ESP32S3)
|
||||
#define TEST_BOARD epd_board_v7
|
||||
#endif
|
||||
|
||||
TEST_CASE("initialization and deinitialization works", "[epdiy,e2e]") {
|
||||
epd_init(&TEST_BOARD, &ED097TC2, EPD_OPTIONS_DEFAULT);
|
||||
|
||||
epd_poweron();
|
||||
vTaskDelay(2);
|
||||
epd_poweroff();
|
||||
|
||||
epd_deinit();
|
||||
}
|
||||
|
||||
TEST_CASE("re-initialization works", "[epdiy,e2e]") {
|
||||
epd_init(&TEST_BOARD, &ED097TC2, EPD_OPTIONS_DEFAULT);
|
||||
|
||||
epd_poweron();
|
||||
vTaskDelay(2);
|
||||
epd_poweroff();
|
||||
|
||||
epd_deinit();
|
||||
|
||||
int before_init = esp_get_free_internal_heap_size();
|
||||
epd_init(&TEST_BOARD, &ED097TC2, EPD_OPTIONS_DEFAULT);
|
||||
|
||||
epd_poweron();
|
||||
vTaskDelay(2);
|
||||
epd_poweroff();
|
||||
|
||||
epd_deinit();
|
||||
int after_init = esp_get_free_internal_heap_size();
|
||||
TEST_ASSERT_EQUAL(after_init, before_init);
|
||||
}
|
||||
25
lib/epdiy/test/test_line_mask.c
Normal file
25
lib/epdiy/test/test_line_mask.c
Normal file
@@ -0,0 +1,25 @@
|
||||
#include <esp_heap_caps.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
#include <unity.h>
|
||||
|
||||
void epd_populate_line_mask(uint8_t* line_mask, const uint8_t* dirty_columns, int mask_len);
|
||||
|
||||
const uint8_t col_dirtyness_example[8] = { 0x00, 0x0F, 0x00, 0x11, 0xFF, 0xFF, 0x00, 0x80 };
|
||||
|
||||
TEST_CASE("mask populated correctly", "[epdiy,unit]") {
|
||||
const uint8_t expected_mask[8] = { 0x30, 0xF0, 0xFF, 0xC0, 0x00, 0x00, 0x00, 0x00 };
|
||||
uint8_t mask[8] = { 0 };
|
||||
epd_populate_line_mask(mask, col_dirtyness_example, 4);
|
||||
|
||||
TEST_ASSERT_EQUAL_UINT8_ARRAY(expected_mask, mask, 8);
|
||||
}
|
||||
|
||||
TEST_CASE("neutral mask with null dirtyness", "[epdiy,unit]") {
|
||||
const uint8_t expected_mask[8] = { 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00 };
|
||||
uint8_t mask[8] = { 0 };
|
||||
|
||||
epd_populate_line_mask(mask, NULL, 4);
|
||||
|
||||
TEST_ASSERT_EQUAL_UINT8_ARRAY(expected_mask, mask, 8);
|
||||
}
|
||||
283
lib/epdiy/test/test_lut.c
Normal file
283
lib/epdiy/test/test_lut.c
Normal file
@@ -0,0 +1,283 @@
|
||||
#include <esp_heap_caps.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <unity.h>
|
||||
#include "epd_internals.h"
|
||||
#include "epdiy.h"
|
||||
#include "esp_attr.h"
|
||||
#include "esp_timer.h"
|
||||
|
||||
#include "output_common/lut.h"
|
||||
#include "output_common/render_method.h"
|
||||
|
||||
#define DEFAULT_EXAMPLE_LEN 1408
|
||||
|
||||
static const uint8_t input_data_pattern[16] = { 0xFF, 0xFF, 0xF0, 0xFF, 0xFF, 0x00, 0x01, 0x10,
|
||||
0xA5, 0xA5, 0x5A, 0x5A, 0xFF, 0xFF, 0x00, 0x08 };
|
||||
|
||||
static const uint8_t result_pattern_1ppB[4] = { 0x20, 0x90, 0x5A, 0x40 };
|
||||
static const uint8_t result_pattern_2ppB_white[8]
|
||||
= { 0x00, 0x01, 0x50, 0x55, 0x55, 0x55, 0x00, 0x55 };
|
||||
static const uint8_t result_pattern_2ppB_black[8]
|
||||
= { 0xAA, 0xA8, 0x0A, 0x82, 0xAA, 0xAA, 0xAA, 0x20 };
|
||||
static const uint8_t result_pattern_8ppB_on_white[32]
|
||||
= { 0x00, 0x00, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x55,
|
||||
0x55, 0x54, 0x55, 0x55, 0x54, 0x44, 0x11, 0x44, 0x11, 0x11, 0x44,
|
||||
0x11, 0x44, 0x00, 0x00, 0x00, 0x00, 0x55, 0x55, 0x15, 0x55 };
|
||||
static const uint8_t result_pattern_8ppB_on_black[32]
|
||||
= { 0xAA, 0xAA, 0xAA, 0xAA, 0x00, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0x00,
|
||||
0x00, 0x02, 0x00, 0x00, 0x02, 0x22, 0x88, 0x22, 0x88, 0x88, 0x22,
|
||||
0x88, 0x22, 0xAA, 0xAA, 0xAA, 0xAA, 0x00, 0x00, 0x80, 0x00 };
|
||||
|
||||
typedef void (*lut_func_t)(const uint32_t*, uint8_t*, const uint8_t*, uint32_t);
|
||||
static uint8_t waveform_phases[16][4];
|
||||
|
||||
void calc_epd_input_1ppB_1k_S3_VE(
|
||||
const uint32_t* ld, uint8_t* epd_input, const uint8_t* conversion_lut, uint32_t epd_width
|
||||
);
|
||||
|
||||
static EpdWaveformPhases test_waveform = {
|
||||
.phase_times = NULL,
|
||||
.phases = 1,
|
||||
.luts = (uint8_t*)waveform_phases,
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
uint8_t* line_data;
|
||||
uint8_t* result_line;
|
||||
uint8_t* expected_line;
|
||||
uint8_t* lut;
|
||||
/// Ratio of input bytes to output bytes
|
||||
float in_out_ratio;
|
||||
int example_len_px;
|
||||
} LutTestBuffers;
|
||||
|
||||
static void fill_test_waveform() {
|
||||
for (int to = 0; to < 16; to++) {
|
||||
memset(waveform_phases[to], 0, 4);
|
||||
|
||||
for (int from = 0; from < 16; from++) {
|
||||
uint8_t val = 0x00;
|
||||
if (to < from)
|
||||
val = 0x01;
|
||||
if (to > from)
|
||||
val = 0x02;
|
||||
waveform_phases[to][from >> 2] |= val << (3 - (from & 0x3)) * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* (Re-)fill buffers with example data, clear result buffers.
|
||||
*/
|
||||
static void lut_test_buffers_fill(LutTestBuffers* bufs, const uint8_t* result_pattern) {
|
||||
int result_pattern_len = sizeof(input_data_pattern) / bufs->in_out_ratio;
|
||||
|
||||
// initialize test and check patterns
|
||||
for (int i = 0; i < bufs->example_len_px; i++) {
|
||||
bufs->line_data[i] = input_data_pattern[i % sizeof(input_data_pattern)];
|
||||
}
|
||||
|
||||
for (int i = 0; i < bufs->example_len_px / bufs->in_out_ratio; i++) {
|
||||
bufs->expected_line[i] = result_pattern[i % result_pattern_len];
|
||||
}
|
||||
|
||||
memset(bufs->lut, 0, 1 << 16);
|
||||
memset(bufs->result_line, 0, bufs->example_len_px / bufs->in_out_ratio);
|
||||
|
||||
fill_test_waveform();
|
||||
heap_caps_check_integrity_all(true);
|
||||
}
|
||||
|
||||
/*
|
||||
* Allocates and populates buffers for LUT tests.
|
||||
*/
|
||||
static void lut_test_buffers_init(
|
||||
LutTestBuffers* bufs, int example_len_px, const uint8_t* result_pattern, float in_out_ratio
|
||||
) {
|
||||
uint32_t caps = MALLOC_CAP_INTERNAL | MALLOC_CAP_8BIT;
|
||||
bufs->line_data = heap_caps_aligned_alloc(16, example_len_px, caps);
|
||||
bufs->result_line = heap_caps_aligned_alloc(16, (int)(example_len_px / in_out_ratio), caps);
|
||||
bufs->expected_line = heap_caps_aligned_alloc(16, (int)(example_len_px / in_out_ratio), caps);
|
||||
bufs->lut = heap_caps_malloc(1 << 16, caps);
|
||||
bufs->example_len_px = example_len_px;
|
||||
bufs->in_out_ratio = in_out_ratio;
|
||||
|
||||
assert(bufs->line_data != NULL);
|
||||
assert(bufs->result_line != NULL);
|
||||
assert(bufs->expected_line != NULL);
|
||||
assert(bufs->lut != NULL);
|
||||
|
||||
lut_test_buffers_fill(bufs, result_pattern);
|
||||
}
|
||||
|
||||
/**
|
||||
* Free buffers used for LUT testing.
|
||||
*/
|
||||
static void diff_test_buffers_free(LutTestBuffers* bufs) {
|
||||
heap_caps_free(bufs->line_data);
|
||||
heap_caps_free(bufs->expected_line);
|
||||
heap_caps_free(bufs->result_line);
|
||||
heap_caps_free(bufs->lut);
|
||||
}
|
||||
|
||||
static void IRAM_ATTR test_with_alignments(LutTestBuffers* bufs, lut_func_t lut_func) {
|
||||
int len = bufs->example_len_px;
|
||||
int out_len = bufs->example_len_px / bufs->in_out_ratio;
|
||||
|
||||
uint8_t* expectation_backup = heap_caps_aligned_alloc(16, out_len, MALLOC_CAP_DEFAULT);
|
||||
memcpy(expectation_backup, bufs->expected_line, out_len);
|
||||
|
||||
// test combinations of start / end missalignment in four byte steps
|
||||
for (int start_offset = 0; start_offset <= 16; start_offset += 4) {
|
||||
for (int end_offset = 0; end_offset <= 16; end_offset += 4) {
|
||||
/// for 8ppB buffers, we skip 4 byte start offset since an input byte encodes 2 output
|
||||
/// bytes, there is no way to shift the output by just one byte.
|
||||
if (bufs->in_out_ratio < 1.0 && (start_offset % 8) == 4) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int unaligned_len = len - end_offset - start_offset;
|
||||
|
||||
memset(bufs->result_line, 0, out_len);
|
||||
memcpy(bufs->expected_line, expectation_backup, out_len);
|
||||
|
||||
// before and after the designated range the buffer shoulld be clear
|
||||
memset(bufs->expected_line, 0, start_offset / 4);
|
||||
memset(bufs->expected_line + (start_offset + unaligned_len) / 4, 0, end_offset / 4);
|
||||
|
||||
printf(
|
||||
"benchmarking and checking with alignment (in px): (%d, %d)... ",
|
||||
start_offset,
|
||||
unaligned_len
|
||||
);
|
||||
uint64_t start = esp_timer_get_time();
|
||||
for (int i = 0; i < 100; i++) {
|
||||
lut_func(
|
||||
// We shift the alignment of the input data by four pixels
|
||||
(uint32_t*)(bufs->line_data + (int)(start_offset * bufs->in_out_ratio / 4)),
|
||||
// we shift the alignment of the result line by one byte
|
||||
bufs->result_line + start_offset / 4,
|
||||
bufs->lut,
|
||||
unaligned_len
|
||||
);
|
||||
}
|
||||
|
||||
heap_caps_check_integrity_all(true);
|
||||
uint64_t end = esp_timer_get_time();
|
||||
printf("took %.2fus per iter.\n", (end - start) / 100.0);
|
||||
|
||||
// Compare computed outputs to the expectation. We limit the comparison to len / 4,
|
||||
// since the LUT functions only compute a full display line, not more, even though our
|
||||
// test buffer may be larger.
|
||||
TEST_ASSERT_EQUAL_UINT8_ARRAY(bufs->expected_line, bufs->result_line, len / 4);
|
||||
}
|
||||
}
|
||||
heap_caps_check_integrity_all(true);
|
||||
|
||||
heap_caps_free(expectation_backup);
|
||||
}
|
||||
|
||||
TEST_CASE("1ppB lookup LCD, 64k LUT", "[epdiy,unit,lut]") {
|
||||
LutTestBuffers bufs;
|
||||
lut_test_buffers_init(&bufs, DEFAULT_EXAMPLE_LEN, result_pattern_1ppB, 4);
|
||||
|
||||
enum EpdDrawMode mode = MODE_GL16 | MODE_PACKING_1PPB_DIFFERENCE | MODE_FORCE_NO_PIE;
|
||||
LutFunctionPair func_pair = find_lut_functions(mode, 1 << 16);
|
||||
func_pair.build_func(bufs.lut, &test_waveform, 0);
|
||||
test_with_alignments(&bufs, func_pair.lookup_func);
|
||||
|
||||
diff_test_buffers_free(&bufs);
|
||||
}
|
||||
|
||||
#if !DISABLED_FOR_TARGETS(ESP32)
|
||||
TEST_CASE("1ppB lookup LCD, 1k LUT, PIE", "[epdiy,unit,lut]") {
|
||||
LutTestBuffers bufs;
|
||||
lut_test_buffers_init(&bufs, DEFAULT_EXAMPLE_LEN, result_pattern_1ppB, 4);
|
||||
|
||||
enum EpdDrawMode mode = MODE_GL16 | MODE_PACKING_1PPB_DIFFERENCE;
|
||||
LutFunctionPair func_pair = find_lut_functions(mode, 1 << 10);
|
||||
func_pair.build_func(bufs.lut, &test_waveform, 0);
|
||||
test_with_alignments(&bufs, calc_epd_input_1ppB_1k_S3_VE);
|
||||
diff_test_buffers_free(&bufs);
|
||||
}
|
||||
#endif
|
||||
|
||||
TEST_CASE("2ppB lookup LCD, 64k LUT, previously white", "[epdiy,unit,lut]") {
|
||||
LutTestBuffers bufs;
|
||||
lut_test_buffers_init(&bufs, DEFAULT_EXAMPLE_LEN, result_pattern_2ppB_white, 2);
|
||||
|
||||
enum EpdDrawMode mode = MODE_GL16 | MODE_PACKING_2PPB | PREVIOUSLY_WHITE;
|
||||
LutFunctionPair func_pair = find_lut_functions(mode, 1 << 16);
|
||||
func_pair.build_func(bufs.lut, &test_waveform, 0);
|
||||
test_with_alignments(&bufs, func_pair.lookup_func);
|
||||
|
||||
diff_test_buffers_free(&bufs);
|
||||
}
|
||||
|
||||
TEST_CASE("2ppB lookup LCD, 64k LUT, previously black", "[epdiy,unit,lut]") {
|
||||
LutTestBuffers bufs;
|
||||
lut_test_buffers_init(&bufs, DEFAULT_EXAMPLE_LEN, result_pattern_2ppB_black, 2);
|
||||
|
||||
enum EpdDrawMode mode = MODE_GL16 | MODE_PACKING_2PPB | PREVIOUSLY_BLACK;
|
||||
LutFunctionPair func_pair = find_lut_functions(mode, 1 << 16);
|
||||
func_pair.build_func(bufs.lut, &test_waveform, 0);
|
||||
test_with_alignments(&bufs, func_pair.lookup_func);
|
||||
|
||||
diff_test_buffers_free(&bufs);
|
||||
}
|
||||
|
||||
TEST_CASE("2ppB lookup LCD, 1k LUT, previously white", "[epdiy,unit,lut]") {
|
||||
LutTestBuffers bufs;
|
||||
lut_test_buffers_init(&bufs, DEFAULT_EXAMPLE_LEN, result_pattern_2ppB_white, 2);
|
||||
|
||||
enum EpdDrawMode mode = MODE_GL16 | MODE_PACKING_2PPB | PREVIOUSLY_WHITE;
|
||||
LutFunctionPair func_pair = find_lut_functions(mode, 1 << 10);
|
||||
func_pair.build_func(bufs.lut, &test_waveform, 0);
|
||||
test_with_alignments(&bufs, func_pair.lookup_func);
|
||||
|
||||
diff_test_buffers_free(&bufs);
|
||||
}
|
||||
|
||||
TEST_CASE("2ppB lookup LCD, 1k LUT, previously black", "[epdiy,unit,lut]") {
|
||||
LutTestBuffers bufs;
|
||||
lut_test_buffers_init(&bufs, DEFAULT_EXAMPLE_LEN, result_pattern_2ppB_black, 2);
|
||||
|
||||
enum EpdDrawMode mode = MODE_GL16 | MODE_PACKING_2PPB | PREVIOUSLY_BLACK;
|
||||
LutFunctionPair func_pair = find_lut_functions(mode, 1 << 10);
|
||||
func_pair.build_func(bufs.lut, &test_waveform, 0);
|
||||
test_with_alignments(&bufs, func_pair.lookup_func);
|
||||
|
||||
diff_test_buffers_free(&bufs);
|
||||
}
|
||||
|
||||
TEST_CASE("8ppB lookup LCD, 1k LUT, previously white", "[epdiy,unit,lut]") {
|
||||
LutTestBuffers bufs;
|
||||
lut_test_buffers_init(&bufs, DEFAULT_EXAMPLE_LEN / 2, result_pattern_8ppB_on_white, 0.5);
|
||||
|
||||
enum EpdDrawMode mode = MODE_DU | MODE_PACKING_8PPB | PREVIOUSLY_WHITE;
|
||||
LutFunctionPair func_pair = find_lut_functions(mode, 1 << 10);
|
||||
TEST_ASSERT_NOT_NULL(func_pair.build_func);
|
||||
TEST_ASSERT_NOT_NULL(func_pair.lookup_func);
|
||||
func_pair.build_func(bufs.lut, &test_waveform, 0);
|
||||
test_with_alignments(&bufs, func_pair.lookup_func);
|
||||
|
||||
diff_test_buffers_free(&bufs);
|
||||
}
|
||||
|
||||
TEST_CASE("8ppB lookup LCD, 1k LUT, previously black", "[epdiy,unit,lut]") {
|
||||
LutTestBuffers bufs;
|
||||
lut_test_buffers_init(&bufs, DEFAULT_EXAMPLE_LEN / 2, result_pattern_8ppB_on_black, 0.5);
|
||||
|
||||
enum EpdDrawMode mode = MODE_DU | MODE_PACKING_8PPB | PREVIOUSLY_BLACK;
|
||||
LutFunctionPair func_pair = find_lut_functions(mode, 1 << 10);
|
||||
TEST_ASSERT_NOT_NULL(func_pair.build_func);
|
||||
TEST_ASSERT_NOT_NULL(func_pair.lookup_func);
|
||||
func_pair.build_func(bufs.lut, &test_waveform, 0);
|
||||
test_with_alignments(&bufs, func_pair.lookup_func);
|
||||
|
||||
diff_test_buffers_free(&bufs);
|
||||
}
|
||||
Reference in New Issue
Block a user