Improve color accuracy on amd/intel

This commit is contained in:
dec05eba 2023-07-23 04:21:38 +02:00
parent 41883be889
commit fafb1e84f0
2 changed files with 8 additions and 8 deletions

View File

@ -18,10 +18,10 @@ 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.257, 0.439, -0.148, 0.0,\n" \
" 0.504, -0.368, -0.291, 0.0,\n" \
" 0.098, -0.071, 0.439, 0.0,\n" \
" 0.0625, 0.500, 0.500, 1.0);"
#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.0, 0.500, 0.500, 1.0);"
static int load_shader_rgb(gsr_shader *shader, gsr_egl *egl, int *rotation_uniform) {
char vertex_shader[2048];

View File

@ -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');