Merge pull request #112 from d-j-a-y/djay_libvje

Libvje / refactor - width, height and len issue #112
This commit is contained in:
Niels
2016-05-16 21:28:51 +02:00
14 changed files with 60 additions and 59 deletions

View File

@@ -63,8 +63,8 @@ vj_effect *complexinvert_init(int w, int h)
return ve;
}
void complexinvert_apply(VJFrame *frame, int width,
int height, int i_angle, int r, int g, int b, int i_noise)
void complexinvert_apply(VJFrame *frame, int i_angle, int r, int g, int b,
int i_noise)
{
uint8_t *fg_y, *fg_cb, *fg_cr;
uint8_t *bg_y, *bg_cb, *bg_cr;

View File

@@ -21,7 +21,6 @@
#ifndef COMPLEXINVERT_H
#define COMPLEXINVERT_H
vj_effect *complexinvert_init();
void complexinvert_apply(VJFrame *frame, int width,
int height, int i_angle,
int red, int green, int blue, int i_noise);
void complexinvert_apply(VJFrame *frame, int i_angle, int red, int green, int blue,
int i_noise);
#endif

View File

@@ -70,9 +70,8 @@ vj_effect *complexsaturation_init(int w, int h)
return ve;
}
void complexsaturation_apply(VJFrame *frame, int width,
int height, int i_angle, int r, int g,
int b, int adjust_v, int adjust_degrees, int i_noise)
void complexsaturation_apply(VJFrame *frame, int i_angle, int r, int g, int b,
int adjust_v, int adjust_degrees, int i_noise)
{
// double degrees = adjust_degrees * 0.01;
// double dsat = adjust_v * 0.01;

View File

@@ -25,8 +25,8 @@
#include <stdint.h>
vj_effect *complexsaturation_init();
void complexsaturation_apply(VJFrame *frame, int width,
int height, int i_angle,
int red, int green, int blue, int adjust_degrees, int adjust_v, int i_noise );
void complexsaturation_apply(VJFrame *frame, int i_angle,
int red, int green, int blue,
int adjust_degrees, int adjust_v, int i_noise );
void complexsaturate_free();
#endif

View File

@@ -69,9 +69,10 @@ void complexsync_free() {
c_outofsync_buffer[0] = NULL;
}
void complexsync_apply(VJFrame *frame, VJFrame *frame2, int width, int height, int val)
void complexsync_apply(VJFrame *frame, VJFrame *frame2, int val)
{
const int len = frame->len;
const int width = frame->width;
uint8_t *Y = frame->data[0];
uint8_t *Cb = frame->data[1];
uint8_t *Cr = frame->data[2];

View File

@@ -28,5 +28,5 @@
vj_effect *complexsync_init(int width, int height);
int complexsync_malloc(int w, int h);
void complexsync_free();
void complexsync_apply(VJFrame *frame, VJFrame *frame2, int width, int height, int val);
void complexsync_apply(VJFrame *frame, VJFrame *frame2, int val);
#endif

View File

@@ -92,9 +92,8 @@ static int accept_tpixel(uint8_t fg_cb, uint8_t fg_cr, int cb, int cr,
return 0;
}
void complexthreshold_apply(VJFrame *frame, VJFrame *frame2, int width,
int height, int i_angle, int r, int g, int b,
int level, int threshold)
void complexthreshold_apply(VJFrame *frame, VJFrame *frame2, int i_angle,
int r, int g, int b, int level, int threshold)
{
uint8_t *fg_y, *fg_cb, *fg_cr;
@@ -110,6 +109,7 @@ void complexthreshold_apply(VJFrame *frame, VJFrame *frame2, int width,
int matrix[5];
int val, tmp1;
const int len = frame->len;
const int width = frame->width;
uint8_t *Y = frame->data[0];
uint8_t *Cb = frame->data[1];
uint8_t *Cr = frame->data[2];

View File

@@ -21,7 +21,6 @@
#ifndef COMPLEXTHRESHOLD_H
#define COMPLEXTHRESHOLD_H
vj_effect *complexthreshold_init();
void complexthreshold_apply(VJFrame *frame, VJFrame *frame2, int width,
int height, int i_angle, int red, int green,
int blue, int level, int threshold);
void complexthreshold_apply(VJFrame *frame, VJFrame *frame2, int i_angle,
int red, int green, int blue, int level, int threshold);
#endif

View File

@@ -56,11 +56,13 @@ vj_effect *contrast_init(int w, int h)
}
/* also from yuvdenoise */
static void contrast_cb_apply(VJFrame *frame, int width,int height, int *s) {
static void contrast_cb_apply(VJFrame *frame, int *s) {
unsigned int r;
register int cb;
register int cr;
const unsigned int uv_len = (frame->ssm ? frame->len: frame->uv_len);
const int width = frame->width;
const int height = frame->height;
uint8_t *Cb = frame->data[1];
uint8_t *Cr = frame->data[2];
@@ -82,10 +84,12 @@ static void contrast_cb_apply(VJFrame *frame, int width,int height, int *s) {
}
}
static void contrast_y_apply(VJFrame *frame, int width, int height, int *s) {
static void contrast_y_apply(VJFrame *frame, int *s) {
unsigned int r;
register int m;
const int len = frame->len;
const int width = frame->width;
const int height = frame->height;
uint8_t *Y = frame->data[0];
for(r=0; r < len; r++) {
@@ -99,19 +103,20 @@ static void contrast_y_apply(VJFrame *frame, int width, int height, int *s) {
}
void contrast_apply(VJFrame *frame, int width, int height, int *s ) {
switch(s[0]) {
case 0:
contrast_y_apply(frame, width,height, s);
break;
case 1:
contrast_cb_apply(frame,width,height,s);
break;
void contrast_apply(VJFrame *frame,int *s )
{
switch(s[0])
{
case 0:
contrast_y_apply(frame, s);
break;
case 1:
contrast_cb_apply(frame, s);
break;
case 2:
contrast_y_apply(frame,width,height,s);
contrast_cb_apply(frame,width,height,s);
break;
contrast_y_apply(frame, s);
contrast_cb_apply(frame, s);
break;
}
}

View File

@@ -27,7 +27,7 @@
vj_effect *contrast_init();
void contrast_apply(VJFrame *frame, int w, int h, int *t);
void contrast_apply(VJFrame *frame, int *t);
void contrast_free();
#endif

View File

@@ -47,11 +47,14 @@ vj_effect *enhancemask_init(int width, int height)
return ve;
}
void enhancemask_apply(VJFrame *frame, int width, int height, int *s ) {
void enhancemask_apply(VJFrame *frame, int *s )
{
//int s[9]= { 1, 0, -1, 2, 0, -2, 1 , 0 , -1};
unsigned int r;
const unsigned int len = (width*height)-width-1;
const int width = frame->width;
const int height = frame->height;
const unsigned int len = (frame->len)-width-1;
uint8_t *Y = frame->data[0];
/*
int sum=0;

View File

@@ -27,7 +27,7 @@
vj_effect *enhancemask_init(int w, int h);
void enhancemask_apply(VJFrame *frame, int w, int h, int *t);
void enhancemask_apply(VJFrame *frame, int *t);
void enhancemask_free();
#endif

View File

@@ -393,21 +393,16 @@ extern void greyselect_apply(VJFrame *frame, int angle, int r, int g, int b, int
extern void isolate_apply(VJFrame *frame, int angle, int r, int g, int b, int opacity);
extern void bwselect_apply(VJFrame *frame, int a , int b, int c, int g);
extern void bwotsu_apply(VJFrame *frame, int mode, int skew,int invert);
extern void meanfilter_apply(VJFrame *frame);
extern void complexinvert_apply(VJFrame *frame, int w, int h, int angle, int r, int g, int b, int i_noise);
extern void complexsaturation_apply(VJFrame *frame, int w, int h, int angle, int r, int g, int b, int adj, int adjv, int inoise);
extern void complexthreshold_apply(VJFrame *frame, VJFrame *frame2, int w, int h, int angle, int r,
int g, int b, int level, int threshold);
extern void complexsync_apply(VJFrame *frame, VJFrame *frame2, int w, int h, int val );
extern void enhancemask_apply(VJFrame *frame,int w, int h, int *t);
extern void contrast_apply(VJFrame *frame, int w, int h, int *t);
extern void complexinvert_apply(VJFrame *frame, int angle, int r, int g, int b,
int i_noise);
extern void complexsaturation_apply(VJFrame *frame, int angle, int r, int g, int b,
int adj, int adjv, int inoise);
extern void complexthreshold_apply(VJFrame *frame, VJFrame *frame2, int angle,
int r, int g, int b, int level, int threshold);
extern void complexsync_apply(VJFrame *frame, VJFrame *frame2, int val );
extern void enhancemask_apply(VJFrame *frame, int *t);
extern void contrast_apply(VJFrame *frame, int *t);
extern void noiseadd_apply(VJFrame *frame, int w , int h , int t, int n);

View File

@@ -139,10 +139,11 @@ static void vj_effman_apply_image_effect(
break;
case VJ_IMAGE_EFFECT_COMPLEXINVERT:
complexinvert_apply(frames[0], frames[0]->width,frames[0]->height,arg[0],arg[1],arg[2],arg[3],arg[4]);
complexinvert_apply(frames[0], arg[0], arg[1], arg[2], arg[3], arg[4]);
break;
case VJ_IMAGE_EFFECT_COMPLEXSATURATE:
complexsaturation_apply(frames[0], frames[0]->width,frames[0]->height,arg[0],arg[1],arg[2],arg[3],arg[4],arg[5],arg[6]);
complexsaturation_apply(frames[0], arg[0], arg[1], arg[2], arg[3],
arg[4], arg[5], arg[6]);
break;
case VJ_IMAGE_EFFECT_REFLECTION:
reflection_apply(frames[0], arg[0], arg[1], arg[2]);
@@ -156,10 +157,10 @@ static void vj_effman_apply_image_effect(
noiseadd_apply(frames[0],frames[0]->width,frames[0]->height,arg[0],arg[1]);
break;
case VJ_IMAGE_EFFECT_CONTRAST:
contrast_apply(frames[0], frames[0]->width, frames[0]->height,arg);
contrast_apply(frames[0], arg);
break;
case VJ_IMAGE_EFFECT_ENHANCEMASK:
enhancemask_apply(frames[0],frames[0]->width,frames[0]->height,arg);
enhancemask_apply(frames[0],arg);
break;
case VJ_IMAGE_EFFECT_SOLARIZE:
solarize_apply(frames[0], arg[0]);
@@ -465,8 +466,8 @@ static void vj_effman_apply_video_effect( VJFrame **frames, vjp_kf *todo_info,in
frames[0]->width,frames[0]->height, arg[0],arg[1],arg[2]);
break;
case VJ_VIDEO_EFFECT_COMPLEXTHRESHOLD:
complexthreshold_apply(frames[0],frames[1],frames[0]->width,frames[0]->height,arg[0],arg[1],arg[2],arg[3],
arg[4], arg[5]);
complexthreshold_apply(frames[0], frames[1], arg[0], arg[1], arg[2], arg[3],
arg[4], arg[5]);
break;
case VJ_VIDEO_EFFECT_DUPMAGIC:
dupmagic_apply(frames[0], frames[1], arg[0]);
@@ -554,8 +555,7 @@ static void vj_effman_apply_video_effect( VJFrame **frames, vjp_kf *todo_info,in
} else { /* arg1 = off , copy arg*/
todo_info->tmp[0] = arg[0];
}
complexsync_apply(frames[0], frames[1],frames[0]->width, frames[0]->height,
todo_info->tmp[0]);
complexsync_apply(frames[0], frames[1], todo_info->tmp[0]);
break;
case VJ_VIDEO_EFFECT_FADECOLORRGB:
if (arg[4] == 0) {