Dont use jpeg color range (fixes too dark image on amd/intel in flatpak)
This commit is contained in:
@@ -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";
|
||||
|
||||
|
||||
16
src/main.cpp
16
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];
|
||||
|
||||
Reference in New Issue
Block a user