mirror of
https://github.com/libretro/RetroArch
synced 2025-02-06 09:40:06 +00:00
Cleanup
This commit is contained in:
parent
e427a2d2fa
commit
22022f8133
@ -39,9 +39,11 @@
|
||||
#include "../menu/menu_setting.h"
|
||||
#endif
|
||||
|
||||
#include "video_frame.h"
|
||||
#include "video_thread_wrapper.h"
|
||||
#include "../frontend/frontend_driver.h"
|
||||
#include "video_context_driver.h"
|
||||
|
||||
#include "../frontend/frontend_driver.h"
|
||||
#include "../record/record_driver.h"
|
||||
#include "../config.def.h"
|
||||
#include "../configuration.h"
|
||||
@ -2082,37 +2084,6 @@ unsigned video_pixel_get_alignment(unsigned pitch)
|
||||
return 8;
|
||||
}
|
||||
|
||||
static bool video_pixel_frame_scale(const void *data,
|
||||
unsigned width, unsigned height,
|
||||
size_t pitch)
|
||||
{
|
||||
static struct retro_perf_counter video_frame_conv = {0};
|
||||
|
||||
performance_counter_init(&video_frame_conv, "video_frame_conv");
|
||||
|
||||
if ( !data
|
||||
|| video_driver_get_pixel_format() != RETRO_PIXEL_FORMAT_0RGB1555)
|
||||
return false;
|
||||
if (data == RETRO_HW_FRAME_BUFFER_VALID)
|
||||
return false;
|
||||
|
||||
performance_counter_start(&video_frame_conv);
|
||||
|
||||
video_driver_scaler_ptr->scaler->in_width = width;
|
||||
video_driver_scaler_ptr->scaler->in_height = height;
|
||||
video_driver_scaler_ptr->scaler->out_width = width;
|
||||
video_driver_scaler_ptr->scaler->out_height = height;
|
||||
video_driver_scaler_ptr->scaler->in_stride = pitch;
|
||||
video_driver_scaler_ptr->scaler->out_stride = width * sizeof(uint16_t);
|
||||
|
||||
scaler_ctx_scale(video_driver_scaler_ptr->scaler,
|
||||
video_driver_scaler_ptr->scaler_out, data);
|
||||
|
||||
performance_counter_stop(&video_frame_conv);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* video_driver_frame:
|
||||
* @data : pointer to data of the video frame.
|
||||
@ -2138,7 +2109,10 @@ void video_driver_frame(const void *data, unsigned width,
|
||||
return;
|
||||
|
||||
if (video_driver_scaler_ptr &&
|
||||
video_pixel_frame_scale(data, width, height, pitch))
|
||||
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;
|
||||
|
@ -15,6 +15,8 @@
|
||||
|
||||
#include <libretro.h>
|
||||
|
||||
#include "../performance_counters.h"
|
||||
|
||||
#include "video_driver.h"
|
||||
#include "video_frame.h"
|
||||
|
||||
@ -175,3 +177,35 @@ void video_frame_convert_rgba_to_bgr(
|
||||
dst[2] = src[0];
|
||||
}
|
||||
}
|
||||
|
||||
bool video_pixel_frame_scale(
|
||||
struct scaler_ctx *scaler,
|
||||
void *output, const void *data,
|
||||
unsigned width, unsigned height,
|
||||
size_t pitch)
|
||||
{
|
||||
static struct retro_perf_counter video_frame_conv = {0};
|
||||
|
||||
performance_counter_init(&video_frame_conv, "video_frame_conv");
|
||||
|
||||
if ( !data
|
||||
|| video_driver_get_pixel_format() != RETRO_PIXEL_FORMAT_0RGB1555)
|
||||
return false;
|
||||
if (data == RETRO_HW_FRAME_BUFFER_VALID)
|
||||
return false;
|
||||
|
||||
performance_counter_start(&video_frame_conv);
|
||||
|
||||
scaler->in_width = width;
|
||||
scaler->in_height = height;
|
||||
scaler->out_width = width;
|
||||
scaler->out_height = height;
|
||||
scaler->in_stride = pitch;
|
||||
scaler->out_stride = width * sizeof(uint16_t);
|
||||
|
||||
scaler_ctx_scale(scaler, output, data);
|
||||
|
||||
performance_counter_stop(&video_frame_conv);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -67,4 +67,11 @@ void video_frame_convert_rgba_to_bgr(
|
||||
void *dst_data,
|
||||
unsigned width);
|
||||
|
||||
bool video_pixel_frame_scale(
|
||||
struct scaler_ctx *scaler,
|
||||
void *output,
|
||||
const void *data,
|
||||
unsigned width, unsigned height,
|
||||
size_t pitch);
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user