mirror of
https://github.com/libretro/RetroArch
synced 2025-04-02 16:20:39 +00:00
Create video_frame_scale and video_frame_filter
This commit is contained in:
parent
f507e78765
commit
7ed7ee599c
@ -36,33 +36,13 @@
|
|||||||
#include "netplay.h"
|
#include "netplay.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
static void video_frame_scale(const void *data,
|
||||||
* video_frame:
|
unsigned width, unsigned height,
|
||||||
* @data : pointer to data of the video frame.
|
size_t pitch)
|
||||||
* @width : width of the video frame.
|
|
||||||
* @height : height of the video frame.
|
|
||||||
* @pitch : pitch of the video frame.
|
|
||||||
*
|
|
||||||
* Video frame render callback function.
|
|
||||||
**/
|
|
||||||
static void video_frame(const void *data, unsigned width,
|
|
||||||
unsigned height, size_t pitch)
|
|
||||||
{
|
|
||||||
const char *msg = NULL;
|
|
||||||
|
|
||||||
if (!driver.video_active)
|
|
||||||
return;
|
|
||||||
|
|
||||||
g_extern.frame_cache.data = data;
|
|
||||||
g_extern.frame_cache.width = width;
|
|
||||||
g_extern.frame_cache.height = height;
|
|
||||||
g_extern.frame_cache.pitch = pitch;
|
|
||||||
|
|
||||||
if (g_extern.system.pix_fmt == RETRO_PIXEL_FORMAT_0RGB1555 &&
|
|
||||||
data && data != RETRO_HW_FRAME_BUFFER_VALID)
|
|
||||||
{
|
{
|
||||||
RARCH_PERFORMANCE_INIT(video_frame_conv);
|
RARCH_PERFORMANCE_INIT(video_frame_conv);
|
||||||
RARCH_PERFORMANCE_START(video_frame_conv);
|
RARCH_PERFORMANCE_START(video_frame_conv);
|
||||||
|
|
||||||
driver.scaler.in_width = width;
|
driver.scaler.in_width = width;
|
||||||
driver.scaler.in_height = height;
|
driver.scaler.in_height = height;
|
||||||
driver.scaler.out_width = width;
|
driver.scaler.out_width = width;
|
||||||
@ -71,25 +51,16 @@ static void video_frame(const void *data, unsigned width,
|
|||||||
driver.scaler.out_stride = width * sizeof(uint16_t);
|
driver.scaler.out_stride = width * sizeof(uint16_t);
|
||||||
|
|
||||||
scaler_ctx_scale(&driver.scaler, driver.scaler_out, data);
|
scaler_ctx_scale(&driver.scaler, driver.scaler_out, data);
|
||||||
|
|
||||||
data = driver.scaler_out;
|
data = driver.scaler_out;
|
||||||
pitch = driver.scaler.out_stride;
|
pitch = driver.scaler.out_stride;
|
||||||
|
|
||||||
RARCH_PERFORMANCE_STOP(video_frame_conv);
|
RARCH_PERFORMANCE_STOP(video_frame_conv);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Slightly messy code,
|
static void video_frame_filter(const void *data,
|
||||||
* but we really need to do processing before blocking on VSync
|
unsigned width, unsigned height,
|
||||||
* for best possible scheduling.
|
size_t pitch)
|
||||||
*/
|
|
||||||
if (driver.recording_data && (!g_extern.filter.filter
|
|
||||||
|| !g_settings.video.post_filter_record || !data
|
|
||||||
|| g_extern.record_gpu_buffer)
|
|
||||||
)
|
|
||||||
rarch_recording_dump_frame(data, width, height, pitch);
|
|
||||||
|
|
||||||
msg = msg_queue_pull(g_extern.msg_queue);
|
|
||||||
driver.current_msg = msg;
|
|
||||||
|
|
||||||
if (g_extern.filter.filter && data)
|
|
||||||
{
|
{
|
||||||
unsigned owidth = 0, oheight = 0, opitch = 0;
|
unsigned owidth = 0, oheight = 0, opitch = 0;
|
||||||
|
|
||||||
@ -115,6 +86,48 @@ static void video_frame(const void *data, unsigned width,
|
|||||||
pitch = opitch;
|
pitch = opitch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* video_frame:
|
||||||
|
* @data : pointer to data of the video frame.
|
||||||
|
* @width : width of the video frame.
|
||||||
|
* @height : height of the video frame.
|
||||||
|
* @pitch : pitch of the video frame.
|
||||||
|
*
|
||||||
|
* Video frame render callback function.
|
||||||
|
**/
|
||||||
|
static void video_frame(const void *data, unsigned width,
|
||||||
|
unsigned height, size_t pitch)
|
||||||
|
{
|
||||||
|
const char *msg = NULL;
|
||||||
|
|
||||||
|
if (!driver.video_active)
|
||||||
|
return;
|
||||||
|
|
||||||
|
g_extern.frame_cache.data = data;
|
||||||
|
g_extern.frame_cache.width = width;
|
||||||
|
g_extern.frame_cache.height = height;
|
||||||
|
g_extern.frame_cache.pitch = pitch;
|
||||||
|
|
||||||
|
if (g_extern.system.pix_fmt == RETRO_PIXEL_FORMAT_0RGB1555 &&
|
||||||
|
data && data != RETRO_HW_FRAME_BUFFER_VALID)
|
||||||
|
video_frame_scale(data, width, height, pitch);
|
||||||
|
|
||||||
|
/* Slightly messy code,
|
||||||
|
* but we really need to do processing before blocking on VSync
|
||||||
|
* for best possible scheduling.
|
||||||
|
*/
|
||||||
|
if (driver.recording_data && (!g_extern.filter.filter
|
||||||
|
|| !g_settings.video.post_filter_record || !data
|
||||||
|
|| g_extern.record_gpu_buffer)
|
||||||
|
)
|
||||||
|
rarch_recording_dump_frame(data, width, height, pitch);
|
||||||
|
|
||||||
|
msg = msg_queue_pull(g_extern.msg_queue);
|
||||||
|
driver.current_msg = msg;
|
||||||
|
|
||||||
|
if (g_extern.filter.filter && data)
|
||||||
|
video_frame_filter(data, width, height, pitch);
|
||||||
|
|
||||||
if (!driver.video->frame(driver.video_data, data, width, height, pitch, msg))
|
if (!driver.video->frame(driver.video_data, data, width, height, pitch, msg))
|
||||||
driver.video_active = false;
|
driver.video_active = false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user