diff options
author | dec05eba <dec05eba@protonmail.com> | 2023-07-25 04:46:45 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2023-07-25 04:46:45 +0200 |
commit | bee99a69e39a0061790ffddbb84c991988681db5 (patch) | |
tree | ef2a669c0db24ce80c71fc4c5f2489396fde410a /src | |
parent | 44f84748f83d57a9b2c1dcefb47b676051435498 (diff) |
Dont use jpeg color range (fixes too dark image on amd/intel in flatpak)
Diffstat (limited to 'src')
-rw-r--r-- | src/color_conversion.c | 11 | ||||
-rw-r--r-- | src/main.cpp | 16 |
2 files changed, 16 insertions, 11 deletions
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]; |