Skip to content

Commit b9e2715

Browse files
committed
修复vivid视频转码后颜色不对的问题
1 parent 80ba303 commit b9e2715

1 file changed

Lines changed: 20 additions & 3 deletions

File tree

app/src/main/java/com/demo/mediacodec/transcode/GLUtils.java

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,22 +68,39 @@ public class GLUtils {
6868
" vTextureCoord = (uSTMatrix * aTextureCoord).xy; \n" +
6969
"} \n";
7070

71+
// public static final String YUV_FRAGMENT_SHADER = "" +
72+
// "#version 300 es \n" +
73+
// "#extension GL_EXT_YUV_target : require \n" +
74+
// "#extension GL_OES_EGL_image_external : require \n" +
75+
// "#extension GL_OES_EGL_image_external_essl3 : require \n" +
76+
// "precision highp float; \n" +
77+
// " \n" +
78+
// "uniform samplerExternalOES sTexture; \n" +
79+
// " \n" +
80+
// "in vec2 vTextureCoord; \n" +
81+
// "layout (yuv) out vec4 color; \n" +
82+
// " \n" +
83+
// "void main() \n" +
84+
// "{ \n" +
85+
// " vec3 rgbColor = texture(sTexture, vTextureCoord).rgb; \n" +
86+
// " color = vec4(rgb_2_yuv(rgbColor, itu_601_full_range), 1.0); \n" +
87+
// "} \n";
88+
7189
public static final String YUV_FRAGMENT_SHADER = "" +
7290
"#version 300 es \n" +
7391
"#extension GL_EXT_YUV_target : require \n" +
7492
"#extension GL_OES_EGL_image_external : require \n" +
7593
"#extension GL_OES_EGL_image_external_essl3 : require \n" +
7694
"precision highp float; \n" +
7795
" \n" +
78-
"uniform samplerExternalOES sTexture; \n" +
96+
"uniform __samplerExternal2DY2YEXT sTexture; \n" +
7997
" \n" +
8098
"in vec2 vTextureCoord; \n" +
8199
"layout (yuv) out vec4 color; \n" +
82100
" \n" +
83101
"void main() \n" +
84102
"{ \n" +
85-
" vec3 rgbColor = texture(sTexture, vTextureCoord).rgb; \n" +
86-
" color = vec4(rgb_2_yuv(rgbColor, itu_601_full_range), 1.0); \n" +
103+
" color = texture(sTexture, vTextureCoord); \n" +
87104
"} \n";
88105

89106
//endregion

0 commit comments

Comments
 (0)