mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-14 22:38:34 +00:00
Split up pixconv code to gfx/video_pixel_converter.c
This commit is contained in:
parent
a87940afc5
commit
7a0c7bd712
@ -102,6 +102,7 @@ OBJ += frontend/frontend.o \
|
||||
input/input_driver.o \
|
||||
gfx/video_driver.o \
|
||||
gfx/video_monitor.o \
|
||||
gfx/video_pixel_converter.o \
|
||||
osk/osk_driver.o \
|
||||
camera/camera_driver.o \
|
||||
menu/menu_driver.o \
|
||||
|
36
driver.c
36
driver.c
@ -22,6 +22,7 @@
|
||||
#include "compat/posix_string.h"
|
||||
#include "gfx/video_thread_wrapper.h"
|
||||
#include "gfx/video_monitor.h"
|
||||
#include "gfx/video_pixel_converter.h"
|
||||
#include "audio/audio_monitor.h"
|
||||
#include "gfx/gfx_common.h"
|
||||
|
||||
@ -332,41 +333,6 @@ bool driver_update_system_av_info(const struct retro_system_av_info *info)
|
||||
return true;
|
||||
}
|
||||
|
||||
static void deinit_pixel_converter(void)
|
||||
{
|
||||
scaler_ctx_gen_reset(&driver.scaler);
|
||||
memset(&driver.scaler, 0, sizeof(driver.scaler));
|
||||
free(driver.scaler_out);
|
||||
driver.scaler_out = NULL;
|
||||
}
|
||||
|
||||
static bool init_video_pixel_converter(unsigned size)
|
||||
{
|
||||
/* This function can be called multiple times
|
||||
* without deiniting first on consoles. */
|
||||
deinit_pixel_converter();
|
||||
|
||||
/* If pixel format is not 0RGB1555, we don't need to do
|
||||
* any internal pixel conversion. */
|
||||
if (g_extern.system.pix_fmt != RETRO_PIXEL_FORMAT_0RGB1555)
|
||||
return true;
|
||||
|
||||
RARCH_WARN("0RGB1555 pixel format is deprecated, and will be slower. For 15/16-bit, RGB565 format is preferred.\n");
|
||||
|
||||
driver.scaler.scaler_type = SCALER_TYPE_POINT;
|
||||
driver.scaler.in_fmt = SCALER_FMT_0RGB1555;
|
||||
|
||||
/* TODO: Pick either ARGB8888 or RGB565 depending on driver. */
|
||||
driver.scaler.out_fmt = SCALER_FMT_RGB565;
|
||||
|
||||
if (!scaler_ctx_gen_filter(&driver.scaler))
|
||||
return false;
|
||||
|
||||
driver.scaler_out = calloc(sizeof(uint16_t), size * size);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void deinit_video_filter(void)
|
||||
{
|
||||
rarch_softfilter_free(g_extern.filter.filter);
|
||||
|
54
gfx/video_pixel_converter.c
Normal file
54
gfx/video_pixel_converter.c
Normal file
@ -0,0 +1,54 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2015 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "video_pixel_converter.h"
|
||||
#include <gfx/scaler/pixconv.h>
|
||||
#include "../general.h"
|
||||
|
||||
void deinit_pixel_converter(void)
|
||||
{
|
||||
scaler_ctx_gen_reset(&driver.scaler);
|
||||
memset(&driver.scaler, 0, sizeof(driver.scaler));
|
||||
free(driver.scaler_out);
|
||||
driver.scaler_out = NULL;
|
||||
}
|
||||
|
||||
bool init_video_pixel_converter(unsigned size)
|
||||
{
|
||||
/* This function can be called multiple times
|
||||
* without deiniting first on consoles. */
|
||||
deinit_pixel_converter();
|
||||
|
||||
/* If pixel format is not 0RGB1555, we don't need to do
|
||||
* any internal pixel conversion. */
|
||||
if (g_extern.system.pix_fmt != RETRO_PIXEL_FORMAT_0RGB1555)
|
||||
return true;
|
||||
|
||||
RARCH_WARN("0RGB1555 pixel format is deprecated, and will be slower. For 15/16-bit, RGB565 format is preferred.\n");
|
||||
|
||||
driver.scaler.scaler_type = SCALER_TYPE_POINT;
|
||||
driver.scaler.in_fmt = SCALER_FMT_0RGB1555;
|
||||
|
||||
/* TODO: Pick either ARGB8888 or RGB565 depending on driver. */
|
||||
driver.scaler.out_fmt = SCALER_FMT_RGB565;
|
||||
|
||||
if (!scaler_ctx_gen_filter(&driver.scaler))
|
||||
return false;
|
||||
|
||||
driver.scaler_out = calloc(sizeof(uint16_t), size * size);
|
||||
|
||||
return true;
|
||||
}
|
34
gfx/video_pixel_converter.h
Normal file
34
gfx/video_pixel_converter.h
Normal file
@ -0,0 +1,34 @@
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2015 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
||||
* of the GNU General Public License as published by the Free Software Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
* PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _VIDEO_PIXEL_CONVERTER_H
|
||||
#define _VIDEO_PIXEL_CONVERTER_H
|
||||
|
||||
#include <boolean.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void deinit_pixel_converter(void);
|
||||
|
||||
bool init_video_pixel_converter(unsigned size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
@ -507,6 +507,7 @@ DRIVERS
|
||||
============================================================ */
|
||||
#include "../gfx/video_driver.c"
|
||||
#include "../gfx/video_monitor.c"
|
||||
#include "../gfx/video_pixel_converter.c"
|
||||
#include "../input/input_driver.c"
|
||||
#include "../audio/audio_driver.c"
|
||||
#include "../audio/audio_monitor.c"
|
||||
|
Loading…
Reference in New Issue
Block a user