mirror of
https://github.com/game-stop/veejay.git
synced 2026-01-05 22:45:30 +01:00
Libvje / refactor : overclock
* w, h * clean headers * remove inline blur and blur2 : duplicated with common.c
This commit is contained in:
@@ -17,11 +17,8 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 , USA.
|
||||
*/
|
||||
#include <config.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <libvjmem/vjmem.h>
|
||||
#include "common.h"
|
||||
#include <libvjmem/vjmem.h>
|
||||
#include "overclock.h"
|
||||
|
||||
vj_effect *overclock_init(int w, int h)
|
||||
@@ -48,61 +45,6 @@ vj_effect *overclock_init(int w, int h)
|
||||
|
||||
static uint8_t *oc_buf[3] = { NULL,NULL,NULL };
|
||||
|
||||
//copied from xine
|
||||
static inline void blur(uint8_t *dst, uint8_t *src, int w, int radius, int dstStep, int srcStep){
|
||||
int x;
|
||||
const int length= radius*2 + 1;
|
||||
const int inv= ((1<<16) + length/2)/length;
|
||||
|
||||
int sum= 0;
|
||||
|
||||
for(x=0; x<radius; x++){
|
||||
sum+= src[x*srcStep]<<1;
|
||||
}
|
||||
sum+= src[radius*srcStep];
|
||||
|
||||
for(x=0; x<=radius; x++){
|
||||
sum+= src[(radius+x)*srcStep] - src[(radius-x)*srcStep];
|
||||
dst[x*dstStep]= (sum*inv + (1<<15))>>16;
|
||||
}
|
||||
|
||||
for(; x<w-radius; x++){
|
||||
sum+= src[(radius+x)*srcStep] - src[(x-radius-1)*srcStep];
|
||||
dst[x*dstStep]= (sum*inv + (1<<15))>>16;
|
||||
}
|
||||
|
||||
for(; x<w; x++){
|
||||
sum+= src[(2*w-radius-x-1)*srcStep] - src[(x-radius-1)*srcStep];
|
||||
dst[x*dstStep]= (sum*inv + (1<<15))>>16;
|
||||
}
|
||||
}
|
||||
|
||||
//copied from xine
|
||||
static void blur2(uint8_t *dst, uint8_t *src, int w, int radius, int power, int dstStep, int srcStep){
|
||||
uint8_t temp[2][4096];
|
||||
uint8_t *a= temp[0], *b=temp[1];
|
||||
|
||||
if(radius){
|
||||
blur(a, src, w, radius, 1, srcStep);
|
||||
for(; power>2; power--){
|
||||
uint8_t *c;
|
||||
blur(b, a, w, radius, 1, 1);
|
||||
c=a; a=b; b=c;
|
||||
}
|
||||
if(power>1)
|
||||
blur(dst, a, w, radius, dstStep, 1);
|
||||
else{
|
||||
int i;
|
||||
for(i=0; i<w; i++)
|
||||
dst[i*dstStep]= a[i];
|
||||
}
|
||||
}else{
|
||||
int i;
|
||||
for(i=0; i<w; i++)
|
||||
dst[i*dstStep]= src[i*srcStep];
|
||||
}
|
||||
}
|
||||
|
||||
int overclock_malloc(int w, int h)
|
||||
{
|
||||
const int len = w* h;
|
||||
@@ -116,8 +58,10 @@ void overclock_free()
|
||||
if(oc_buf[0]) free( oc_buf[0] );
|
||||
}
|
||||
|
||||
void overclock_apply(VJFrame *frame, int width, int height, int n, int radius )
|
||||
void overclock_apply(VJFrame *frame, int n, int radius )
|
||||
{
|
||||
const unsigned int width = frame->width;
|
||||
const unsigned int height = frame->height;
|
||||
int x,y,dx,dy;
|
||||
uint8_t t = 0;
|
||||
int s = 0;
|
||||
|
||||
@@ -20,11 +20,8 @@
|
||||
|
||||
#ifndef OVERCLOCK_H
|
||||
#define OVERCLOCK_H
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <libvje/vje.h>
|
||||
vj_effect *overclock_init(int w, int h);
|
||||
int overclock_malloc(int w, int h );
|
||||
void overclock_free();
|
||||
void overclock_apply(VJFrame *frame, int width, int height, int val, int r);
|
||||
void overclock_apply(VJFrame *frame, int val, int r);
|
||||
#endif
|
||||
|
||||
@@ -441,8 +441,7 @@ extern void chromapalette_apply( VJFrame *frame, int a, int r, int g, int b, int
|
||||
extern void uvcorrect_apply(VJFrame *frame, int angle, int urot_center,
|
||||
int vrot_center, int iuFactor, int ivFactor, int uvmin, int uvmax );
|
||||
extern void dissolve_apply(VJFrame *frame,VJFrame *frame2, int opacity);
|
||||
|
||||
extern void overclock_apply(VJFrame *frame, int w, int h, int val, int r);
|
||||
extern void overclock_apply(VJFrame *frame, int val, int r);
|
||||
|
||||
uint8_t *bgpush_get_bg_frame(unsigned int plane);
|
||||
|
||||
|
||||
@@ -248,7 +248,7 @@ static void vj_effman_apply_image_effect(
|
||||
nervous_apply( frames[0], frames[0]->width, frames[0]->height,
|
||||
arg[0]); break;
|
||||
case VJ_IMAGE_EFFECT_OVERCLOCK:
|
||||
overclock_apply(frames[0], frames[0]->width, frames[0]->height,arg[0],arg[1]);
|
||||
overclock_apply(frames[0],arg[0],arg[1]);
|
||||
break;
|
||||
case VJ_IMAGE_EFFECT_COLORHIS:
|
||||
colorhis_apply( frames[0], frames[0]->width,frames[0]->height,arg[0],arg[1],arg[2],arg[3] );
|
||||
|
||||
Reference in New Issue
Block a user