Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_25606643
ijkplayer
提交
073d3874
I
ijkplayer
项目概览
qq_25606643
/
ijkplayer
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
ijkplayer
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
073d3874
编写于
12月 21, 2015
作者:
Z
Zhang Rui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ios/shader: share same color conversion matrix
上级
60e023c7
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
38 addition
and
33 deletion
+38
-33
ios/IJKMediaPlayer/IJKMediaPlayer/ijkmedia/ijksdl/ios/IJKSDLGLRender.h
...layer/IJKMediaPlayer/ijkmedia/ijksdl/ios/IJKSDLGLRender.h
+14
-0
ios/IJKMediaPlayer/IJKMediaPlayer/ijkmedia/ijksdl/ios/IJKSDLGLRenderI420.m
...r/IJKMediaPlayer/ijkmedia/ijksdl/ios/IJKSDLGLRenderI420.m
+24
-15
ios/IJKMediaPlayer/IJKMediaPlayer/ijkmedia/ijksdl/ios/IJKSDLGLRenderNV12.m
...r/IJKMediaPlayer/ijkmedia/ijksdl/ios/IJKSDLGLRenderNV12.m
+0
-18
未找到文件。
ios/IJKMediaPlayer/IJKMediaPlayer/ijkmedia/ijksdl/ios/IJKSDLGLRender.h
浏览文件 @
073d3874
...
...
@@ -35,3 +35,17 @@
-
(
void
)
render
:
(
SDL_VoutOverlay
*
)
overlay
;
-
(
BOOL
)
prepareDisplay
;
@end
// BT.709, which is the standard for HDTV.
static
const
GLfloat
kColorConversion709
[]
=
{
1
.
164
,
1
.
164
,
1
.
164
,
0
.
0
,
-
0
.
213
,
2
.
112
,
1
.
793
,
-
0
.
533
,
0
.
0
,
};
// BT.601, which is the standard for SDTV.
static
const
GLfloat
kColorConversion601
[]
=
{
1
.
164
,
1
.
164
,
1
.
164
,
0
.
0
,
-
0
.
392
,
2
.
017
,
1
.
596
,
-
0
.
813
,
0
.
0
,
};
ios/IJKMediaPlayer/IJKMediaPlayer/ijkmedia/ijksdl/ios/IJKSDLGLRenderI420.m
浏览文件 @
073d3874
...
...
@@ -28,27 +28,32 @@
static
NSString
*
const
g_yuvFragmentShaderString
=
IJK_SHADER_STRING
(
varying
highp
vec2
v_texcoord
;
uniform
sampler2D
s_texture_y
;
uniform
sampler2D
s_texture_u
;
uniform
sampler2D
s_texture_v
;
precision
mediump
float
;
uniform
sampler2D
SamplerY
;
uniform
sampler2D
SamplerU
;
uniform
sampler2D
SamplerV
;
uniform
mat3
colorConversionMatrix
;
void
main
()
{
highp
float
y
=
texture2D
(
s_texture_y
,
v_texcoord
).
r
;
highp
float
u
=
texture2D
(
s_texture_u
,
v_texcoord
).
r
-
0
.
5
;
highp
float
v
=
texture2D
(
s_texture_v
,
v_texcoord
).
r
-
0
.
5
;
highp
float
r
=
y
+
1
.
40200
*
v
;
highp
float
g
=
y
-
0
.
34414
*
u
-
0
.
71414
*
v
;
highp
float
b
=
y
+
1
.
77200
*
u
;
gl_FragColor
=
vec4
(
r
,
g
,
b
,
1
.
0
);
mediump
vec3
yuv
;
lowp
vec3
rgb
;
// Subtract constants to map the video range start at 0
yuv
.
x
=
(
texture2D
(
SamplerY
,
v_texcoord
).
r
-
(
16
.
0
/
255
.
0
))
;
yuv
.
y
=
(
texture2D
(
SamplerU
,
v_texcoord
).
r
-
0
.
5
)
;
yuv
.
z
=
(
texture2D
(
SamplerV
,
v_texcoord
).
r
-
0
.
5
)
;
rgb
=
colorConversionMatrix
*
yuv
;
gl_FragColor
=
vec4
(
r
gb
,
1
);
}
);
@implementation
IJKSDLGLRenderI420
{
GLint
_uniform
[
1
];
GLint
_uniformSamplers
[
3
];
GLuint
_textures
[
3
];
const
GLfloat
*
_preferredConversion
;
}
-
(
BOOL
)
isValid
...
...
@@ -63,9 +68,10 @@ static NSString *const g_yuvFragmentShaderString = IJK_SHADER_STRING
-
(
void
)
resolveUniforms
:
(
GLuint
)
program
{
_uniformSamplers
[
0
]
=
glGetUniformLocation
(
program
,
"s_texture_y"
);
_uniformSamplers
[
1
]
=
glGetUniformLocation
(
program
,
"s_texture_u"
);
_uniformSamplers
[
2
]
=
glGetUniformLocation
(
program
,
"s_texture_v"
);
_uniformSamplers
[
0
]
=
glGetUniformLocation
(
program
,
"SamplerY"
);
_uniformSamplers
[
1
]
=
glGetUniformLocation
(
program
,
"SamplerU"
);
_uniformSamplers
[
2
]
=
glGetUniformLocation
(
program
,
"SamplerV"
);
_uniform
[
0
]
=
glGetUniformLocation
(
program
,
"colorConversionMatrix"
);
}
-
(
void
)
render
:
(
SDL_VoutOverlay
*
)
overlay
...
...
@@ -85,6 +91,8 @@ static NSString *const g_yuvFragmentShaderString = IJK_SHADER_STRING
if
(
0
==
_textures
[
0
])
glGenTextures
(
3
,
_textures
);
_preferredConversion
=
kColorConversion709
;
const
UInt8
*
pixels
[
3
]
=
{
overlay
->
pixels
[
0
],
overlay
->
pixels
[
1
],
overlay
->
pixels
[
2
]
};
const
NSUInteger
widths
[
3
]
=
{
overlay
->
pitches
[
0
],
overlay
->
pitches
[
1
],
overlay
->
pitches
[
2
]
};
const
NSUInteger
heights
[
3
]
=
{
frameHeight
,
frameHeight
/
2
,
frameHeight
/
2
};
...
...
@@ -121,6 +129,7 @@ static NSString *const g_yuvFragmentShaderString = IJK_SHADER_STRING
glUniform1i
(
_uniformSamplers
[
i
],
i
);
}
glUniformMatrix3fv
(
_uniform
[
0
],
1
,
GL_FALSE
,
_preferredConversion
);
return
YES
;
}
...
...
ios/IJKMediaPlayer/IJKMediaPlayer/ijkmedia/ijksdl/ios/IJKSDLGLRenderNV12.m
浏览文件 @
073d3874
...
...
@@ -45,24 +45,6 @@ static NSString *const g_nv12FragmentShaderString = IJK_SHADER_STRING
}
);
// BT.601, which is the standard for SDTV.
static
const
GLfloat
kColorConversion601
[]
=
{
1
.
164
,
1
.
164
,
1
.
164
,
0
.
0
,
-
0
.
392
,
2
.
017
,
1
.
596
,
-
0
.
813
,
0
.
0
,
};
// BT.709, which is the standard for HDTV.
static
const
GLfloat
kColorConversion709
[]
=
{
1
.
164
,
1
.
164
,
1
.
164
,
0
.
0
,
-
0
.
213
,
2
.
112
,
1
.
793
,
-
0
.
533
,
0
.
0
,
};
@implementation
IJKSDLGLRenderNV12
{
GLint
_uniform
[
1
];
GLint
_uniformSamplers
[
2
];
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录