Moved all filters into interframe.cpp file, original code by EmporerArthur

This commit is contained in:
Zach Bacon 2016-11-19 20:43:07 -05:00
parent 180ee60c7a
commit 0ba8166467
4 changed files with 41 additions and 24 deletions

View File

@ -2,6 +2,8 @@
#include <stdlib.h>
#include <memory.h>
#include "interframe.hpp"
#ifdef MMX
extern "C" bool cpu_mmx;
#endif
@ -16,7 +18,6 @@ static uint8_t *frm1 = NULL;
static uint8_t *frm2 = NULL;
static uint8_t *frm3 = NULL;
extern int RGB_LOW_BITS_MASK;
extern uint32_t qRGB_COLOR_MASK[2];
static void Init()
@ -31,11 +32,12 @@ static void Init()
void InterframeCleanup()
{
//Hack to prevent double freeing *It looks like this is not being called in a thread safe manner)
if(frm1)
free(frm1);
if(frm2)
if(frm2 && (frm1 != frm2))
free(frm2);
if(frm3)
if(frm3 && (frm1 != frm3) && (frm2 != frm3))
free(frm3);
frm1 = frm2 = frm3 = NULL;
}

View File

@ -0,0 +1,31 @@
/// Interframe blending filters
#ifndef INTERFRAME_HPP
#define INTERFRAME_HPP
extern int RGB_LOW_BITS_MASK;
static void Init();
// call ifc to ignore previous frame / when starting new
void InterframeCleanup();
// all 4 are MMX-accelerated if enabled
void SmartIB(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height);
void SmartIB32(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height);
void MotionBlurIB(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height);
void MotionBlurIB32(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height);
#ifdef MMX
static void SmartIB_MMX(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height);
static void SmartIB32_MMX(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height);
static void MotionBlurIB_MMX(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height);
static void MotionBlurIB32_MMX(uint8_t *srcPtr, uint32_t srcPitch, int width, int starty, int height);
#endif
//Options for if start is 0
void SmartIB(uint8_t *srcPtr, uint32_t srcPitch, int width, int height);
void SmartIB32(uint8_t *srcPtr, uint32_t srcPitch, int width, int height);
void MotionBlurIB(uint8_t *srcPtr, uint32_t srcPitch, int width, int height);
void MotionBlurIB32(uint8_t *srcPtr, uint32_t srcPitch, int width, int height);
#endif //INTERFRAME_HPP

View File

@ -22,6 +22,8 @@
#include "filters.h"
#include "../filters/interframe.hpp"
//
// Screen filters
//
@ -164,15 +166,6 @@ FilterFunc initFilter(const int f, const int colorDepth, const int srcWidth)
return func;
}
//
// Interframe blending filters
//
extern void SmartIB(uint8_t*, uint32_t, int, int);
extern void SmartIB32(uint8_t*, uint32_t, int, int);
extern void MotionBlurIB(uint8_t*, uint32_t, int, int);
extern void MotionBlurIB32(uint8_t*, uint32_t, int, int);
struct IFBFilterDesc {
char name[30];
IFBFilterFunc func16;

View File

@ -6,6 +6,9 @@
// most 16-bit filters require space in src rounded up to uint32_t
// those that take delta take 1 src line of pixels, rounded up to uint32_t size
// initial value appears to be all-0xff
#include "../filters/interframe.hpp"
void Pixelate32(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h);
void Pixelate(uint8_t* src, uint32_t spitch, uint8_t* delta, uint8_t* dst, uint32_t dstp, int w, int h);
// next 3*2 use Init_2xSaI(555|565) and do not take into account
@ -68,16 +71,4 @@ void xbrz4x32(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t ds
void xbrz5x32(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h);
void xbrz6x32(uint8_t* src, uint32_t spitch, uint8_t*, uint8_t* dst, uint32_t dstp, int w, int h);
// call ifc to ignore previous frame / when starting new
void InterframeCleanup();
// all 4 are MMX-accelerated if enabled
void SmartIB(uint8_t* src, uint32_t spitch, int width, int height);
void SmartIB32(uint8_t* src, uint32_t spitch, int width, int height);
void MotionBlurIB(uint8_t* src, uint32_t spitch, int width, int height);
void MotionBlurIB32(uint8_t* src, uint32_t spitch, int width, int height);
void SmartIB(uint8_t* src, uint32_t spitch, int width, int starty, int height);
void SmartIB32(uint8_t* src, uint32_t spitch, int width, int starty, int height);
void MotionBlurIB(uint8_t* src, uint32_t spitch, int width, int starty, int height);
void MotionBlurIB32(uint8_t* src, uint32_t spitch, int width, int starty, int height);
#endif /* FILTERS_H */