1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
|
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <schroedinger/schro.h>
#include <schroedinger/schromotion.h>
#include <schroedinger/schrodebug.h>
#include <schroedinger/schroutils.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "common.h"
void upsample_line (uint8_t *dest, int dstr, uint8_t *src, int sstr, int n);
void ref_h_upsample (SchroFrame *dest, SchroFrame *src);
void ref_v_upsample (SchroFrame *dest, SchroFrame *src);
void test (int width, int height);
int failed = 0;
int dump_all = FALSE;
int
main (int argc, char *argv[])
{
schro_init();
test (100, 100);
if (failed) {
printf("FAILED\n");
} else {
printf("SUCCESS\n");
}
return failed;
}
void
schro_upsampled_frame_get_subdata_prec1 (SchroUpsampledFrame *upframe,
int component, int x, int y, SchroFrameData *fd);
void test (int width, int height)
{
SchroFrame *frame;
SchroUpsampledFrame *upframe;
char name[TEST_PATTERN_NAME_SIZE];
SchroFrameData fd_ref;
SchroFrameData fd;
int x,y;
int ok;
fd_ref.data = schro_malloc (16 * 16);
fd_ref.stride = 16;
fd_ref.width = 16;
fd_ref.height = 16;;
fd.width = 16;
fd.height = 16;;
frame = schro_frame_new_and_alloc_extended (NULL, SCHRO_FRAME_FORMAT_U8_420,
width, height, 32);
test_pattern_generate (frame->components + 0, name, 0);
test_pattern_generate (frame->components + 1, name, 0);
test_pattern_generate (frame->components + 2, name, 0);
schro_frame_mc_edgeextend (frame);
upframe = schro_upsampled_frame_new (schro_frame_ref(frame));
schro_upsampled_frame_upsample (upframe);
#if 0
/* just the corners */
for(y=-10;y<-8;y++){
for(x=-10;x<-8;x++){
printf ("%d,%d\n", x, y);
schro_upsampled_frame_get_block_precN (upframe, 0, x, y, 1, &fd_ref);
schro_upsampled_frame_get_subdata_prec1 (upframe, 0, x, y, &fd);
frame_data_dump_full (&fd, &fd_ref, &fd_ref);
}
}
for(y=200-16;y<200-16+2;y++){
for(x=184;x<186;x++){
printf ("%d,%d\n", x, y);
schro_upsampled_frame_get_block_precN (upframe, 0, x, y, 1, &fd_ref);
schro_upsampled_frame_get_subdata_prec1 (upframe, 0, x, y, &fd);
frame_data_dump_full (&fd, &fd_ref, &fd_ref);
}
}
for(y=-10;y<-8;y++){
for(x=184;x<186;x++){
printf ("%d,%d\n", x, y);
schro_upsampled_frame_get_block_precN (upframe, 0, x, y, 1, &fd_ref);
schro_upsampled_frame_get_subdata_prec1 (upframe, 0, x, y, &fd);
frame_data_dump_full (&fd, &fd_ref, &fd_ref);
}
}
for(y=184;y<186;y++){
for(x=-10;x<-8;x++){
printf ("%d,%d\n", x, y);
schro_upsampled_frame_get_block_precN (upframe, 0, x, y, 1, &fd_ref);
schro_upsampled_frame_get_subdata_prec1 (upframe, 0, x, y, &fd);
frame_data_dump_full (&fd, &fd_ref, &fd_ref);
}
}
#endif
for(y=-32*2;y<100+32*2-16*2;y++) {
for(x=-32*2;x<100+32*2-16*2;x++) {
schro_upsampled_frame_get_block_fast_precN (upframe, 0, x, y, 1, &fd_ref, &fd_ref);
schro_upsampled_frame_get_subdata_prec1 (upframe, 0, x, y, &fd);
ok = frame_data_compare (&fd, &fd_ref);
if (dump_all || !ok) {
printf ("%d,%d\n", x, y);
frame_data_dump_full (&fd, &fd_ref, &fd_ref);
}
if (!ok) {
failed = TRUE;
}
}
}
schro_frame_unref (frame);
}
|