From 2269aff9aa52acecd53ecfce599383b5bfcdc2ce Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 13 Sep 2015 06:46:04 +0200 Subject: [PATCH] Cleanups --- gfx/video_filters/2xbr.c | 19 +++++++++---------- gfx/video_filters/2xsai.c | 11 ++++++----- gfx/video_filters/epx.c | 5 +++-- gfx/video_filters/phosphor2x.c | 24 +++++++++++------------- 4 files changed, 29 insertions(+), 30 deletions(-) diff --git a/gfx/video_filters/2xbr.c b/gfx/video_filters/2xbr.c index 8c6943eaaa..be8118aace 100644 --- a/gfx/video_filters/2xbr.c +++ b/gfx/video_filters/2xbr.c @@ -617,16 +617,13 @@ static void twoxbr_generic_rgb565(void *data, unsigned width, unsigned height, int first, int last, uint16_t *src, unsigned src_stride, uint16_t *dst, unsigned dst_stride) { - uint16_t pg_red_mask, pg_green_mask, pg_blue_mask, pg_lbmask; - unsigned nextline, finish; + unsigned finish; struct filter_data *filt = (struct filter_data*)data; - - pg_red_mask = RED_MASK565; - pg_green_mask = GREEN_MASK565; - pg_blue_mask = BLUE_MASK565; - pg_lbmask = PG_LBMASK565; - nextline = (last) ? 0 : src_stride; - + uint16_t pg_red_mask = RED_MASK565; + uint16_t pg_green_mask = GREEN_MASK565; + uint16_t pg_blue_mask = BLUE_MASK565; + uint16_t pg_lbmask = PG_LBMASK565; + unsigned nextline = (last) ? 0 : src_stride; for (; height; height--) { @@ -711,8 +708,9 @@ static void twoxbr_generic_packets(void *data, const void *input, unsigned width, unsigned height, size_t input_stride) { - struct filter_data *filt = (struct filter_data*)data; unsigned i; + struct filter_data *filt = (struct filter_data*)data; + for (i = 0; i < filt->threads; i++) { struct softfilter_thread_data *thr = @@ -720,6 +718,7 @@ static void twoxbr_generic_packets(void *data, unsigned y_start = (height * i) / filt->threads; unsigned y_end = (height * (i + 1)) / filt->threads; + thr->out_data = (uint8_t*)output + y_start * TWOXBR_SCALE * output_stride; thr->in_data = (const uint8_t*)input + y_start * input_stride; diff --git a/gfx/video_filters/2xsai.c b/gfx/video_filters/2xsai.c index d89f2f14e8..07de2faadd 100644 --- a/gfx/video_filters/2xsai.c +++ b/gfx/video_filters/2xsai.c @@ -228,8 +228,8 @@ static void twoxsai_generic_xrgb8888(unsigned width, unsigned height, int first, int last, uint32_t *src, unsigned src_stride, uint32_t *dst, unsigned dst_stride) { - unsigned nextline, finish; - nextline = (last) ? 0 : src_stride; + unsigned finish; + unsigned nextline = (last) ? 0 : src_stride; for (; height; height--) { @@ -260,8 +260,8 @@ static void twoxsai_generic_rgb565(unsigned width, unsigned height, int first, int last, uint16_t *src, unsigned src_stride, uint16_t *dst, unsigned dst_stride) { - unsigned nextline, finish; - nextline = (last) ? 0 : src_stride; + unsigned finish; + unsigned nextline = (last) ? 0 : src_stride; for (; height; height--) { @@ -326,8 +326,9 @@ static void twoxsai_generic_packets(void *data, const void *input, unsigned width, unsigned height, size_t input_stride) { - struct filter_data *filt = (struct filter_data*)data; unsigned i; + struct filter_data *filt = (struct filter_data*)data; + for (i = 0; i < filt->threads; i++) { struct softfilter_thread_data *thr = diff --git a/gfx/video_filters/epx.c b/gfx/video_filters/epx.c index ac5722f7e7..065cd7a3d4 100644 --- a/gfx/video_filters/epx.c +++ b/gfx/video_filters/epx.c @@ -110,10 +110,10 @@ static void EPX_16(int width, int height, uint16_t *src, unsigned src_stride, uint16_t *dst, unsigned dst_stride) { + int w, prevline; uint16_t colorX, colorA, colorB, colorC, colorD; uint16_t *sP = NULL, *uP = NULL, *lP = NULL; uint32_t *dP1 = NULL, *dP2 = NULL; - int w, prevline; if (!src || !dst) return; @@ -398,8 +398,9 @@ static void epx_generic_packets(void *data, void *output, size_t output_stride, const void *input, unsigned width, unsigned height, size_t input_stride) { - struct filter_data *filt = (struct filter_data*)data; unsigned i; + struct filter_data *filt = (struct filter_data*)data; + for (i = 0; i < filt->threads; i++) { struct softfilter_thread_data *thr = diff --git a/gfx/video_filters/phosphor2x.c b/gfx/video_filters/phosphor2x.c index c9d846add6..92d4a3dc82 100644 --- a/gfx/video_filters/phosphor2x.c +++ b/gfx/video_filters/phosphor2x.c @@ -81,12 +81,11 @@ struct filter_data static INLINE unsigned max_component_xrgb8888(uint32_t color) { - unsigned red, green, blue, max; - red = red_xrgb8888(color); - green = green_xrgb8888(color); - blue = blue_xrgb8888(color); + unsigned red = red_xrgb8888(color); + unsigned green = green_xrgb8888(color); + unsigned blue = blue_xrgb8888(color); + unsigned max = red; - max = red; max = (green > max) ? green : max; max = (blue > max) ? blue : max; return max; @@ -94,12 +93,11 @@ static INLINE unsigned max_component_xrgb8888(uint32_t color) static INLINE unsigned max_component_rgb565(uint32_t color) { - unsigned red, green, blue, max; - red = red_rgb565(color); - green = green_rgb565(color); - blue = blue_rgb565(color); + unsigned red = red_rgb565(color); + unsigned green = green_rgb565(color); + unsigned blue = blue_rgb565(color); + unsigned max = red; - max = red; max = (green > max) ? green : max; max = (blue > max) ? blue : max; return max; @@ -326,12 +324,12 @@ static void phosphor2x_generic_xrgb8888(void *data, for (y = 0; y < height; y++) { - uint32_t *out_line, *scan_out; + uint32_t *scan_out; unsigned x; const uint32_t *in_line = (const uint32_t*)(src + y * (src_stride)); /* output in a scanlines fashion. */ - out_line = (uint32_t*)(dst + y * (dst_stride) * 2); + uint32_t *out_line = (uint32_t*)(dst + y * (dst_stride) * 2); /* Bilinear stretch horizontally. */ blit_linear_line_xrgb8888(out_line, in_line, width); @@ -377,7 +375,7 @@ static void phosphor2x_generic_rgb565(void *data, uint16_t *scan_out; unsigned x; /* Output in a scanlines fashion. */ - uint16_t *out_line = (uint16_t*)(dst + y * (dst_stride) * 2); + uint16_t *out_line = (uint16_t*)(dst + y * (dst_stride) * 2); const uint16_t *in_line = (const uint16_t*)(src + y * (src_stride)); /* Bilinear stretch horizontally. */