From c803096d0576dd77d7841992008c2a5b17e2ba1a Mon Sep 17 00:00:00 2001 From: Marten Richter Date: Tue, 26 Jun 2012 07:44:49 +0200 Subject: [PATCH] Add missing files + compile error for wheezy --- GNUmakefile | 2 +- Makefile.nmake | 2 +- glyuv444shader.cc | 106 ++++++++++++++++++++++++++++++++++++++++++++++ glyuv444shader.h | 45 ++++++++++++++++++++ objects.mk | 4 +- 5 files changed, 155 insertions(+), 4 deletions(-) create mode 100755 glyuv444shader.cc create mode 100755 glyuv444shader.h diff --git a/GNUmakefile b/GNUmakefile index 4e386e1..2327226 100755 --- a/GNUmakefile +++ b/GNUmakefile @@ -61,7 +61,7 @@ LIBS = -L/opt/vc/lib -lpthread -lrt -lEGL -lGLESv2 -lopenmaxil -lbcm_host -lav OBJECTS += main.o threadp.o osdopengl.o surfaceopengl.o ledraspberry.o mtdraspberry.o videovpeogl.o audiovpe.o wjpegsimple.o remotelinux.o glshader.o glosdshader.o glyuv400shader.o glyuv444shader.o glmocoshader.o LIBS+= -ljpeg CROSSLIBS = -INCLUDES = -DVOMP_PLATTFORM_RASPBERRY -I/opt/vc/include +INCLUDES = -DVOMP_PLATTFORM_RASPBERRY -I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads CXXFLAGS_DEV += -D__STDC_CONSTANT_MACROS CXXFLAGS_REL += -D__STDC_CONSTANT_MACROS diff --git a/Makefile.nmake b/Makefile.nmake index dbb2fb8..3f97014 100644 --- a/Makefile.nmake +++ b/Makefile.nmake @@ -17,7 +17,7 @@ CROSSLIBS = !include "objects.mk" -OBJECTSWIN = winmain.o threadwin.o remotewin.o ledwin.o mtdwin.o videowin.o audiowin.o osdwin.o surfacewin.o dsallocator.o dssourcefilter.o dssourcepin.o wwinvideofilter.o wwinaudiofilter.o wwinmp3audiofilter.o wjpegsimple.o +OBJECTSWIN = winmain.o threadwin.o remotewin.o ledwin.o mtdwin.o videowin.o audiowin.o osdwin.o surfacewin.o dsallocator.o dssourcefilter.o dssourcepin.o wwinvideofilter.o wwinaudiofilter.o wwinmp3audiofilter.o wjpegsimple.o OBJECTS = $(OBJECTS1) $(OBJECTSWIN) diff --git a/glyuv444shader.cc b/glyuv444shader.cc new file mode 100755 index 0000000..2c90f77 --- /dev/null +++ b/glyuv444shader.cc @@ -0,0 +1,106 @@ +/* + Copyright 2012 Marten Richter + + This file is part of VOMP. + + VOMP is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + VOMP is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with VOMP; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ +#include "glyuv444shader.h" + +const GLchar generic_vertex_shader[] = + "attribute vec4 vec_pos;\n" + "attribute vec2 tex_coord;\n" + "varying vec2 out_texCoord;\n" + "void main()\n" + "{\n" + " gl_Position=vec_pos;\n" + " out_texCoord=tex_coord;\n" + "}\n"; + +const GLchar frame_frag_shader[] = + "precision mediump float;\n" + "uniform sampler2D textureYUV;\n" + "const float uv_corr=0.5;\n" + "const float y_corr=0.0625;\n" + "const mat3 yuvtransform= mat3( 1.164 ,0.0 ,1.596 ,\n" + " 1.164 ,-0.391,-0.813 ,\n" + " 1.164,2.018 , 0.0 );\n" +// "const mat3 yuvtransform= mat3( 1. ,1. ,1. ,\n" +// " 0.0 ,-0.3960,2.029 ,\n" +// " 1.140,-0.581 , 0.0 );\n" +// "const mat3 yuvtransform= mat3( 1. ,0 ,0. ,\n" +// " 0.0 ,1.,0. ,\n" +// " 0.,0. , 1.0 );\n" +// "const mat3 yuvtransform= mat3( 1. ,1. ,1. ,\n" +// " 0.0 ,-0.03960,0.2029 ,\n" +// " 0.1140,-0.0581 , 0.0 );\n" + "varying vec2 out_texCoord;\n" + "void main()\n" + "{\n" + " vec3 help;\n" + "help=texture2D(textureYUV,out_texCoord).rgb-vec3(y_corr,uv_corr,uv_corr);\n" + "gl_FragColor.rgb=help*yuvtransform;\n" + "gl_FragColor.a=1.;\n" + "}\n"; + +GLYuv444Shader::GLYuv444Shader(): GLShader("GLYuv444Shader") +{ + +} + +GLYuv444Shader::~GLYuv444Shader() +{ + //parent does everything +} + +int GLYuv444Shader::init() { + if (!initShaders(generic_vertex_shader, frame_frag_shader)) { + return 0; + } + frame_sampler_locYUV = glGetUniformLocation(shad_program, "textureYUV"); + return 1; + +} + +int GLYuv444Shader::deinit() +{ + return deinitShaders(); +} + +int GLYuv444Shader::PrepareRendering(GLuint yuv_tex) { // This Function setups the rendering pipeline according to the shaders standards + glUseProgram(shad_program); + //Log::getInstance()->log("OSD", Log::WARN, "mark1 glerror %x",glGetError()); + + + + + + glActiveTexture( GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, yuv_tex); + //Log::getInstance()->log("OSD", Log::WARN, "mark3 glerror %x %x",glGetError(),yuv_tex); + glUniform1i(frame_sampler_locYUV, 0); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + + return 1; + +} + +int GLYuv444Shader::BindAttributes() +{ + glBindAttribLocation(shad_program,0,"vec_pos"); + glBindAttribLocation(shad_program,1,"tex_coord"); + return 1; +} diff --git a/glyuv444shader.h b/glyuv444shader.h new file mode 100755 index 0000000..86bcbc6 --- /dev/null +++ b/glyuv444shader.h @@ -0,0 +1,45 @@ +/* + Copyright 2012 Marten Richter + + This file is part of VOMP. + + VOMP is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + VOMP is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with VOMP; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + +#ifndef GL_YUV444SHADER_H +#define GL_YUV444SHADER_H + +#include "glshader.h" + +class GLYuv444Shader: public GLShader { +public: + GLYuv444Shader(); + virtual ~GLYuv444Shader(); + + int init(); + int deinit(); + + int PrepareRendering(GLuint y_tex); // This Function setups the rendering pipeline according to the shaders standards + +protected: + virtual int BindAttributes(); + + GLint frame_sampler_locYUV; + + +}; + + +#endif diff --git a/objects.mk b/objects.mk index ddbd015..0ce596e 100644 --- a/objects.mk +++ b/objects.mk @@ -21,8 +21,8 @@ OBJECTS1 = command.o tcp.o dsock.o thread.o timers.o i18n.o \ playerlivetv.o playerliveradio.o \ wprogressbar.o \ bitmap.o dvbsubtitles.o \ - imagereader.o mediaoptions.o mediaplayer.o mediafile.o \ + imagereader.o mediaoptions.o mediaplayer.o \ serialize.o localmediafile.o playermedia.o \ demuxermedia.o tfeed.o vteletextview.o teletextdecodervbiebu.o \ - teletxt/txtfont.o + teletxt/txtfont.o mediafile.o -- 2.39.5