mirror of
https://github.com/libretro/RetroArch
synced 2025-02-21 00:40:09 +00:00
Turn scaler_ctx_scale_direct into inline function
This commit is contained in:
parent
d6eda2502d
commit
d51edd8239
@ -1102,11 +1102,13 @@ static bool omap_gfx_read_viewport(void *data, uint8_t *buffer, bool is_idle)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void omap_gfx_set_texture_frame(void *data, const void *frame, bool rgb32,
|
static void omap_gfx_set_texture_frame(void *data,
|
||||||
|
const void *frame, bool rgb32,
|
||||||
unsigned width, unsigned height, float alpha)
|
unsigned width, unsigned height, float alpha)
|
||||||
{
|
{
|
||||||
omap_video_t *vid = (omap_video_t*)data;
|
omap_video_t *vid = (omap_video_t*)data;
|
||||||
enum scaler_pix_fmt format = rgb32 ? SCALER_FMT_ARGB8888 : SCALER_FMT_RGBA4444;
|
enum scaler_pix_fmt format = rgb32 ?
|
||||||
|
SCALER_FMT_ARGB8888 : SCALER_FMT_RGBA4444;
|
||||||
|
|
||||||
video_frame_scale(
|
video_frame_scale(
|
||||||
&vid->menu.scaler,
|
&vid->menu.scaler,
|
||||||
@ -1119,6 +1121,8 @@ static void omap_gfx_set_texture_frame(void *data, const void *frame, bool rgb32
|
|||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
width * (rgb32 ? sizeof(uint32_t) : sizeof(uint16_t)));
|
width * (rgb32 ? sizeof(uint32_t) : sizeof(uint16_t)));
|
||||||
|
scaler_ctx_scale_direct(&vid->menu.scaler, vid->menu.frame,
|
||||||
|
frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void omap_gfx_set_texture_enable(void *data, bool state, bool full_screen)
|
static void omap_gfx_set_texture_enable(void *data, bool state, bool full_screen)
|
||||||
|
@ -360,6 +360,8 @@ static bool sdl_gfx_frame(void *data, const void *frame, unsigned width,
|
|||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
pitch);
|
pitch);
|
||||||
|
scaler_ctx_scale_direct(&vid->scaler, vid->screen->pixels,
|
||||||
|
frame);
|
||||||
|
|
||||||
#ifdef HAVE_MENU
|
#ifdef HAVE_MENU
|
||||||
menu_driver_frame(video_info);
|
menu_driver_frame(video_info);
|
||||||
@ -485,6 +487,8 @@ static void sdl_set_texture_frame(void *data, const void *frame, bool rgb32,
|
|||||||
height,
|
height,
|
||||||
width * (rgb32 ? sizeof(uint32_t) : sizeof(uint16_t))
|
width * (rgb32 ? sizeof(uint32_t) : sizeof(uint16_t))
|
||||||
);
|
);
|
||||||
|
scaler_ctx_scale_direct(&vid->menu.scaler, vid->menu.frame->pixels,
|
||||||
|
frame);
|
||||||
|
|
||||||
SDL_SetAlpha(vid->menu.frame, SDL_SRCALPHA, 255.0 * alpha);
|
SDL_SetAlpha(vid->menu.frame, SDL_SRCALPHA, 255.0 * alpha);
|
||||||
}
|
}
|
||||||
|
@ -237,6 +237,7 @@ static void gl1_renderchain_copy_frame(
|
|||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
pitch);
|
pitch);
|
||||||
|
scaler_ctx_scale_direct(&gl->scaler, &gl->conv_buffer, frame);
|
||||||
data_buf = gl->conv_buffer;
|
data_buf = gl->conv_buffer;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1340,6 +1340,7 @@ static void gl2_renderchain_copy_frame(
|
|||||||
&gl->scaler,
|
&gl->scaler,
|
||||||
gl->conv_buffer,
|
gl->conv_buffer,
|
||||||
frame, width, height, pitch);
|
frame, width, height, pitch);
|
||||||
|
scaler_ctx_scale_direct(&gl->scaler, gl->conv_buffer, frame);
|
||||||
glTexSubImage2D(GL_TEXTURE_2D,
|
glTexSubImage2D(GL_TEXTURE_2D,
|
||||||
0, 0, 0, width, height, gl->texture_type,
|
0, 0, 0, width, height, gl->texture_type,
|
||||||
gl->texture_fmt, gl->conv_buffer);
|
gl->texture_fmt, gl->conv_buffer);
|
||||||
@ -1400,6 +1401,7 @@ static void gl2_renderchain_copy_frame(
|
|||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
pitch);
|
pitch);
|
||||||
|
scaler_ctx_scale_direct(&gl->scaler, &gl->conv_buffer, frame);
|
||||||
data_buf = gl->conv_buffer;
|
data_buf = gl->conv_buffer;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2356,14 +2356,20 @@ void video_driver_frame(const void *data, unsigned width,
|
|||||||
(video_driver_pix_fmt == RETRO_PIXEL_FORMAT_0RGB1555) &&
|
(video_driver_pix_fmt == RETRO_PIXEL_FORMAT_0RGB1555) &&
|
||||||
(data != RETRO_HW_FRAME_BUFFER_VALID))
|
(data != RETRO_HW_FRAME_BUFFER_VALID))
|
||||||
{
|
{
|
||||||
if (video_pixel_frame_scale(
|
struct scaler_ctx *scaler = video_driver_scaler_ptr->scaler;
|
||||||
video_driver_scaler_ptr->scaler,
|
void *output = video_driver_scaler_ptr->scaler_out;
|
||||||
video_driver_scaler_ptr->scaler_out,
|
|
||||||
data, width, height, pitch))
|
scaler->in_width = width;
|
||||||
{
|
scaler->in_height = height;
|
||||||
data = video_driver_scaler_ptr->scaler_out;
|
scaler->out_width = width;
|
||||||
pitch = video_driver_scaler_ptr->scaler->out_stride;
|
scaler->out_height = height;
|
||||||
}
|
scaler->in_stride = (int)pitch;
|
||||||
|
scaler->out_stride = width * sizeof(uint16_t);
|
||||||
|
|
||||||
|
scaler_ctx_scale_direct(scaler, output, data);
|
||||||
|
|
||||||
|
data = output;
|
||||||
|
pitch = scaler->out_stride;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2403,14 +2409,16 @@ void video_driver_frame(const void *data, unsigned width,
|
|||||||
" || Frames: %" PRIu64,
|
" || Frames: %" PRIu64,
|
||||||
(uint64_t)video_driver_frame_count);
|
(uint64_t)video_driver_frame_count);
|
||||||
}
|
}
|
||||||
snprintf(video_driver_window_title, sizeof(video_driver_window_title),
|
snprintf(video_driver_window_title,
|
||||||
|
sizeof(video_driver_window_title),
|
||||||
"%s%s%s", title, video_info.fps_text,
|
"%s%s%s", title, video_info.fps_text,
|
||||||
video_info.framecount_show ? frames_text : "");
|
video_info.framecount_show ? frames_text : "");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!string_is_equal(video_driver_window_title, title))
|
if (!string_is_equal(video_driver_window_title, title))
|
||||||
strlcpy(video_driver_window_title, title, sizeof(video_driver_window_title));
|
strlcpy(video_driver_window_title,
|
||||||
|
title, sizeof(video_driver_window_title));
|
||||||
}
|
}
|
||||||
|
|
||||||
curr_time = new_time;
|
curr_time = new_time;
|
||||||
@ -2468,7 +2476,8 @@ void video_driver_frame(const void *data, unsigned width,
|
|||||||
|| video_driver_record_gpu_buffer
|
|| video_driver_record_gpu_buffer
|
||||||
) && recording_data
|
) && recording_data
|
||||||
)
|
)
|
||||||
recording_dump_frame(data, width, height, pitch, video_info.runloop_is_idle);
|
recording_dump_frame(data, width, height,
|
||||||
|
pitch, video_info.runloop_is_idle);
|
||||||
|
|
||||||
if (data && video_driver_state_filter &&
|
if (data && video_driver_state_filter &&
|
||||||
video_driver_frame_filter(data, &video_info, width, height, pitch,
|
video_driver_frame_filter(data, &video_info, width, height, pitch,
|
||||||
|
@ -33,15 +33,18 @@
|
|||||||
|
|
||||||
RETRO_BEGIN_DECLS
|
RETRO_BEGIN_DECLS
|
||||||
|
|
||||||
#define scaler_ctx_scale_direct(ctx, output, input) \
|
static INLINE void scaler_ctx_scale_direct(
|
||||||
{ \
|
struct scaler_ctx *scaler,
|
||||||
if (ctx && ctx->unscaled && ctx->direct_pixconv) \
|
void *output,
|
||||||
/* Just perform straight pixel conversion. */ \
|
const void *input)
|
||||||
ctx->direct_pixconv(output, input, \
|
{
|
||||||
ctx->out_width, ctx->out_height, \
|
/* Just perform straight pixel conversion if possible. */
|
||||||
ctx->out_stride, ctx->in_stride); \
|
if (scaler && scaler->unscaled && scaler->direct_pixconv)
|
||||||
else \
|
scaler->direct_pixconv(output, input,
|
||||||
scaler_ctx_scale(ctx, output, input); \
|
scaler->out_width, scaler->out_height,
|
||||||
|
scaler->out_stride, scaler->in_stride);
|
||||||
|
else
|
||||||
|
scaler_ctx_scale(scaler, output, input);
|
||||||
}
|
}
|
||||||
|
|
||||||
static INLINE void video_frame_convert_rgb16_to_rgb32(
|
static INLINE void video_frame_convert_rgb16_to_rgb32(
|
||||||
@ -65,8 +68,6 @@ static INLINE void video_frame_convert_rgb16_to_rgb32(
|
|||||||
|
|
||||||
scaler->in_stride = in_pitch;
|
scaler->in_stride = in_pitch;
|
||||||
scaler->out_stride = width * sizeof(uint32_t);
|
scaler->out_stride = width * sizeof(uint32_t);
|
||||||
|
|
||||||
scaler_ctx_scale_direct(scaler, output, input);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static INLINE void video_frame_scale(
|
static INLINE void video_frame_scale(
|
||||||
@ -88,10 +89,10 @@ static INLINE void video_frame_scale(
|
|||||||
|| pitch != (unsigned)scaler->in_stride
|
|| pitch != (unsigned)scaler->in_stride
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
scaler->in_fmt = format;
|
scaler->in_fmt = format;
|
||||||
scaler->in_width = width;
|
scaler->in_width = width;
|
||||||
scaler->in_height = height;
|
scaler->in_height = height;
|
||||||
scaler->in_stride = pitch;
|
scaler->in_stride = pitch;
|
||||||
|
|
||||||
scaler->out_width = scaler_width;
|
scaler->out_width = scaler_width;
|
||||||
scaler->out_height = scaler_height;
|
scaler->out_height = scaler_height;
|
||||||
@ -99,8 +100,6 @@ static INLINE void video_frame_scale(
|
|||||||
|
|
||||||
scaler_ctx_gen_filter(scaler);
|
scaler_ctx_gen_filter(scaler);
|
||||||
}
|
}
|
||||||
|
|
||||||
scaler_ctx_scale_direct(scaler, output, input);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static INLINE void video_frame_record_scale(
|
static INLINE void video_frame_record_scale(
|
||||||
@ -133,8 +132,6 @@ static INLINE void video_frame_record_scale(
|
|||||||
|
|
||||||
scaler_ctx_gen_filter(scaler);
|
scaler_ctx_gen_filter(scaler);
|
||||||
}
|
}
|
||||||
|
|
||||||
scaler_ctx_scale_direct(scaler, output, input);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static INLINE void video_frame_convert_argb8888_to_abgr8888(
|
static INLINE void video_frame_convert_argb8888_to_abgr8888(
|
||||||
@ -156,8 +153,6 @@ static INLINE void video_frame_convert_argb8888_to_abgr8888(
|
|||||||
|
|
||||||
scaler->in_stride = in_pitch;
|
scaler->in_stride = in_pitch;
|
||||||
scaler->out_stride = width * sizeof(uint32_t);
|
scaler->out_stride = width * sizeof(uint32_t);
|
||||||
|
|
||||||
scaler_ctx_scale_direct(scaler, output, input);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static INLINE void video_frame_convert_to_bgr24(
|
static INLINE void video_frame_convert_to_bgr24(
|
||||||
@ -176,8 +171,6 @@ static INLINE void video_frame_convert_to_bgr24(
|
|||||||
|
|
||||||
scaler->in_stride = in_pitch;
|
scaler->in_stride = in_pitch;
|
||||||
scaler->out_stride = width * 3;
|
scaler->out_stride = width * 3;
|
||||||
|
|
||||||
scaler_ctx_scale_direct(scaler, output, input);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static INLINE void video_frame_convert_rgba_to_bgr(
|
static INLINE void video_frame_convert_rgba_to_bgr(
|
||||||
@ -197,24 +190,6 @@ static INLINE void video_frame_convert_rgba_to_bgr(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static INLINE bool video_pixel_frame_scale(
|
|
||||||
struct scaler_ctx *scaler,
|
|
||||||
void *output, const void *data,
|
|
||||||
unsigned width, unsigned height,
|
|
||||||
size_t pitch)
|
|
||||||
{
|
|
||||||
scaler->in_width = width;
|
|
||||||
scaler->in_height = height;
|
|
||||||
scaler->out_width = width;
|
|
||||||
scaler->out_height = height;
|
|
||||||
scaler->in_stride = (int)pitch;
|
|
||||||
scaler->out_stride = width * sizeof(uint16_t);
|
|
||||||
|
|
||||||
scaler_ctx_scale_direct(scaler, output, data);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
RETRO_END_DECLS
|
RETRO_END_DECLS
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1007,6 +1007,10 @@ static void ffmpeg_scale_input(ffmpeg_t *handle,
|
|||||||
vid->height,
|
vid->height,
|
||||||
vid->pitch,
|
vid->pitch,
|
||||||
shrunk);
|
shrunk);
|
||||||
|
scaler_ctx_scale_direct(
|
||||||
|
&handle->video.scaler,
|
||||||
|
handle->video.conv_frame->data[0],
|
||||||
|
vid->data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user