...
 
Commits (7)
......@@ -176,17 +176,11 @@ macro(copy_kaze_to_tests_directory)
endif ()
endmacro()
macro(copy_example_items loc items)
create_output_dir (${loc})
macro(copy_items src dst items)
create_output_dir (${dst})
foreach(item IN LISTS ${items})
set(EXAMPLE_IMAGE_DST "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${loc}/${item}")
set(EXAMPLE_IMAGE_SRC "${CMAKE_SOURCE_DIR}/examples/images/${item}")
set(EXAMPLE_IMAGES_DEP ${EXAMPLE_IMAGES_DEP} ${EXAMPLE_IMAGE_DST})
add_custom_command(
OUTPUT "${EXAMPLE_IMAGE_DST}"
COMMAND ${CMAKE_COMMAND} -E copy "${EXAMPLE_IMAGE_SRC}" "${EXAMPLE_IMAGE_DST}"
DEPENDS "${EXAMPLE_IMAGE_SRC}"
)
set(COPY_ITEM_SRC "${CMAKE_SOURCE_DIR}/${src}/${item}")
set(COPY_ITEM_DST "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${dst}/${item}")
configure_file(${COPY_ITEM_SRC} ${COPY_ITEM_DST} COPYONLY)
endforeach()
add_custom_target(example-images ALL DEPENDS ${EXAMPLE_IMAGES_DEP})
endmacro()
......@@ -6,17 +6,17 @@ set (EXAMPLE_IMAGES
lena.tiff
small.mp4
grb_2.mp4
test1.mp4
)
set (EXAMPLE_PYTHON
median.py
)
if (BUILD_EXAMPLES)
create_output_dir (examples)
copy_example_items (examples/images EXAMPLE_IMAGES)
copy_items(examples/images examples/images EXAMPLE_IMAGES)
copy_items(examples examples EXAMPLE_PYTHON)
# core examples
new_example (kdictionary)
......
......@@ -15,7 +15,23 @@
#include "kfile.h"
static KObject* print_table (KObject* img)
{
int i, j;
unsigned int width = kimage_width(img);
unsigned int height = kimage_height(img);
unsigned char* pixels = kimage_raw_pixels(img);
for (j=0; j<height; j++)
for (i=0; i<width; i++) {
printf("%d|",pixels[j*width+i]);
printf("\n");
}
printf("\n");
return img;
}
void print_info(KObject* vid)
{
......@@ -44,6 +60,16 @@ void print_info(KObject* vid)
printf("Color Info: range:%d primaries:%d trc:%d colorspace:%d chromaloc:%d\n",
color_range, color_primaries,
color_trc, colorspace, chroma_location);
KObject* table = kvideo_frame_qp_table(vid);
if (table) {
print_table (table);
kobject_release(table);
} else {
printf("no qp table\n");
}
}
......@@ -110,7 +136,7 @@ int main (int argc, char** argv)
kmodule_depend ("mat");
//load avi
kvideo_quiet_debug_log();
// kvideo_quiet_debug_log();
vid = kfile_read (argv[1]);
if (!vid){
......
cmake_minimum_required(VERSION 2.8)
set (TEST_IMAGES
test1.mp4
)
if (BUILD_TESTING)
enable_testing ()
create_output_dir (tests)
copy_items(tests/images tests/images TEST_IMAGES)
# These tests link against nothing and are used to test macros
# necessary to build the basic libkaze core
......
......@@ -160,7 +160,7 @@ int main (int argc, char** argv)
KErrorCode kcode;
double sum;
char* filename = "../examples/images/test1.mp4";
char* filename = "images/test1.mp4";
......@@ -214,10 +214,12 @@ int main (int argc, char** argv)
nframe++;
}
nframe--;
// printf("index: %d\n", nframe);
correct_img = draw_frame (correct_img, MOV_DELTA*nframe, MOV_DELTA*nframe);
v_img = kvideo_frame_to_kimage_decoded(vid);
// kfile_write("out.tiff",v_img);
sum = check (correct_img,v_img);
printf("sum of squares p-frame result: %f\n", sum);
......@@ -283,5 +285,5 @@ int main (int argc, char** argv)
kobject_release (vid);
printf("SUCCESS\n");
return 0;
return EXIT_SUCCESS;
}