Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Obliterating most any reference to ORC #129

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 1 addition & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,6 @@ if(APPLE AND NOT CMAKE_OSX_ARCHITECTURES AND NOT SSE2_FOUND)
add_definitions(-march=armv8-a+fp+simd+crypto+crc)
endif()

### ORC is not used in any active code at the moment ###
# I tried it with 0.4.14
# 0.4.10 did not work (not all opcode implemented)
# find_package(Orc)
if(ORC_FOUND)
add_definitions( -DUSE_ORC ${ORC_DEFINITIONS} )
include_directories( ${ORC_INCLUDE_DIRS} )
else()
add_definitions( -DDISABLE_ORC )
endif()

# here we should check for SSE2
# our -DUSE_SSE2_ASM code does not work with fpic
if(SSE2_FOUND)
Expand All @@ -60,7 +49,7 @@ endif()
set(SOURCES src/frameinfo.c src/transformtype.c src/libvidstab.c
src/transform.c src/transformfixedpoint.c src/motiondetect.c
src/motiondetect_opt.c src/serialize.c src/localmotion2transform.c
src/boxblur.c src/vsvector.c src/orc/motiondetectorc.c)
src/boxblur.c src/vsvector.c)

set(HEADERS src/frameinfo.h src/transformtype.h src/libvidstab.h
src/transform.h src/motiondetect.h src/serialize.h
Expand All @@ -76,10 +65,6 @@ set_target_properties(vidstab PROPERTIES SOVERSION ${MAJOR_VERSION}.${MINOR_VERS

target_link_libraries(vidstab m)
set(PKG_EXTRA_LIBS -lm)
if(ORC_FOUND)
target_link_libraries(vidstab ${ORC_LIBRARIES})
set(PKG_EXTRA_LIBS "${PKG_EXTRA_LIBS} ${ORC_LIBRARIES}")
endif()
if(USE_OMP AND OPENMP_FOUND)
if(TARGET OpenMP::OpenMP_C)
target_link_libraries(vidstab OpenMP::OpenMP_C)
Expand Down
29 changes: 0 additions & 29 deletions CMakeModules/FindOrc.cmake

This file was deleted.

3 changes: 1 addition & 2 deletions src/motiondetect.c
Original file line number Diff line number Diff line change
Expand Up @@ -878,8 +878,7 @@ void drawLine(unsigned char* I, int width, int height, int bytesPerPixel,
// }


//#ifdef TESTING
/// plain C implementation of compareSubImg (without ORC)
/// plain C implementation of compareSubImg
unsigned int compareSubImg_thr(unsigned char* const I1, unsigned char* const I2,
const Field* field, int width1, int width2, int height,
int bytesPerPixel, int d_x, int d_y,
Expand Down
97 changes: 1 addition & 96 deletions src/motiondetect_opt.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@
*/
#include "motiondetect_opt.h"

#ifdef USE_ORC
#include "orc/motiondetectorc.h"
#endif

#ifdef USE_SSE2
#include <emmintrin.h>

Expand Down Expand Up @@ -100,35 +96,7 @@ double contrastSubImg1_SSE(unsigned char* const I, const Field* field,
}
#endif

#ifdef USE_ORC
/**
calculates the contrast in the given small part of the given image
using the absolute difference from mean luminance (like Root-Mean-Square,
but with abs() (Manhattan-Norm))
For multichannel images use contrastSubImg_Michelson()

\param I pointer to framebuffer
\param field Field specifies position(center) and size of subimage
\param width width of frame
\param height height of frame
*/
double contrastSubImg_variance_orc(unsigned char* const I, const Field* field,
int width, int height) {
unsigned char* p = NULL;
int s2 = field->size / 2;
int numpixel = field->size*field->size;

p = I + ((field->x - s2) + (field->y - s2) * width);

unsigned int sum=0;
image_sum_optimized((signed int*)&sum, p, width, field->size, field->size);
unsigned char mean = sum / numpixel;
int var=0;
image_variance_optimized(&var, p, width, mean, field->size, field->size);
return (double)var/numpixel/255.0;
}

/// plain C implementation of variance based contrastSubImg (without ORC)
/// plain C implementation of variance based contrastSubImg
double contrastSubImg_variance_C(unsigned char* const I,
const Field* field, int width, int height) {
int k, j;
Expand Down Expand Up @@ -158,69 +126,6 @@ double contrastSubImg_variance_C(unsigned char* const I,
}
return (double)var/numpixel/255.0;
}
#endif






#ifdef USE_ORC
/**
compares a small part of two given images
and returns the average absolute difference.
Field center, size and shift have to be choosen,
so that no clipping is required.
Uses optimized inner loops by ORC.

\param field Field specifies position(center) and size of subimage
\param d_x shift in x direction
\param d_y shift in y direction
*/
unsigned int compareSubImg_thr_orc(unsigned char* const I1, unsigned char* const I2,
const Field* field, int width1, int width2, int height,
int bytesPerPixel, int d_x, int d_y,
unsigned int threshold) {
unsigned char* p1 = NULL;
unsigned char* p2 = NULL;
int s2 = field->size / 2;
int j;
unsigned int sum = 0;
p1 = I1 + ((field->x - s2) + (field->y - s2) * width1) * bytesPerPixel;
p2 = I2 + ((field->x - s2 + d_x) + (field->y - s2 + d_y) * width2) * bytesPerPixel;

for (j = 0; j < field->size; j++) {
unsigned int s = 0;
image_line_difference_optimized(&s, p1, p2, field->size* bytesPerPixel);
sum += s;
if( sum > threshold) // no need to calculate any longer: worse than the best match
break;
p1 += width1 * bytesPerPixel;
p2 += width2 * bytesPerPixel;
}


return sum;
}

// implementation with 1 orc function, but no threshold
unsigned int compareSubImg_orc(unsigned char* const I1, unsigned char* const I2,
const Field* field, int width1, int width2, int height,
int bytesPerPixel, int d_x, int d_y,
unsigned int threshold) {
unsigned char* p1 = NULL;
unsigned char* p2 = NULL;
int s2 = field->size / 2;
unsigned int sum=0;
p1 = I1 + ((field->x - s2) + (field->y - s2) * width1) * bytesPerPixel;
p2 = I2 + ((field->x - s2 + d_x) + (field->y - s2 + d_y) * width2)
* bytesPerPixel;

image_difference_optimized(&sum, p1, width1 * bytesPerPixel, p2, width2 * bytesPerPixel,
field->size* bytesPerPixel , field->size);
return sum;
}
#endif

#ifdef USE_SSE2
unsigned int compareSubImg_thr_sse2(unsigned char* const I1, unsigned char* const I2,
Expand Down
20 changes: 0 additions & 20 deletions src/motiondetect_opt.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
#define compareSubImg compareSubImg_thr_sse2_asm
#elif defined(USE_SSE2) //enable SSE2 code
#define compareSubImg compareSubImg_thr_sse2
#elif defined(USE_ORC)
#define compareSubImg compareSubImg_thr_orc
#else
#define compareSubImg compareSubImg_thr
#endif
Expand All @@ -45,27 +43,9 @@ double contrastSubImg1_SSE(unsigned char* const I, const Field* field,
int width, int height);
#endif

#ifdef USE_ORC
double contrastSubImg_variance_orc(unsigned char* const I, const Field* field,
int width, int height);
double contrastSubImg_variance_C(unsigned char* const I, const Field* field,
int width, int height);

#endif

#ifdef USE_ORC
unsigned int compareSubImg_orc(unsigned char* const I1, unsigned char* const I2,
const Field* field, int width1, int width2, int height,
int bytesPerPixel, int d_x, int d_y,
unsigned int threshold);


unsigned int compareSubImg_thr_orc(unsigned char* const I1, unsigned char* const I2,
const Field* field, int width1, int width2, int height,
int bytesPerPixel, int d_x, int d_y,
unsigned int threshold);
#endif

#ifdef USE_SSE2
unsigned int compareSubImg_thr_sse2(unsigned char* const I1, unsigned char* const I2,
const Field* field, int width1, int width2, int height,
Expand Down
14 changes: 0 additions & 14 deletions src/orc/Makefile

This file was deleted.