aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO12
-rw-r--r--include/color_conversion.h2
-rw-r--r--src/color_conversion.c11
-rw-r--r--src/main.cpp16
4 files changed, 26 insertions, 15 deletions
diff --git a/TODO b/TODO
index 33710de..316e492 100644
--- a/TODO
+++ b/TODO
@@ -51,7 +51,6 @@ Window capture performance on steam deck isn't good when playing the witcher 3 f
Monitor capture on steam deck is slightly below the game fps, but only when capturing on the steam deck screen. If capturing on another monitor, there is no issue.
Is this related to the dma buf rotation issue? different modifier being slow? does this always happen?
-Make sure rgb to yuv color conversion is 100% correct.
Fallback to vaapi copy in kms if opengl version fails. This can happen on steam deck for some reason (driver bug?). Also vaapi copy uses less gpu since it uses video codec unit to copy.
Test if vaapi copy version uses less memory than opengl version.
@@ -60,7 +59,6 @@ Intel is a bit weird with monitor capture and multiple monitors. If one of the m
How about if multiple monitors are rotated?
When using multiple monitors kms grab the target monitor instead of the whole screen.
-Enable opus/flac again. It's broken right now when merging audio inputs. The audio gets a lot of static noise!
Support vp8/vp9/av1. This is especially important on amd which on some distros (such as Manjaro) where hardware accelerated h264/hevc is disabled in the mesa package.
@@ -81,4 +79,12 @@ Support screen rotation.
When nvidia supports hardware cursor then capture the cursor. Right now the cursor is captured because it's a software cursor so it's composed on the dma buf.
CPU usage is pretty high on AMD/Intel/(Nvidia(wayland)), why? opening and closing fds, creating egl, cuda association, is slow when done every frame. Test if desktop portal screencast has better performance.
-Capture is broken on amd on wlroots. It's disabled at the moment and instead uses kms capture. Find out why we get a black screen in wlroots. \ No newline at end of file
+Capture is broken on amd on wlroots. It's disabled at the moment and instead uses kms capture. Find out why we get a black screen in wlroots.
+
+First video and audio frame should be posted immediately instead of waiting 1000/fps milliseconds, to improve latency for remote desktop future functionality.
+
+Support vulkan video encoding. That might workaround forced p2 state nvidia driver "bug". Ffmpeg supports vulkan video encoding if it's encoding with --enable-vulkan
+
+Enable opus/flac again. It's broken right now when merging audio inputs. The audio gets a lot of static noise!
+
+It may be possible to improve color conversion rgb->yuv shader for color edges by biasing colors to an edge, instead of letting color overlaying with bilinear filtering handle it. \ No newline at end of file
diff --git a/include/color_conversion.h b/include/color_conversion.h
index e60f4d0..def710d 100644
--- a/include/color_conversion.h
+++ b/include/color_conversion.h
@@ -10,7 +10,7 @@ typedef enum {
typedef enum {
GSR_DESTINATION_COLOR_RGB,
- GSR_DESTINATION_COLOR_NV12
+ GSR_DESTINATION_COLOR_NV12 /* YUV420, BT709, limited */
} gsr_destination_color;
typedef struct {
diff --git a/src/color_conversion.c b/src/color_conversion.c
index 6d9f9d2..caf0488 100644
--- a/src/color_conversion.c
+++ b/src/color_conversion.c
@@ -18,10 +18,11 @@ static float abs_f(float v) {
" 0.0, 0.0, 0.0, 1.0);\n" \
"}\n"
-#define RGB_TO_YUV "const mat4 RGBtoYUV = mat4(0.2126, 0.5000, -0.1146, 0.0,\n" \
- " 0.7152, -0.4542, -0.3854, 0.0,\n" \
- " 0.0722, -0.0468, 0.5000, 0.0,\n" \
- " 0.0000, 0.5000, 0.5000, 1.0);"
+/* BT709 limited */
+#define RGB_TO_YUV "const mat4 RGBtoYUV = mat4(0.1826, -0.1006, 0.4392, 0.0,\n" \
+ " 0.6142, -0.3386, -0.3989, 0.0,\n" \
+ " 0.0620, 0.4392, -0.0403, 0.0,\n" \
+ " 0.0625, 0.5000, 0.5000, 1.0);"
static int load_shader_rgb(gsr_shader *shader, gsr_egl *egl, int *rotation_uniform) {
char vertex_shader[2048];
@@ -122,7 +123,7 @@ static unsigned int load_shader_uv(gsr_shader *shader, gsr_egl *egl, int *rotati
"void main() \n"
"{ \n"
" vec4 pixel = texture(tex1, texcoords_out); \n"
- " FragColor.xy = (RGBtoYUV * vec4(pixel.rgb, 1.0)).zy; \n"
+ " FragColor.xy = (RGBtoYUV * vec4(pixel.rgb, 1.0)).yz; \n"
" FragColor.w = pixel.a; \n"
"} \n";
diff --git a/src/main.cpp b/src/main.cpp
index 56ff05f..879dc2a 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -301,10 +301,10 @@ static AVCodecContext *create_video_codec_context(AVPixelFormat pix_fmt,
}
codec_context->max_b_frames = 0;
codec_context->pix_fmt = pix_fmt;
- codec_context->color_range = AVCOL_RANGE_JPEG; // TODO: Amd/nvidia?
- codec_context->color_primaries = AVCOL_PRI_BT709;
- codec_context->color_trc = AVCOL_TRC_BT709;
- codec_context->colorspace = AVCOL_SPC_BT709;
+ //codec_context->color_range = AVCOL_RANGE_JPEG; // TODO: Amd/nvidia?
+ //codec_context->color_primaries = AVCOL_PRI_BT709;
+ //codec_context->color_trc = AVCOL_TRC_BT709;
+ //codec_context->colorspace = AVCOL_SPC_BT709;
//codec_context->chroma_sample_location = AVCHROMA_LOC_CENTER;
if(codec->id == AV_CODEC_ID_HEVC)
codec_context->codec_tag = MKTAG('h', 'v', 'c', '1');
@@ -682,7 +682,7 @@ static void usage_full() {
fprintf(stderr, " -ac Audio codec to use. Should be either 'aac', 'opus' or 'flac'. Defaults to 'opus' for .mp4/.mkv files, otherwise defaults to 'aac'.\n");
fprintf(stderr, " 'opus' and 'flac' is only supported by .mp4/.mkv files. 'opus' is recommended for best performance and smallest audio size.\n");
fprintf(stderr, "\n");
- fprintf(stderr, " -oc Overclock memory transfer rate to the maximum performance level. This only applies to NVIDIA and exists to overcome a bug in NVIDIA driver where performance level\n");
+ fprintf(stderr, " -oc Overclock memory transfer rate to the maximum performance level. This only applies to NVIDIA on X11 and exists to overcome a bug in NVIDIA driver where performance level. The same issue exists on Wayland but overclocking is not possible on Wayland.\n");
fprintf(stderr, " is dropped when you record a game. Only needed if you are recording a game that is bottlenecked by GPU.\n");
fprintf(stderr, " Works only if your have \"Coolbits\" set to \"12\" in NVIDIA X settings, see README for more information. Note! use at your own risk! Optional, disabled by default.\n");
fprintf(stderr, "\n");
@@ -1323,7 +1323,11 @@ int main(int argc, char **argv) {
}
if(gpu_inf.vendor != GSR_GPU_VENDOR_NVIDIA && overclock) {
- fprintf(stderr, "Info: overclock option has no effect on amd/intel, ignoring option...\n");
+ fprintf(stderr, "Info: overclock option has no effect on amd/intel, ignoring option\n");
+ }
+
+ if(gpu_inf.vendor == GSR_GPU_VENDOR_NVIDIA && overclock && wayland) {
+ fprintf(stderr, "Info: overclocking is not possible on nvidia on wayland, ignoring option\n");
}
char card_path[128];