mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-27 18:20:27 +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;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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(
|
||||
&vid->menu.scaler,
|
||||
@ -1119,6 +1121,8 @@ static void omap_gfx_set_texture_frame(void *data, const void *frame, bool rgb32
|
||||
width,
|
||||
height,
|
||||
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)
|
||||
|
@ -360,6 +360,8 @@ static bool sdl_gfx_frame(void *data, const void *frame, unsigned width,
|
||||
width,
|
||||
height,
|
||||
pitch);
|
||||
scaler_ctx_scale_direct(&vid->scaler, vid->screen->pixels,
|
||||
frame);
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
menu_driver_frame(video_info);
|
||||
@ -485,6 +487,8 @@ static void sdl_set_texture_frame(void *data, const void *frame, bool rgb32,
|
||||
height,
|
||||
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);
|
||||
}
|
||||
|
@ -237,6 +237,7 @@ static void gl1_renderchain_copy_frame(
|
||||
width,
|
||||
height,
|
||||
pitch);
|
||||
scaler_ctx_scale_direct(&gl->scaler, &gl->conv_buffer, frame);
|
||||
data_buf = gl->conv_buffer;
|
||||
}
|
||||
else
|
||||
|
@ -1340,6 +1340,7 @@ static void gl2_renderchain_copy_frame(
|
||||
&gl->scaler,
|
||||
gl->conv_buffer,
|
||||
frame, width, height, pitch);
|
||||
scaler_ctx_scale_direct(&gl->scaler, gl->conv_buffer, frame);
|
||||
glTexSubImage2D(GL_TEXTURE_2D,
|
||||
0, 0, 0, width, height, gl->texture_type,
|
||||
gl->texture_fmt, gl->conv_buffer);
|
||||
@ -1400,6 +1401,7 @@ static void gl2_renderchain_copy_frame(
|
||||
width,
|
||||
height,
|
||||
pitch);
|
||||
scaler_ctx_scale_direct(&gl->scaler, &gl->conv_buffer, frame);
|
||||
data_buf = gl->conv_buffer;
|
||||
}
|
||||
else
|
||||
|
@ -2356,14 +2356,20 @@ void video_driver_frame(const void *data, unsigned width,
|
||||
(video_driver_pix_fmt == RETRO_PIXEL_FORMAT_0RGB1555) &&
|
||||
(data != RETRO_HW_FRAME_BUFFER_VALID))
|
||||
{
|
||||
if (video_pixel_frame_scale(
|
||||
video_driver_scaler_ptr->scaler,
|
||||
video_driver_scaler_ptr->scaler_out,
|
||||
data, width, height, pitch))
|
||||
{
|
||||
data = video_driver_scaler_ptr->scaler_out;
|
||||
pitch = video_driver_scaler_ptr->scaler->out_stride;
|
||||
}
|
||||
struct scaler_ctx *scaler = video_driver_scaler_ptr->scaler;
|
||||
void *output = video_driver_scaler_ptr->scaler_out;
|
||||
|
||||
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);
|
||||
|
||||
data = output;
|
||||
pitch = scaler->out_stride;
|
||||
}
|
||||
|
||||
|
||||
@ -2403,14 +2409,16 @@ void video_driver_frame(const void *data, unsigned width,
|
||||
" || Frames: %" PRIu64,
|
||||
(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,
|
||||
video_info.framecount_show ? frames_text : "");
|
||||
}
|
||||
else
|
||||
{
|
||||
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;
|
||||
@ -2468,7 +2476,8 @@ void video_driver_frame(const void *data, unsigned width,
|
||||
|| video_driver_record_gpu_buffer
|
||||
) && 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 &&
|
||||
video_driver_frame_filter(data, &video_info, width, height, pitch,
|
||||
|
@ -33,15 +33,18 @@
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
#define scaler_ctx_scale_direct(ctx, output, input) \
|
||||
{ \
|
||||
if (ctx && ctx->unscaled && ctx->direct_pixconv) \
|
||||
/* Just perform straight pixel conversion. */ \
|
||||
ctx->direct_pixconv(output, input, \
|
||||
ctx->out_width, ctx->out_height, \
|
||||
ctx->out_stride, ctx->in_stride); \
|
||||
else \
|
||||
scaler_ctx_scale(ctx, output, input); \
|
||||
static INLINE void scaler_ctx_scale_direct(
|
||||
struct scaler_ctx *scaler,
|
||||
void *output,
|
||||
const void *input)
|
||||
{
|
||||
/* Just perform straight pixel conversion if possible. */
|
||||
if (scaler && scaler->unscaled && scaler->direct_pixconv)
|
||||
scaler->direct_pixconv(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(
|
||||
@ -65,8 +68,6 @@ static INLINE void video_frame_convert_rgb16_to_rgb32(
|
||||
|
||||
scaler->in_stride = in_pitch;
|
||||
scaler->out_stride = width * sizeof(uint32_t);
|
||||
|
||||
scaler_ctx_scale_direct(scaler, output, input);
|
||||
}
|
||||
|
||||
static INLINE void video_frame_scale(
|
||||
@ -88,10 +89,10 @@ static INLINE void video_frame_scale(
|
||||
|| pitch != (unsigned)scaler->in_stride
|
||||
)
|
||||
{
|
||||
scaler->in_fmt = format;
|
||||
scaler->in_width = width;
|
||||
scaler->in_height = height;
|
||||
scaler->in_stride = pitch;
|
||||
scaler->in_fmt = format;
|
||||
scaler->in_width = width;
|
||||
scaler->in_height = height;
|
||||
scaler->in_stride = pitch;
|
||||
|
||||
scaler->out_width = scaler_width;
|
||||
scaler->out_height = scaler_height;
|
||||
@ -99,8 +100,6 @@ static INLINE void video_frame_scale(
|
||||
|
||||
scaler_ctx_gen_filter(scaler);
|
||||
}
|
||||
|
||||
scaler_ctx_scale_direct(scaler, output, input);
|
||||
}
|
||||
|
||||
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_scale_direct(scaler, output, input);
|
||||
}
|
||||
|
||||
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->out_stride = width * sizeof(uint32_t);
|
||||
|
||||
scaler_ctx_scale_direct(scaler, output, input);
|
||||
}
|
||||
|
||||
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->out_stride = width * 3;
|
||||
|
||||
scaler_ctx_scale_direct(scaler, output, input);
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
#endif
|
||||
|
@ -1007,6 +1007,10 @@ static void ffmpeg_scale_input(ffmpeg_t *handle,
|
||||
vid->height,
|
||||
vid->pitch,
|
||||
shrunk);
|
||||
scaler_ctx_scale_direct(
|
||||
&handle->video.scaler,
|
||||
handle->video.conv_frame->data[0],
|
||||
vid->data);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user