diff --git a/projects/RPi/patches/xbmc-master/xbmc-master-newclock3.patch b/projects/RPi/patches/xbmc-master/xbmc-master-newclock3.patch index 42e1b668fe..480127d3f9 100644 --- a/projects/RPi/patches/xbmc-master/xbmc-master-newclock3.patch +++ b/projects/RPi/patches/xbmc-master/xbmc-master-newclock3.patch @@ -1,23 +1,23 @@ -From edcac7d62db15484a0fbd441bf26fe31b9c0f8ff Mon Sep 17 00:00:00 2001 +From c1d1853f2676fe21620c425b31154f76328c0a62 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 11 Dec 2013 17:21:54 +0000 -Subject: [PATCH 001/102] Move the reference-counting of Begin and End calls - from DX and GL source files into GUIFontTTF.cpp. +Subject: [PATCH 01/99] Move the reference-counting of Begin and End calls from + DX and GL source files into GUIFontTTF.cpp. --- - xbmc/guilib/GUIFontTTF.cpp | 21 ++++++++ - xbmc/guilib/GUIFontTTF.h | 6 ++- - xbmc/guilib/GUIFontTTFDX.cpp | 79 +++++++++++++---------------- + xbmc/guilib/GUIFontTTF.cpp | 21 ++++++ + xbmc/guilib/GUIFontTTF.h | 6 +- + xbmc/guilib/GUIFontTTFDX.cpp | 79 ++++++++++------------ xbmc/guilib/GUIFontTTFDX.h | 4 +- - xbmc/guilib/GUIFontTTFGL.cpp | 118 +++++++++++++++++++------------------------ + xbmc/guilib/GUIFontTTFGL.cpp | 154 ++++++++++++++++++++----------------------- xbmc/guilib/GUIFontTTFGL.h | 4 +- - 6 files changed, 117 insertions(+), 115 deletions(-) + 6 files changed, 135 insertions(+), 133 deletions(-) diff --git a/xbmc/guilib/GUIFontTTF.cpp b/xbmc/guilib/GUIFontTTF.cpp -index 7014d35..a6b73e5 100644 +index 008c7ae4..e507833 100644 --- a/xbmc/guilib/GUIFontTTF.cpp +++ b/xbmc/guilib/GUIFontTTF.cpp -@@ -309,6 +309,27 @@ bool CGUIFontTTFBase::Load(const CStdString& strFilename, float height, float as +@@ -308,6 +308,27 @@ bool CGUIFontTTFBase::Load(const CStdString& strFilename, float height, float as return true; } @@ -46,7 +46,7 @@ index 7014d35..a6b73e5 100644 { Begin(); diff --git a/xbmc/guilib/GUIFontTTF.h b/xbmc/guilib/GUIFontTTF.h -index 9723a43..c1c4507 100644 +index 4501dbd..df54a5d 100644 --- a/xbmc/guilib/GUIFontTTF.h +++ b/xbmc/guilib/GUIFontTTF.h @@ -77,8 +77,8 @@ class CGUIFontTTFBase @@ -60,7 +60,7 @@ index 9723a43..c1c4507 100644 const CStdString& GetFileName() const { return m_strFileName; }; -@@ -169,6 +169,8 @@ class CGUIFontTTFBase +@@ -168,6 +168,8 @@ class CGUIFontTTFBase CStdString m_strFileName; private: @@ -190,10 +190,10 @@ index 0431085..17dfefe 100644 protected: virtual CBaseTexture* ReallocTexture(unsigned int& newHeight); diff --git a/xbmc/guilib/GUIFontTTFGL.cpp b/xbmc/guilib/GUIFontTTFGL.cpp -index 3358a5a..93b7ea6 100644 +index 6a8291b..97853fd 100644 --- a/xbmc/guilib/GUIFontTTFGL.cpp +++ b/xbmc/guilib/GUIFontTTFGL.cpp -@@ -50,90 +50,78 @@ CGUIFontTTFGL::~CGUIFontTTFGL(void) +@@ -53,108 +53,96 @@ CGUIFontTTFGL::~CGUIFontTTFGL(void) { } @@ -201,17 +201,31 @@ index 3358a5a..93b7ea6 100644 +bool CGUIFontTTFGL::FirstBegin() { - if (m_nestedBeginCount == 0 && m_texture != NULL) -+ if (!m_bTextureLoaded) ++ if (m_textureStatus == TEXTURE_REALLOCATED) { -- if (!m_bTextureLoaded) +- if (m_textureStatus == TEXTURE_REALLOCATED) +- { +- if (glIsTexture(m_nTexture)) +- g_TextureManager.ReleaseHwTexture(m_nTexture); +- m_textureStatus = TEXTURE_VOID; +- } +- +- if (m_textureStatus == TEXTURE_VOID) - { - // Have OpenGL generate a texture object handle for us - glGenTextures(1, (GLuint*) &m_nTexture); -+ // Have OpenGL generate a texture object handle for us -+ glGenTextures(1, (GLuint*) &m_nTexture); ++ if (glIsTexture(m_nTexture)) ++ g_TextureManager.ReleaseHwTexture(m_nTexture); ++ m_textureStatus = TEXTURE_VOID; ++ } - // Bind the texture object - glBindTexture(GL_TEXTURE_2D, m_nTexture); ++ if (m_textureStatus == TEXTURE_VOID) ++ { ++ // Have OpenGL generate a texture object handle for us ++ glGenTextures(1, (GLuint*) &m_nTexture); ++ + // Bind the texture object + glBindTexture(GL_TEXTURE_2D, m_nTexture); #ifdef HAS_GL @@ -227,21 +241,43 @@ index 3358a5a..93b7ea6 100644 - // Set the texture image -- THIS WORKS, so the pixels must be wrong. - glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, m_texture->GetWidth(), m_texture->GetHeight(), 0, -- GL_ALPHA, GL_UNSIGNED_BYTE, m_texture->GetPixels()); +- GL_ALPHA, GL_UNSIGNED_BYTE, 0); +- +- VerifyGLState(); +- m_textureStatus = TEXTURE_UPDATED; +- } + // Set the texture image -- THIS WORKS, so the pixels must be wrong. + glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, m_texture->GetWidth(), m_texture->GetHeight(), 0, -+ GL_ALPHA, GL_UNSIGNED_BYTE, m_texture->GetPixels()); ++ GL_ALPHA, GL_UNSIGNED_BYTE, 0); -- VerifyGLState(); -- m_bTextureLoaded = true; +- if (m_textureStatus == TEXTURE_UPDATED) +- { +- glBindTexture(GL_TEXTURE_2D, m_nTexture); +- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, m_updateY1, m_texture->GetWidth(), m_updateY2 - m_updateY1, GL_ALPHA, GL_UNSIGNED_BYTE, +- m_texture->GetPixels() + m_updateY1 * m_texture->GetPitch()); +- glDisable(GL_TEXTURE_2D); +- +- m_updateY1 = m_updateY2 = 0; +- m_textureStatus = TEXTURE_READY; - } + VerifyGLState(); -+ m_bTextureLoaded = true; ++ m_textureStatus = TEXTURE_UPDATED; + } - // Turn Blending On - glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE_MINUS_DST_ALPHA, GL_ONE); - glEnable(GL_BLEND); ++ if (m_textureStatus == TEXTURE_UPDATED) ++ { ++ glBindTexture(GL_TEXTURE_2D, m_nTexture); ++ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, m_updateY1, m_texture->GetWidth(), m_updateY2 - m_updateY1, GL_ALPHA, GL_UNSIGNED_BYTE, ++ m_texture->GetPixels() + m_updateY1 * m_texture->GetPitch()); ++ glDisable(GL_TEXTURE_2D); ++ ++ m_updateY1 = m_updateY2 = 0; ++ m_textureStatus = TEXTURE_READY; ++ } ++ + // Turn Blending On + glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE_MINUS_DST_ALPHA, GL_ONE); + glEnable(GL_BLEND); @@ -338,7 +374,7 @@ index 3358a5a..93b7ea6 100644 glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT); diff --git a/xbmc/guilib/GUIFontTTFGL.h b/xbmc/guilib/GUIFontTTFGL.h -index a0dacba..6736cf7 100644 +index c0bb53a..735fb3a 100644 --- a/xbmc/guilib/GUIFontTTFGL.h +++ b/xbmc/guilib/GUIFontTTFGL.h @@ -41,8 +41,8 @@ class CGUIFontTTFGL : public CGUIFontTTFBase @@ -356,14 +392,15 @@ index a0dacba..6736cf7 100644 1.9.3 -From 9c2224de3667c4fb7de55f3c08a4b43de9b1c64e Mon Sep 17 00:00:00 2001 +From 336187530dddcb9c84e4f004b7bca154c39ce19d Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 11 Dec 2013 18:47:54 +0000 -Subject: [PATCH 002/102] Convert CGUIFontTTFBase::m_vertex to be managed as a - std::vector. Also retired CGUIFontTTFBase::m_vertex_count and - CGUIFontTTFBase::m_vertex_size because these can be derived from vector - member functions. +Subject: [PATCH 02/99] Convert CGUIFontTTFBase::m_vertex to be managed as a + std::vector. +Also retired CGUIFontTTFBase::m_vertex_count and +CGUIFontTTFBase::m_vertex_size because these can be derived from vector +member functions. --- xbmc/guilib/GUIFontTTF.cpp | 29 +++++------------------------ xbmc/guilib/GUIFontTTF.h | 4 +--- @@ -372,20 +409,20 @@ Subject: [PATCH 002/102] Convert CGUIFontTTFBase::m_vertex to be managed as a 4 files changed, 18 insertions(+), 39 deletions(-) diff --git a/xbmc/guilib/GUIFontTTF.cpp b/xbmc/guilib/GUIFontTTF.cpp -index a6b73e5..3f219d9 100644 +index e507833..0a80471 100644 --- a/xbmc/guilib/GUIFontTTF.cpp +++ b/xbmc/guilib/GUIFontTTF.cpp -@@ -139,8 +139,7 @@ CGUIFontTTFBase::CGUIFontTTFBase(const CStdString& strFileName) +@@ -138,8 +138,7 @@ CGUIFontTTFBase::CGUIFontTTFBase(const CStdString& strFileName) + m_maxChars = 0; m_nestedBeginCount = 0; - m_bTextureLoaded = false; - m_vertex_size = 4*1024; - m_vertex = (SVertex*)malloc(m_vertex_size * sizeof(SVertex)); + m_vertex.reserve(4*1024); m_face = NULL; m_stroker = NULL; -@@ -155,7 +154,6 @@ CGUIFontTTFBase::CGUIFontTTFBase(const CStdString& strFileName) +@@ -154,7 +153,6 @@ CGUIFontTTFBase::CGUIFontTTFBase(const CStdString& strFileName) m_textureScaleX = m_textureScaleY = 0.0; m_ellipsesWidth = m_height = 0.0f; m_color = 0; @@ -393,7 +430,7 @@ index a6b73e5..3f219d9 100644 m_nTexture = 0; } -@@ -216,9 +214,7 @@ void CGUIFontTTFBase::Clear() +@@ -215,9 +213,7 @@ void CGUIFontTTFBase::Clear() g_freeTypeLibrary.ReleaseStroker(m_stroker); m_stroker = NULL; @@ -404,7 +441,7 @@ index a6b73e5..3f219d9 100644 } bool CGUIFontTTFBase::Load(const CStdString& strFilename, float height, float aspect, float lineSpacing, bool border) -@@ -313,7 +309,7 @@ void CGUIFontTTFBase::Begin() +@@ -312,7 +308,7 @@ void CGUIFontTTFBase::Begin() { if (m_nestedBeginCount == 0 && m_texture != NULL && FirstBegin()) { @@ -413,7 +450,7 @@ index a6b73e5..3f219d9 100644 } // Keep track of the nested begin/end calls. m_nestedBeginCount++; -@@ -746,22 +742,9 @@ void CGUIFontTTFBase::RenderCharacter(float posX, float posY, const Character *c +@@ -745,22 +741,9 @@ void CGUIFontTTFBase::RenderCharacter(float posX, float posY, const Character *c float tt = texture.y1 * m_textureScaleY; float tb = texture.y2 * m_textureScaleY; @@ -438,7 +475,7 @@ index a6b73e5..3f219d9 100644 unsigned char r = GET_R(color) , g = GET_G(color) -@@ -828,8 +811,6 @@ void CGUIFontTTFBase::RenderCharacter(float posX, float posY, const Character *c +@@ -827,8 +810,6 @@ void CGUIFontTTFBase::RenderCharacter(float posX, float posY, const Character *c v[3].y = y[2]; v[3].z = z[2]; #endif @@ -448,11 +485,11 @@ index a6b73e5..3f219d9 100644 // Oblique code - original taken from freetype2 (ftsynth.c) diff --git a/xbmc/guilib/GUIFontTTF.h b/xbmc/guilib/GUIFontTTF.h -index c1c4507..35e3cf9 100644 +index df54a5d..10a7060 100644 --- a/xbmc/guilib/GUIFontTTF.h +++ b/xbmc/guilib/GUIFontTTF.h -@@ -157,9 +157,7 @@ class CGUIFontTTFBase - bool m_bTextureLoaded; +@@ -156,9 +156,7 @@ class CGUIFontTTFBase + unsigned int m_nTexture; - SVertex* m_vertex; @@ -503,10 +540,10 @@ index 2f90668..6ef8984 100644 pD3DDevice->SetTransform(D3DTS_WORLD, &orig); diff --git a/xbmc/guilib/GUIFontTTFGL.cpp b/xbmc/guilib/GUIFontTTFGL.cpp -index 93b7ea6..a4e8571 100644 +index 97853fd..b76c6a5 100644 --- a/xbmc/guilib/GUIFontTTFGL.cpp +++ b/xbmc/guilib/GUIFontTTFGL.cpp -@@ -125,13 +125,13 @@ void CGUIFontTTFGL::LastEnd() +@@ -146,13 +146,13 @@ void CGUIFontTTFGL::LastEnd() #ifdef HAS_GL glPushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT); @@ -524,7 +561,7 @@ index 93b7ea6..a4e8571 100644 glPopClientAttrib(); glActiveTexture(GL_TEXTURE1); -@@ -147,10 +147,10 @@ void CGUIFontTTFGL::LastEnd() +@@ -168,10 +168,10 @@ void CGUIFontTTFGL::LastEnd() GLint tex0Loc = g_Windowing.GUIShaderGetCoord0(); // stack object until VBOs will be used @@ -541,10 +578,10 @@ index 93b7ea6..a4e8571 100644 1.9.3 -From f23877edf693b70df11026c47f6e2d7343063447 Mon Sep 17 00:00:00 2001 +From 55ce8a11c8aa11ad253dbf8e5583a8af377a2131 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Mon, 16 Dec 2013 18:58:12 +0000 -Subject: [PATCH 003/102] CGUIFontTTFBase::RenderCharacter can now append to +Subject: [PATCH 03/99] CGUIFontTTFBase::RenderCharacter can now append to arbitrary vectors of vertices rather than only CGUIFontTTFBase::m_vertex --- @@ -553,10 +590,10 @@ Subject: [PATCH 003/102] CGUIFontTTFBase::RenderCharacter can now append to 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/xbmc/guilib/GUIFontTTF.cpp b/xbmc/guilib/GUIFontTTF.cpp -index 3f219d9..1aaf68b 100644 +index 0a80471..848c5c8 100644 --- a/xbmc/guilib/GUIFontTTF.cpp +++ b/xbmc/guilib/GUIFontTTF.cpp -@@ -330,6 +330,8 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors +@@ -329,6 +329,8 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors { Begin(); @@ -565,7 +602,7 @@ index 3f219d9..1aaf68b 100644 // save the origin, which is scaled separately m_originX = x; m_originY = y; -@@ -410,7 +412,7 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors +@@ -409,7 +411,7 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors for (int i = 0; i < 3; i++) { @@ -574,7 +611,7 @@ index 3f219d9..1aaf68b 100644 cursorX += period->advance; } break; -@@ -419,7 +421,7 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors +@@ -418,7 +420,7 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors else if (maxPixelWidth > 0 && cursorX > maxPixelWidth) break; // exceeded max allowed width - stop rendering @@ -583,7 +620,7 @@ index 3f219d9..1aaf68b 100644 if ( alignment & XBFONT_JUSTIFIED ) { if ((*pos & 0xffff) == L' ') -@@ -676,7 +678,7 @@ bool CGUIFontTTFBase::CacheCharacter(wchar_t letter, uint32_t style, Character * +@@ -675,7 +677,7 @@ bool CGUIFontTTFBase::CacheCharacter(wchar_t letter, uint32_t style, Character * return true; } @@ -592,7 +629,7 @@ index 3f219d9..1aaf68b 100644 { // actual image width isn't same as the character width as that is // just baseline width and height should include the descent -@@ -742,8 +744,8 @@ void CGUIFontTTFBase::RenderCharacter(float posX, float posY, const Character *c +@@ -741,8 +743,8 @@ void CGUIFontTTFBase::RenderCharacter(float posX, float posY, const Character *c float tt = texture.y1 * m_textureScaleY; float tb = texture.y2 * m_textureScaleY; @@ -604,7 +641,7 @@ index 3f219d9..1aaf68b 100644 unsigned char r = GET_R(color) diff --git a/xbmc/guilib/GUIFontTTF.h b/xbmc/guilib/GUIFontTTF.h -index 35e3cf9..4a6a696 100644 +index 10a7060..dde0350 100644 --- a/xbmc/guilib/GUIFontTTF.h +++ b/xbmc/guilib/GUIFontTTF.h @@ -109,7 +109,7 @@ class CGUIFontTTFBase @@ -620,31 +657,141 @@ index 35e3cf9..4a6a696 100644 1.9.3 -From 2ff7c7b3e9e883df75cbf2370a666c402a9ac94a Mon Sep 17 00:00:00 2001 +From ba19fcf5df448324fc403267638b65207a04bce4 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 15 Jan 2014 17:18:38 +0000 -Subject: [PATCH 004/102] Add a cache of font glyph bounding box vertices. This - is implemented as a template because ultimately we will key on different - parameters and store values of different types, depending upon whether we - have a GLES or non-GLES backend, and for GLES, whether or not the currently - applicable transformation matrices permit the use of hardware clipping. +Subject: [PATCH 04/99] Add a cache of font glyph bounding box vertices. +This is implemented as a template because ultimately we will key on different +parameters and store values of different types, depending upon whether we +have a GLES or non-GLES backend, and for GLES, whether or not the currently +applicable transformation matrices permit the use of hardware clipping. --- - xbmc/guilib/GUIFontCache.cpp | 105 ++++++++++++++++++++ - xbmc/guilib/GUIFontCache.h | 217 ++++++++++++++++++++++++++++++++++++++++++ - xbmc/guilib/GUIFontTTF.cpp | 181 +++++++++++++++++++---------------- - xbmc/guilib/GUIFontTTF.h | 5 + - xbmc/guilib/GUIFontTTFGL.cpp | 1 + - xbmc/guilib/GraphicContext.h | 1 + - xbmc/guilib/Makefile.in | 1 + - xbmc/guilib/TransformMatrix.h | 11 +++ - 8 files changed, 438 insertions(+), 84 deletions(-) + XBMC.xcodeproj/project.pbxproj | 10 ++ + project/VS2010Express/XBMC.vcxproj | 2 + + project/VS2010Express/XBMC.vcxproj.filters | 8 +- + xbmc/guilib/GUIFontCache.cpp | 105 ++++++++++++++ + xbmc/guilib/GUIFontCache.h | 217 +++++++++++++++++++++++++++++ + xbmc/guilib/GUIFontTTF.cpp | 181 +++++++++++++----------- + xbmc/guilib/GUIFontTTF.h | 5 + + xbmc/guilib/GUIFontTTFGL.cpp | 1 + + xbmc/guilib/GraphicContext.h | 1 + + xbmc/guilib/Makefile.in | 1 + + xbmc/guilib/TransformMatrix.h | 11 ++ + 11 files changed, 457 insertions(+), 85 deletions(-) create mode 100644 xbmc/guilib/GUIFontCache.cpp create mode 100644 xbmc/guilib/GUIFontCache.h +diff --git a/XBMC.xcodeproj/project.pbxproj b/XBMC.xcodeproj/project.pbxproj +index 137a8cd..15aa46d 100644 +--- a/XBMC.xcodeproj/project.pbxproj ++++ b/XBMC.xcodeproj/project.pbxproj +@@ -168,6 +168,9 @@ + 1D638128161E211E003603ED /* PeripheralImon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1D638126161E211E003603ED /* PeripheralImon.cpp */; }; + 1DAFDB7C16DFDCA7007F8C68 /* PeripheralBusCEC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1DAFDB7A16DFDCA7007F8C68 /* PeripheralBusCEC.cpp */; }; + 1DE0443515828F4B005DDB4D /* Exception.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1DE0443315828F4B005DDB4D /* Exception.cpp */; }; ++ 2F4564D51970129A00396109 /* GUIFontCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2F4564D31970129A00396109 /* GUIFontCache.cpp */; }; ++ 2F4564D61970129A00396109 /* GUIFontCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2F4564D31970129A00396109 /* GUIFontCache.cpp */; }; ++ 2F4564D71970129A00396109 /* GUIFontCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2F4564D31970129A00396109 /* GUIFontCache.cpp */; }; + 32C631281423A90F00F18420 /* JpegIO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 32C631261423A90F00F18420 /* JpegIO.cpp */; }; + 36A9443D15821E2800727135 /* DatabaseUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 36A9443B15821E2800727135 /* DatabaseUtils.cpp */; }; + 36A9444115821E7C00727135 /* SortUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 36A9443F15821E7C00727135 /* SortUtils.cpp */; }; +@@ -4008,6 +4011,8 @@ + 1DAFDB7B16DFDCA7007F8C68 /* PeripheralBusCEC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PeripheralBusCEC.h; sourceTree = ""; }; + 1DE0443315828F4B005DDB4D /* Exception.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Exception.cpp; path = commons/Exception.cpp; sourceTree = ""; }; + 1DE0443415828F4B005DDB4D /* Exception.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Exception.h; path = commons/Exception.h; sourceTree = ""; }; ++ 2F4564D31970129A00396109 /* GUIFontCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIFontCache.cpp; sourceTree = ""; }; ++ 2F4564D41970129A00396109 /* GUIFontCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIFontCache.h; sourceTree = ""; }; + 32C631261423A90F00F18420 /* JpegIO.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JpegIO.cpp; sourceTree = ""; }; + 32C631271423A90F00F18420 /* JpegIO.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JpegIO.h; sourceTree = ""; }; + 36A9443B15821E2800727135 /* DatabaseUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DatabaseUtils.cpp; sourceTree = ""; }; +@@ -6512,6 +6517,8 @@ + 18B7C7101294222D009E7A26 /* GUIFixedListContainer.h */, + 18B7C76B1294222E009E7A26 /* GUIFont.cpp */, + 18B7C7111294222D009E7A26 /* GUIFont.h */, ++ 2F4564D31970129A00396109 /* GUIFontCache.cpp */, ++ 2F4564D41970129A00396109 /* GUIFontCache.h */, + 18B7C76C1294222E009E7A26 /* GUIFontManager.cpp */, + 18B7C7121294222D009E7A26 /* GUIFontManager.h */, + 18B7C76D1294222E009E7A26 /* GUIFontTTF.cpp */, +@@ -10989,6 +10996,7 @@ + 7C5608C70F1754930056433A /* ExternalPlayer.cpp in Sources */, + F584E12E0F257C5100DB26A5 /* HTTPDirectory.cpp in Sources */, + F54C51D20F1E783200D46E3C /* GUIDialogKaraokeSongSelector.cpp in Sources */, ++ 2F4564D51970129A00396109 /* GUIFontCache.cpp in Sources */, + F54C51D50F1E784800D46E3C /* karaokelyricscdg.cpp in Sources */, + F54C51D80F1E785700D46E3C /* karaokelyrics.cpp in Sources */, + F54C51E50F1E787700D46E3C /* karaokelyricstextkar.cpp in Sources */, +@@ -12657,6 +12665,7 @@ + DFF0F45B17528350002DA3A4 /* Control.cpp in Sources */, + DFF0F45C17528350002DA3A4 /* Dialog.cpp in Sources */, + DFF0F45D17528350002DA3A4 /* File.cpp in Sources */, ++ 2F4564D71970129A00396109 /* GUIFontCache.cpp in Sources */, + DFF0F45E17528350002DA3A4 /* InfoTagMusic.cpp in Sources */, + DFF0F45F17528350002DA3A4 /* InfoTagVideo.cpp in Sources */, + DFF0F46017528350002DA3A4 /* Keyboard.cpp in Sources */, +@@ -13456,6 +13465,7 @@ + E499131D174E5DAD00741B6D /* GUIVisualisationControl.cpp in Sources */, + E499131E174E5DAD00741B6D /* GUIWindow.cpp in Sources */, + E499131F174E5DAD00741B6D /* GUIWindowManager.cpp in Sources */, ++ 2F4564D61970129A00396109 /* GUIFontCache.cpp in Sources */, + E4991320174E5DAD00741B6D /* GUIWrappingListContainer.cpp in Sources */, + E4991321174E5DAD00741B6D /* imagefactory.cpp in Sources */, + E4991322174E5DAD00741B6D /* IWindowManagerCallback.cpp in Sources */, +diff --git a/project/VS2010Express/XBMC.vcxproj b/project/VS2010Express/XBMC.vcxproj +index 9ee2694..7208542 100644 +--- a/project/VS2010Express/XBMC.vcxproj ++++ b/project/VS2010Express/XBMC.vcxproj +@@ -426,6 +426,7 @@ + + + ++ + + + +@@ -1741,6 +1742,7 @@ + + + ++ + + + +diff --git a/project/VS2010Express/XBMC.vcxproj.filters b/project/VS2010Express/XBMC.vcxproj.filters +index fa284e6..f78e4fa 100644 +--- a/project/VS2010Express/XBMC.vcxproj.filters ++++ b/project/VS2010Express/XBMC.vcxproj.filters +@@ -994,6 +994,9 @@ + + guilib + ++ ++ guilib ++ + + guilib + +@@ -3882,6 +3885,9 @@ + + guilib + ++ ++ guilib ++ + + guilib + +@@ -6034,4 +6040,4 @@ + interfaces\swig + + +- +\ No newline at end of file ++ diff --git a/xbmc/guilib/GUIFontCache.cpp b/xbmc/guilib/GUIFontCache.cpp new file mode 100644 -index 0000000..c029713 +index 0000000..2c72f9c --- /dev/null +++ b/xbmc/guilib/GUIFontCache.cpp @@ -0,0 +1,105 @@ @@ -711,33 +858,33 @@ index 0000000..c029713 + alignment, maxPixelWidth, + scrolling, g_graphicsContext.GetGUIMatrix(), + g_graphicsContext.GetGUIScaleX(), g_graphicsContext.GetGUIScaleY()); -+ EntryHashIterator i = m_list.get().find(key); -+ if (i == m_list.get().end()) ++ EntryHashIterator i = m_list.template get().find(key); ++ if (i == m_list.template get().end()) + { + /* Cache miss */ -+ EntryAgeIterator oldest = m_list.get().begin(); -+ if (!m_list.get().empty() && nowMillis - oldest->m_lastUsedMillis > FONT_CACHE_TIME_LIMIT) ++ EntryAgeIterator oldest = m_list.template get().begin(); ++ if (!m_list.template get().empty() && nowMillis - oldest->m_lastUsedMillis > FONT_CACHE_TIME_LIMIT) + { + /* The oldest existing entry is old enough to expire and reuse */ -+ m_list.get().modify(m_list.project(oldest), typename CGUIFontCacheEntry::Reassign(key, nowMillis)); -+ m_list.get().relocate(m_list.get().end(), oldest); ++ m_list.template get().modify(m_list.template project(oldest), typename CGUIFontCacheEntry::Reassign(key, nowMillis)); ++ m_list.template get().relocate(m_list.template get().end(), oldest); + } + else + { + /* We need a new entry instead */ + /* Yes, this causes the creation an destruction of a temporary entry, but + * this code ought to only be used infrequently, when the cache needs to grow */ -+ m_list.get().push_back(CGUIFontCacheEntry(*this, key, nowMillis)); ++ m_list.template get().push_back(CGUIFontCacheEntry(*this, key, nowMillis)); + } + dirtyCache = true; -+ return (--m_list.get().end())->m_value; ++ return (--m_list.template get().end())->m_value; + } + else + { + /* Cache hit */ + /* Update time in entry and move to the back of the list */ + i->m_lastUsedMillis = nowMillis; -+ m_list.get().relocate(m_list.get().end(), m_list.project(i)); ++ m_list.template get().relocate(m_list.template get().end(), m_list.template project(i)); + dirtyCache = false; + return i->m_value; + } @@ -746,7 +893,7 @@ index 0000000..c029713 +template +void CGUIFontCache::Flush() +{ -+ m_list.get().clear(); ++ m_list.template get().clear(); +} + +template void CGUIFontCacheEntry::Reassign::operator()(CGUIFontCacheEntry &entry); @@ -977,7 +1124,7 @@ index 0000000..ef65845 + +#endif diff --git a/xbmc/guilib/GUIFontTTF.cpp b/xbmc/guilib/GUIFontTTF.cpp -index 1aaf68b..288e61a 100644 +index 848c5c8..0290fc4 100644 --- a/xbmc/guilib/GUIFontTTF.cpp +++ b/xbmc/guilib/GUIFontTTF.cpp @@ -27,6 +27,7 @@ @@ -997,7 +1144,7 @@ index 1aaf68b..288e61a 100644 { m_texture = NULL; m_char = NULL; -@@ -330,108 +331,120 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors +@@ -329,108 +330,120 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors { Begin(); @@ -1202,7 +1349,7 @@ index 1aaf68b..288e61a 100644 End(); } diff --git a/xbmc/guilib/GUIFontTTF.h b/xbmc/guilib/GUIFontTTF.h -index 4a6a696..7cb4669 100644 +index dde0350..77111bc 100644 --- a/xbmc/guilib/GUIFontTTF.h +++ b/xbmc/guilib/GUIFontTTF.h @@ -64,6 +64,9 @@ struct SVertex @@ -1215,7 +1362,7 @@ index 4a6a696..7cb4669 100644 class CGUIFontTTFBase { friend class CGUIFont; -@@ -166,6 +169,8 @@ class CGUIFontTTFBase +@@ -165,6 +168,8 @@ class CGUIFontTTFBase CStdString m_strFileName; @@ -1225,10 +1372,10 @@ index 4a6a696..7cb4669 100644 virtual bool FirstBegin() = 0; virtual void LastEnd() = 0; diff --git a/xbmc/guilib/GUIFontTTFGL.cpp b/xbmc/guilib/GUIFontTTFGL.cpp -index a4e8571..cb56987 100644 +index b76c6a5..9935ea4 100644 --- a/xbmc/guilib/GUIFontTTFGL.cpp +++ b/xbmc/guilib/GUIFontTTFGL.cpp -@@ -200,6 +200,7 @@ CBaseTexture* CGUIFontTTFGL::ReallocTexture(unsigned int& newHeight) +@@ -221,6 +221,7 @@ CBaseTexture* CGUIFontTTFGL::ReallocTexture(unsigned int& newHeight) m_textureScaleX = 1.0f / m_textureWidth; if (m_textureHeight < newHeight) CLog::Log(LOGWARNING, "%s: allocated new texture with height of %d, requested %d", __FUNCTION__, m_textureHeight, newHeight); @@ -1283,10 +1430,10 @@ index f351c99..9036ba9 100644 1.9.3 -From 87d36e7f4d045a70075c0e084e9869a89b0ab51f Mon Sep 17 00:00:00 2001 +From d58c6b187e77401f46855f6185d198b00e39a488 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Thu, 23 Jan 2014 22:24:17 +0000 -Subject: [PATCH 005/102] Lay the groundwork for hardware clipping. +Subject: [PATCH 05/99] Lay the groundwork for hardware clipping. For glScissor() to replace CGraphicContext::ClipRect, a necessary condition is that no shear or rotation is introduced between the coordinate systems @@ -1315,10 +1462,10 @@ errors. 8 files changed, 128 insertions(+), 3 deletions(-) diff --git a/xbmc/guilib/GUIFontTTF.cpp b/xbmc/guilib/GUIFontTTF.cpp -index 288e61a..19c7ff4 100644 +index 0290fc4..e3808d9 100644 --- a/xbmc/guilib/GUIFontTTF.cpp +++ b/xbmc/guilib/GUIFontTTF.cpp -@@ -710,7 +710,8 @@ void CGUIFontTTFBase::RenderCharacter(float posX, float posY, const Character *c +@@ -709,7 +709,8 @@ void CGUIFontTTFBase::RenderCharacter(float posX, float posY, const Character *c (posY + ch->offsetY + height) * g_graphicsContext.GetGUIScaleY()); vertex += CPoint(m_originX, m_originY); CRect texture(ch->left, ch->top, ch->right, ch->bottom); @@ -1329,19 +1476,19 @@ index 288e61a..19c7ff4 100644 // transform our positions - note, no scaling due to GUI calibration/resolution occurs float x[4], y[4], z[4]; diff --git a/xbmc/guilib/GUIShader.cpp b/xbmc/guilib/GUIShader.cpp -index 11089b8..53bce09 100644 +index 23cb84f..5d836cee 100644 --- a/xbmc/guilib/GUIShader.cpp +++ b/xbmc/guilib/GUIShader.cpp @@ -26,6 +26,8 @@ #include "GUIShader.h" #include "MatrixGLES.h" #include "utils/log.h" -+#include "windowing/egl/WinSystemEGL.h" ++#include "windowing/WindowingFactory.h" +#include "guilib/GraphicContext.h" - CGUIShader::CGUIShader( const char *shader ) : CGLSLShaderProgram("guishader_vert.glsl", shader) - { -@@ -86,8 +88,82 @@ bool CGUIShader::OnEnabled() + using namespace Shaders; + +@@ -88,8 +90,82 @@ bool CGUIShader::OnEnabled() { // This is called after glUseProgram() @@ -1427,10 +1574,10 @@ index 11089b8..53bce09 100644 return true; } diff --git a/xbmc/guilib/GUIShader.h b/xbmc/guilib/GUIShader.h -index c7e95aa..86ce4cc 100644 +index f7b5d9a..fdf7452 100644 --- a/xbmc/guilib/GUIShader.h +++ b/xbmc/guilib/GUIShader.h -@@ -41,6 +41,11 @@ class CGUIShader : public CGLSLShaderProgram +@@ -39,6 +39,11 @@ class CGUIShader : public Shaders::CGLSLShaderProgram GLint GetCord1Loc() { return m_hCord1; } GLint GetUniColLoc() { return m_hUniCol; } GLint GetCoord0MatrixLoc() { return m_hCoord0Matrix; } @@ -1442,7 +1589,7 @@ index c7e95aa..86ce4cc 100644 protected: GLint m_hTex0; -@@ -56,6 +61,12 @@ class CGUIShader : public CGLSLShaderProgram +@@ -54,6 +59,12 @@ class CGUIShader : public Shaders::CGLSLShaderProgram GLfloat *m_proj; GLfloat *m_model; @@ -1551,10 +1698,10 @@ index 98e398a..81ee49e 100644 1.9.3 -From f6889534ebe503adc35ebb3b37d19ec48ae1b1f7 Mon Sep 17 00:00:00 2001 +From 3424a50db35b53cf86a67734a923cda2b2faad0b Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Thu, 23 Jan 2014 16:42:22 +0000 -Subject: [PATCH 006/102] Increase font cache hit rate by keying on the +Subject: [PATCH 06/99] Increase font cache hit rate by keying on the fractional part of m_originX and m_originY *after* they have been through the graphics context's transformation matrix, plus the scale/rotation elements of the matrix, rather than the origin in the original frame of reference plus @@ -1574,7 +1721,7 @@ Note that this requires that software clipping is *not* performed. 4 files changed, 95 insertions(+), 10 deletions(-) diff --git a/xbmc/guilib/GUIFontCache.cpp b/xbmc/guilib/GUIFontCache.cpp -index c029713..b66c00b 100644 +index 2c72f9c..df466a5 100644 --- a/xbmc/guilib/GUIFontCache.cpp +++ b/xbmc/guilib/GUIFontCache.cpp @@ -85,6 +85,9 @@ Value &CGUIFontCache::Lookup(Position &pos, @@ -1586,7 +1733,7 @@ index c029713..b66c00b 100644 + pos.UpdateWithOffsets(i->m_key.m_pos, scrolling); /* Update time in entry and move to the back of the list */ i->m_lastUsedMillis = nowMillis; - m_list.get().relocate(m_list.get().end(), m_list.project(i)); + m_list.template get().relocate(m_list.template get().end(), m_list.template project(i)); @@ -103,3 +106,8 @@ template void CGUIFontCacheEntry::~CGUIFontCacheEntry(); template CGUIFontCacheStaticValue &CGUIFontCache::Lookup(CGUIFontCacheStaticPosition &, const vecColors &, const vecText &, uint32_t, float, bool, unsigned int, bool &); @@ -1663,7 +1810,7 @@ index ef65845..d913dee 100644 + #endif diff --git a/xbmc/guilib/GUIFontTTF.cpp b/xbmc/guilib/GUIFontTTF.cpp -index 19c7ff4..73f0e50 100644 +index e3808d9..412f47a 100644 --- a/xbmc/guilib/GUIFontTTF.cpp +++ b/xbmc/guilib/GUIFontTTF.cpp @@ -132,7 +132,7 @@ class CFreeTypeLibrary @@ -1675,7 +1822,7 @@ index 19c7ff4..73f0e50 100644 { m_texture = NULL; m_char = NULL; -@@ -332,13 +332,28 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors +@@ -331,13 +331,28 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors Begin(); bool dirtyCache; @@ -1710,7 +1857,7 @@ index 19c7ff4..73f0e50 100644 if (dirtyCache) { // save the origin, which is scaled separately -@@ -441,10 +456,28 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors +@@ -440,10 +455,28 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors else cursorX += ch->advance; } @@ -1743,10 +1890,10 @@ index 19c7ff4..73f0e50 100644 End(); } diff --git a/xbmc/guilib/GUIFontTTF.h b/xbmc/guilib/GUIFontTTF.h -index 7cb4669..78445ab 100644 +index 77111bc..39bfa52 100644 --- a/xbmc/guilib/GUIFontTTF.h +++ b/xbmc/guilib/GUIFontTTF.h -@@ -170,6 +170,7 @@ class CGUIFontTTFBase +@@ -169,6 +169,7 @@ class CGUIFontTTFBase CStdString m_strFileName; CGUIFontCache m_staticCache; @@ -1758,10 +1905,10 @@ index 7cb4669..78445ab 100644 1.9.3 -From cb2bda9a1951835142835f34fa99d001766dd637 Mon Sep 17 00:00:00 2001 +From cd59927bb82659956650f9d8b929f4587a776133 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 8 Jan 2014 12:16:33 +0000 -Subject: [PATCH 007/102] Rewrite of scrolling text code. +Subject: [PATCH 07/99] Rewrite of scrolling text code. No longer shuffles the string round to minimise the number of characters before the clipping rectangle; this doesn't save much on rendering time but @@ -2051,10 +2198,10 @@ index 8d985cf..a8e20fc 100644 } CGUIControl::Render(); diff --git a/xbmc/utils/RssReader.cpp b/xbmc/utils/RssReader.cpp -index a22d364..013ddb8 100644 +index 3636c3e..ac066ee 100644 --- a/xbmc/utils/RssReader.cpp +++ b/xbmc/utils/RssReader.cpp -@@ -54,7 +54,7 @@ CRssReader::CRssReader() : CThread("RSSReader") +@@ -55,7 +55,7 @@ CRssReader::CRssReader() : CThread("RSSReader") m_pObserver = NULL; m_spacesBetweenFeeds = 0; m_bIsRunning = false; @@ -2064,7 +2211,7 @@ index a22d364..013ddb8 100644 m_requestRefresh = false; } diff --git a/xbmc/utils/RssReader.h b/xbmc/utils/RssReader.h -index 2c6f366..b74faf2 100644 +index 2cda726..fbc579e 100644 --- a/xbmc/utils/RssReader.h +++ b/xbmc/utils/RssReader.h @@ -43,7 +43,7 @@ class CRssReader : public CThread @@ -2080,16 +2227,17 @@ index 2c6f366..b74faf2 100644 1.9.3 -From 49a538250c27fc99507e0a49a688e13827633c9d Mon Sep 17 00:00:00 2001 +From 05ce888df8828b2dd3ca2459dcf83e84d94777b6 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Mon, 27 Jan 2014 23:21:10 +0000 -Subject: [PATCH 008/102] Move the application of the translation offsets into - the GLES code. Still all pure software at this stage. Main change is in the - data types at the interface between CGUIFontTTFBase and CGUIFontTTFGL. The - old way (array of vertices in m_vertex) are retained in addition, for the - sake`of cases that need to use software clipping on GLES, as well as for DX - and GL support where the new scheme is not (yet?) used. +Subject: [PATCH 08/99] Move the application of the translation offsets into + the GLES code. +Still all pure software at this stage. Main change is in the data types at +the interface between CGUIFontTTFBase and CGUIFontTTFGL. The old way +(array of vertices in m_vertex) are retained in addition, for the sake`of +cases that need to use software clipping on GLES, as well as for DX and GL +support where the new scheme is not (yet?) used. --- xbmc/guilib/GUIFontTTF.cpp | 19 +++--------- xbmc/guilib/GUIFontTTF.h | 17 +++++++++++ @@ -2097,10 +2245,10 @@ Subject: [PATCH 008/102] Move the application of the translation offsets into 3 files changed, 73 insertions(+), 35 deletions(-) diff --git a/xbmc/guilib/GUIFontTTF.cpp b/xbmc/guilib/GUIFontTTF.cpp -index 73f0e50..ad0a53b 100644 +index 412f47a..b0e69c0 100644 --- a/xbmc/guilib/GUIFontTTF.cpp +++ b/xbmc/guilib/GUIFontTTF.cpp -@@ -215,6 +215,7 @@ void CGUIFontTTFBase::Clear() +@@ -214,6 +214,7 @@ void CGUIFontTTFBase::Clear() g_freeTypeLibrary.ReleaseStroker(m_stroker); m_stroker = NULL; @@ -2108,7 +2256,7 @@ index 73f0e50..ad0a53b 100644 m_vertex.clear(); } -@@ -310,6 +311,7 @@ void CGUIFontTTFBase::Begin() +@@ -309,6 +310,7 @@ void CGUIFontTTFBase::Begin() { if (m_nestedBeginCount == 0 && m_texture != NULL && FirstBegin()) { @@ -2116,7 +2264,7 @@ index 73f0e50..ad0a53b 100644 m_vertex.clear(); } // Keep track of the nested begin/end calls. -@@ -457,23 +459,10 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors +@@ -456,23 +458,10 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors cursorX += ch->advance; } if (hardwareClipping) @@ -2143,7 +2291,7 @@ index 73f0e50..ad0a53b 100644 /* Append the new vertices (from the cache or otherwise) to the set collected * since the first Begin() call */ diff --git a/xbmc/guilib/GUIFontTTF.h b/xbmc/guilib/GUIFontTTF.h -index 78445ab..c71f90d 100644 +index 39bfa52..e8afc1c 100644 --- a/xbmc/guilib/GUIFontTTF.h +++ b/xbmc/guilib/GUIFontTTF.h @@ -61,6 +61,14 @@ struct SVertex @@ -2161,8 +2309,8 @@ index 78445ab..c71f90d 100644 }; -@@ -160,6 +168,15 @@ class CGUIFontTTFBase - bool m_bTextureLoaded; +@@ -159,6 +167,15 @@ class CGUIFontTTFBase + unsigned int m_nTexture; + struct CTranslatedVertices @@ -2178,10 +2326,10 @@ index 78445ab..c71f90d 100644 float m_textureScaleX; diff --git a/xbmc/guilib/GUIFontTTFGL.cpp b/xbmc/guilib/GUIFontTTFGL.cpp -index cb56987..f6aa081 100644 +index 9935ea4..18c9358 100644 --- a/xbmc/guilib/GUIFontTTFGL.cpp +++ b/xbmc/guilib/GUIFontTTFGL.cpp -@@ -146,34 +146,65 @@ void CGUIFontTTFGL::LastEnd() +@@ -167,34 +167,65 @@ void CGUIFontTTFGL::LastEnd() GLint colLoc = g_Windowing.GUIShaderGetCol(); GLint tex0Loc = g_Windowing.GUIShaderGetCoord0(); @@ -2267,7 +2415,7 @@ index cb56987..f6aa081 100644 glDisableVertexAttribArray(posLoc); glDisableVertexAttribArray(colLoc); glDisableVertexAttribArray(tex0Loc); -@@ -201,6 +232,7 @@ CBaseTexture* CGUIFontTTFGL::ReallocTexture(unsigned int& newHeight) +@@ -222,6 +253,7 @@ CBaseTexture* CGUIFontTTFGL::ReallocTexture(unsigned int& newHeight) if (m_textureHeight < newHeight) CLog::Log(LOGWARNING, "%s: allocated new texture with height of %d, requested %d", __FUNCTION__, m_textureHeight, newHeight); m_staticCache.Flush(); @@ -2279,10 +2427,10 @@ index cb56987..f6aa081 100644 1.9.3 -From a68d88009e7ae9b5484285332bc23aa22c73d17d Mon Sep 17 00:00:00 2001 +From 1a5fc663da29146c6e11764aff1c99e0fb0c3fd4 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 15 Jan 2014 15:28:06 +0000 -Subject: [PATCH 009/102] Rather than applying the translation offsets to the +Subject: [PATCH 09/99] Rather than applying the translation offsets to the vertices, now applies them to the model view matrix from the top of the matrix stack and pushes it over to OpenGL. The vertices themselves are still all held client-side. @@ -2296,7 +2444,7 @@ Subject: [PATCH 009/102] Rather than applying the translation offsets to the 5 files changed, 36 insertions(+), 22 deletions(-) diff --git a/xbmc/guilib/GUIFontTTF.h b/xbmc/guilib/GUIFontTTF.h -index c71f90d..fde2085 100644 +index e8afc1c..573039d 100644 --- a/xbmc/guilib/GUIFontTTF.h +++ b/xbmc/guilib/GUIFontTTF.h @@ -61,14 +61,6 @@ struct SVertex @@ -2315,7 +2463,7 @@ index c71f90d..fde2085 100644 diff --git a/xbmc/guilib/GUIFontTTFGL.cpp b/xbmc/guilib/GUIFontTTFGL.cpp -index f6aa081..fbffaa0 100644 +index 18c9358..ea08bf4 100644 --- a/xbmc/guilib/GUIFontTTFGL.cpp +++ b/xbmc/guilib/GUIFontTTFGL.cpp @@ -29,6 +29,7 @@ @@ -2326,7 +2474,7 @@ index f6aa081..fbffaa0 100644 // stuff for freetype #include -@@ -145,6 +146,7 @@ void CGUIFontTTFGL::LastEnd() +@@ -166,6 +167,7 @@ void CGUIFontTTFGL::LastEnd() GLint posLoc = g_Windowing.GUIShaderGetPos(); GLint colLoc = g_Windowing.GUIShaderGetCol(); GLint tex0Loc = g_Windowing.GUIShaderGetCoord0(); @@ -2334,7 +2482,7 @@ index f6aa081..fbffaa0 100644 // Enable the attributes used by this shader glEnableVertexAttribArray(posLoc); -@@ -183,25 +185,35 @@ void CGUIFontTTFGL::LastEnd() +@@ -204,25 +206,35 @@ void CGUIFontTTFGL::LastEnd() std::vector vecVertices; for (size_t i = 0; i < m_vertexTrans.size(); i++) { @@ -2385,10 +2533,10 @@ index f6aa081..fbffaa0 100644 // Disable the attributes used by this shader diff --git a/xbmc/guilib/GUIShader.h b/xbmc/guilib/GUIShader.h -index 86ce4cc..ba01956 100644 +index fdf7452..abbe21c 100644 --- a/xbmc/guilib/GUIShader.h +++ b/xbmc/guilib/GUIShader.h -@@ -41,6 +41,7 @@ class CGUIShader : public CGLSLShaderProgram +@@ -39,6 +39,7 @@ class CGUIShader : public Shaders::CGLSLShaderProgram GLint GetCord1Loc() { return m_hCord1; } GLint GetUniColLoc() { return m_hUniCol; } GLint GetCoord0MatrixLoc() { return m_hCoord0Matrix; } @@ -2429,10 +2577,10 @@ index 81ee49e..d2f9cd1 100644 1.9.3 -From 6b25456e32488065307ee21d19e53fa9f74bdf20 Mon Sep 17 00:00:00 2001 +From 851167c3a56064b82e0b431fd326af7ca5d0b88f Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 29 Jan 2014 13:21:19 +0000 -Subject: [PATCH 010/102] Enable hardware clipping. +Subject: [PATCH 10/99] Enable hardware clipping. --- xbmc/guilib/GUIFontTTF.cpp | 4 ++-- @@ -2441,10 +2589,10 @@ Subject: [PATCH 010/102] Enable hardware clipping. 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/xbmc/guilib/GUIFontTTF.cpp b/xbmc/guilib/GUIFontTTF.cpp -index ad0a53b..4dc4c8e 100644 +index b0e69c0..3ea1051 100644 --- a/xbmc/guilib/GUIFontTTF.cpp +++ b/xbmc/guilib/GUIFontTTF.cpp -@@ -459,10 +459,10 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors +@@ -458,10 +458,10 @@ void CGUIFontTTFBase::DrawTextInternal(float x, float y, const vecColors &colors cursorX += ch->advance; } if (hardwareClipping) @@ -2458,7 +2606,7 @@ index ad0a53b..4dc4c8e 100644 /* Append the new vertices (from the cache or otherwise) to the set collected * since the first Begin() call */ diff --git a/xbmc/guilib/GUIFontTTF.h b/xbmc/guilib/GUIFontTTF.h -index fde2085..5e7c31f 100644 +index 573039d..a6931c1 100644 --- a/xbmc/guilib/GUIFontTTF.h +++ b/xbmc/guilib/GUIFontTTF.h @@ -27,6 +27,8 @@ @@ -2470,7 +2618,7 @@ index fde2085..5e7c31f 100644 // forward definition class CBaseTexture; -@@ -166,7 +168,8 @@ class CGUIFontTTFBase +@@ -165,7 +167,8 @@ class CGUIFontTTFBase float translateY; float translateZ; const std::vector *vertexBuffer; @@ -2481,26 +2629,26 @@ index fde2085..5e7c31f 100644 std::vector m_vertexTrans; std::vector m_vertex; diff --git a/xbmc/guilib/GUIFontTTFGL.cpp b/xbmc/guilib/GUIFontTTFGL.cpp -index fbffaa0..b7618e1 100644 +index ea08bf4..b63e337 100644 --- a/xbmc/guilib/GUIFontTTFGL.cpp +++ b/xbmc/guilib/GUIFontTTFGL.cpp -@@ -185,6 +185,10 @@ void CGUIFontTTFGL::LastEnd() +@@ -206,6 +206,10 @@ void CGUIFontTTFGL::LastEnd() std::vector vecVertices; for (size_t i = 0; i < m_vertexTrans.size(); i++) { + // Apply the clip rectangle + CRect clip = g_Windowing.ClipRectToScissorRect(m_vertexTrans[i].clip); -+ g_graphicsContext.SetScissors(clip); ++ g_Windowing.SetScissors(clip); + // Apply the translation to the currently active (top-of-stack) model view matrix g_matrices.MatrixMode(MM_MODELVIEW); g_matrices.PushMatrix(); -@@ -212,6 +216,8 @@ void CGUIFontTTFGL::LastEnd() +@@ -233,6 +237,8 @@ void CGUIFontTTFGL::LastEnd() g_matrices.PopMatrix(); } + // Restore the original scissor rectangle -+ g_graphicsContext.ResetScissors(); ++ g_Windowing.ResetScissors(); // Restore the original model view matrix glUniformMatrix4fv(modelLoc, 1, GL_FALSE, g_matrices.GetMatrix(MM_MODELVIEW)); } @@ -2508,10 +2656,10 @@ index fbffaa0..b7618e1 100644 1.9.3 -From 490473747496cc5919c6118e0e57906bbf7da652 Mon Sep 17 00:00:00 2001 +From 7a0931a8e33a9386ab2e2a0beacf2c939d64a0e2 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 15 Jan 2014 15:32:51 +0000 -Subject: [PATCH 011/102] Move the vertex data across to a vertex buffer object +Subject: [PATCH 11/99] Move the vertex data across to a vertex buffer object just prior to drawing. --- @@ -2519,10 +2667,10 @@ Subject: [PATCH 011/102] Move the vertex data across to a vertex buffer object 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/xbmc/guilib/GUIFontTTFGL.cpp b/xbmc/guilib/GUIFontTTFGL.cpp -index b7618e1..0df3749 100644 +index b63e337..b00055d 100644 --- a/xbmc/guilib/GUIFontTTFGL.cpp +++ b/xbmc/guilib/GUIFontTTFGL.cpp -@@ -207,12 +207,24 @@ void CGUIFontTTFGL::LastEnd() +@@ -228,12 +228,24 @@ void CGUIFontTTFGL::LastEnd() } SVertex *vertices = &vecVertices[0]; @@ -2552,8 +2700,8 @@ index b7618e1..0df3749 100644 g_matrices.PopMatrix(); } -@@ -220,6 +232,8 @@ void CGUIFontTTFGL::LastEnd() - g_graphicsContext.ResetScissors(); +@@ -241,6 +253,8 @@ void CGUIFontTTFGL::LastEnd() + g_Windowing.ResetScissors(); // Restore the original model view matrix glUniformMatrix4fv(modelLoc, 1, GL_FALSE, g_matrices.GetMatrix(MM_MODELVIEW)); + // Unbind GL_ARRAY_BUFFER @@ -2565,13 +2713,14 @@ index b7618e1..0df3749 100644 1.9.3 -From b65cab61e361360be10816d2f872204e38cc46f2 Mon Sep 17 00:00:00 2001 +From 8366fd3f6c9169c6c7de4f0a25a26fe2d40bf476 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Wed, 15 Jan 2014 16:04:04 +0000 -Subject: [PATCH 012/102] Move vertex data into an OpenGL VBO when the font - cache entry is populated. The font cache now stores the "name" (handle) of - the VBO, rather than a vector of vertices. +Subject: [PATCH 12/99] Move vertex data into an OpenGL VBO when the font cache + entry is populated. +The font cache now stores the "name" (handle) of the VBO, rather than a vector +of vertices. --- xbmc/guilib/GUIFontCache.cpp | 6 ++++ xbmc/guilib/GUIFontCache.h | 30 +++++++++++++++++- @@ -2582,7 +2731,7 @@ Subject: [PATCH 012/102] Move vertex data into an OpenGL VBO when the font 6 files changed, 107 insertions(+), 30 deletions(-) diff --git a/xbmc/guilib/GUIFontCache.cpp b/xbmc/guilib/GUIFontCache.cpp -index b66c00b..895fa72 100644 +index df466a5..bd84b9a 100644 --- a/xbmc/guilib/GUIFontCache.cpp +++ b/xbmc/guilib/GUIFontCache.cpp @@ -111,3 +111,9 @@ template void CGUIFontCacheEntryadvance; } if (hardwareClipping) @@ -2678,7 +2827,7 @@ index 4dc4c8e..8b25306 100644 /* Append the new vertices (from the cache or otherwise) to the set collected * since the first Begin() call */ diff --git a/xbmc/guilib/GUIFontTTF.h b/xbmc/guilib/GUIFontTTF.h -index 5e7c31f..b1cd525 100644 +index a6931c1..9a35ac4 100644 --- a/xbmc/guilib/GUIFontTTF.h +++ b/xbmc/guilib/GUIFontTTF.h @@ -84,6 +84,9 @@ class CGUIFontTTFBase @@ -2691,7 +2840,7 @@ index 5e7c31f..b1cd525 100644 const CStdString& GetFileName() const { return m_strFileName; }; -@@ -167,9 +170,9 @@ class CGUIFontTTFBase +@@ -166,9 +169,9 @@ class CGUIFontTTFBase float translateX; float translateY; float translateZ; @@ -2704,10 +2853,10 @@ index 5e7c31f..b1cd525 100644 std::vector m_vertexTrans; std::vector m_vertex; diff --git a/xbmc/guilib/GUIFontTTFGL.cpp b/xbmc/guilib/GUIFontTTFGL.cpp -index 0df3749..1cd684b7 100644 +index b00055d..aabb9a6 100644 --- a/xbmc/guilib/GUIFontTTFGL.cpp +++ b/xbmc/guilib/GUIFontTTFGL.cpp -@@ -49,6 +49,10 @@ CGUIFontTTFGL::CGUIFontTTFGL(const CStdString& strFileName) +@@ -52,6 +52,10 @@ CGUIFontTTFGL::CGUIFontTTFGL(const CStdString& strFileName) CGUIFontTTFGL::~CGUIFontTTFGL(void) { @@ -2718,7 +2867,7 @@ index 0df3749..1cd684b7 100644 } bool CGUIFontTTFGL::FirstBegin() -@@ -182,7 +186,6 @@ void CGUIFontTTFGL::LastEnd() +@@ -203,7 +207,6 @@ void CGUIFontTTFGL::LastEnd() if (m_vertexTrans.size() > 0) { // Deal with the vertices that can be hardware clipped and therefore translated @@ -2726,7 +2875,7 @@ index 0df3749..1cd684b7 100644 for (size_t i = 0; i < m_vertexTrans.size(); i++) { // Apply the clip rectangle -@@ -195,36 +198,17 @@ void CGUIFontTTFGL::LastEnd() +@@ -216,36 +219,17 @@ void CGUIFontTTFGL::LastEnd() g_matrices.Translatef(m_vertexTrans[i].translateX, m_vertexTrans[i].translateY, m_vertexTrans[i].translateZ); glUniformMatrix4fv(modelLoc, 1, GL_FALSE, g_matrices.GetMatrix(MM_MODELVIEW)); @@ -2767,7 +2916,7 @@ index 0df3749..1cd684b7 100644 g_matrices.PopMatrix(); } -@@ -245,6 +229,48 @@ void CGUIFontTTFGL::LastEnd() +@@ -266,6 +250,48 @@ void CGUIFontTTFGL::LastEnd() #endif } @@ -2817,7 +2966,7 @@ index 0df3749..1cd684b7 100644 { newHeight = CBaseTexture::PadPow2(newHeight); diff --git a/xbmc/guilib/GUIFontTTFGL.h b/xbmc/guilib/GUIFontTTFGL.h -index 6736cf7..168fb21 100644 +index 735fb3a..6102c90 100644 --- a/xbmc/guilib/GUIFontTTFGL.h +++ b/xbmc/guilib/GUIFontTTFGL.h @@ -29,6 +29,7 @@ @@ -2843,24 +2992,24 @@ index 6736cf7..168fb21 100644 1.9.3 -From bafbd11e1fbcb62c9eec8d567897c356ddca2893 Mon Sep 17 00:00:00 2001 +From 3155d94b6163e8f9b5158721ae78e9af40b92ed0 Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Thu, 16 Jan 2014 16:29:42 +0000 -Subject: [PATCH 013/102] Switch from glDrawArrays() to glDrawElements(). This - involves setting up a static VBO containing the indexes necessary to convert - from quads to triangles on the fly in the GPU. +Subject: [PATCH 13/99] Switch from glDrawArrays() to glDrawElements(). +This involves setting up a static VBO containing the indexes necessary to +convert from quads to triangles on the fly in the GPU. --- xbmc/guilib/GUIFontTTFGL.cpp | 72 +++++++++++++++++++++++++------------ - xbmc/guilib/GUIFontTTFGL.h | 9 +++++ + xbmc/guilib/GUIFontTTFGL.h | 11 +++++- xbmc/windowing/egl/WinSystemEGL.cpp | 17 +++++++++ - 3 files changed, 76 insertions(+), 22 deletions(-) + 3 files changed, 77 insertions(+), 23 deletions(-) diff --git a/xbmc/guilib/GUIFontTTFGL.cpp b/xbmc/guilib/GUIFontTTFGL.cpp -index 1cd684b7..d476409 100644 +index aabb9a6..812662c 100644 --- a/xbmc/guilib/GUIFontTTFGL.cpp +++ b/xbmc/guilib/GUIFontTTFGL.cpp -@@ -186,6 +186,10 @@ void CGUIFontTTFGL::LastEnd() +@@ -207,6 +207,10 @@ void CGUIFontTTFGL::LastEnd() if (m_vertexTrans.size() > 0) { // Deal with the vertices that can be hardware clipped and therefore translated @@ -2871,7 +3020,7 @@ index 1cd684b7..d476409 100644 for (size_t i = 0; i < m_vertexTrans.size(); i++) { // Apply the clip rectangle -@@ -201,14 +205,21 @@ void CGUIFontTTFGL::LastEnd() +@@ -222,14 +226,21 @@ void CGUIFontTTFGL::LastEnd() // Bind the buffer to the OpenGL context's GL_ARRAY_BUFFER binding point glBindBuffer(GL_ARRAY_BUFFER, (GLuint) m_vertexTrans[i].vertexBuffer->bufferHandle); @@ -2900,8 +3049,8 @@ index 1cd684b7..d476409 100644 g_matrices.PopMatrix(); } -@@ -216,8 +227,9 @@ void CGUIFontTTFGL::LastEnd() - g_graphicsContext.ResetScissors(); +@@ -237,8 +248,9 @@ void CGUIFontTTFGL::LastEnd() + g_Windowing.ResetScissors(); // Restore the original model view matrix glUniformMatrix4fv(modelLoc, 1, GL_FALSE, g_matrices.GetMatrix(MM_MODELVIEW)); - // Unbind GL_ARRAY_BUFFER @@ -2911,7 +3060,7 @@ index 1cd684b7..d476409 100644 } // Disable the attributes used by this shader -@@ -232,19 +244,6 @@ void CGUIFontTTFGL::LastEnd() +@@ -253,19 +265,6 @@ void CGUIFontTTFGL::LastEnd() #if HAS_GLES CVertexBuffer CGUIFontTTFGL::CreateVertexBuffer(const std::vector &vertices) const { @@ -2931,7 +3080,7 @@ index 1cd684b7..d476409 100644 // Generate a unique buffer object name and put it in bufferHandle GLuint bufferHandle; glGenBuffers(1, &bufferHandle); -@@ -253,7 +252,7 @@ CVertexBuffer CGUIFontTTFGL::CreateVertexBuffer(const std::vector &vert +@@ -274,7 +273,7 @@ CVertexBuffer CGUIFontTTFGL::CreateVertexBuffer(const std::vector &vert // Create a data store for the buffer object bound to the GL_ARRAY_BUFFER // binding point (i.e. our buffer object) and initialise it from the // specified client-side pointer @@ -2940,7 +3089,7 @@ index 1cd684b7..d476409 100644 // Unbind GL_ARRAY_BUFFER glBindBuffer(GL_ARRAY_BUFFER, 0); -@@ -348,4 +347,33 @@ void CGUIFontTTFGL::DeleteHardwareTexture() +@@ -393,4 +392,33 @@ void CGUIFontTTFGL::DeleteHardwareTexture() } } @@ -2975,7 +3124,7 @@ index 1cd684b7..d476409 100644 + #endif diff --git a/xbmc/guilib/GUIFontTTFGL.h b/xbmc/guilib/GUIFontTTFGL.h -index 168fb21..a14ab7a 100644 +index 6102c90..dcf9ca1 100644 --- a/xbmc/guilib/GUIFontTTFGL.h +++ b/xbmc/guilib/GUIFontTTFGL.h @@ -30,6 +30,7 @@ @@ -2986,7 +3135,7 @@ index 168fb21..a14ab7a 100644 /*! -@@ -47,6 +48,8 @@ class CGUIFontTTFGL : public CGUIFontTTFBase +@@ -47,13 +48,21 @@ class CGUIFontTTFGL : public CGUIFontTTFBase #if HAS_GLES virtual CVertexBuffer CreateVertexBuffer(const std::vector &vertices) const; virtual void DestroyVertexBuffer(CVertexBuffer &bufferHandle) const; @@ -2995,19 +3144,20 @@ index 168fb21..a14ab7a 100644 #endif protected: -@@ -54,6 +57,12 @@ class CGUIFontTTFGL : public CGUIFontTTFBase + virtual CBaseTexture* ReallocTexture(unsigned int& newHeight); virtual bool CopyCharToTexture(FT_BitmapGlyph bitGlyph, unsigned int x1, unsigned int y1, unsigned int x2, unsigned int y2); virtual void DeleteHardwareTexture(); - +- ++ +#if HAS_GLES +#define ELEMENT_ARRAY_MAX_CHAR_INDEX (1000) + + static GLuint m_elementArrayHandle; +#endif + - }; - - #endif + private: + unsigned int m_updateY1; + unsigned int m_updateY2; diff --git a/xbmc/windowing/egl/WinSystemEGL.cpp b/xbmc/windowing/egl/WinSystemEGL.cpp index 6de3532..258a293 100644 --- a/xbmc/windowing/egl/WinSystemEGL.cpp @@ -3069,284 +3219,10 @@ index 6de3532..258a293 100644 1.9.3 -From a2ba9f0ea636a5b9644d69874c4141b4595500a3 Mon Sep 17 00:00:00 2001 -From: Ben Avison -Date: Tue, 4 Feb 2014 16:17:57 +0000 -Subject: [PATCH 014/102] Update Windows project files - ---- - project/VS2010Express/XBMC.vcxproj | 2 ++ - project/VS2010Express/XBMC.vcxproj.filters | 6 ++++++ - 2 files changed, 8 insertions(+) - -diff --git a/project/VS2010Express/XBMC.vcxproj b/project/VS2010Express/XBMC.vcxproj -index 3d2b67b..2498cb2 100644 ---- a/project/VS2010Express/XBMC.vcxproj -+++ b/project/VS2010Express/XBMC.vcxproj -@@ -426,6 +426,7 @@ - - - -+ - - - -@@ -1745,6 +1746,7 @@ - - - -+ - - - -diff --git a/project/VS2010Express/XBMC.vcxproj.filters b/project/VS2010Express/XBMC.vcxproj.filters -index c630d26..aa7d063 100644 ---- a/project/VS2010Express/XBMC.vcxproj.filters -+++ b/project/VS2010Express/XBMC.vcxproj.filters -@@ -1003,6 +1003,9 @@ - - guilib - -+ -+ guilib -+ - - guilib - -@@ -3918,6 +3921,9 @@ - - guilib - -+ -+ guilib -+ - - guilib - --- -1.9.3 - - -From f3abd7d186d1561aeedc9f561f4f473cfc924f05 Mon Sep 17 00:00:00 2001 -From: Ben Avison -Date: Tue, 4 Feb 2014 16:49:45 +0000 -Subject: [PATCH 015/102] Update XCode project file - ---- - XBMC.xcodeproj/project.pbxproj | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/XBMC.xcodeproj/project.pbxproj b/XBMC.xcodeproj/project.pbxproj -index 94f85ee..990dfdb 100644 ---- a/XBMC.xcodeproj/project.pbxproj -+++ b/XBMC.xcodeproj/project.pbxproj -@@ -168,6 +168,9 @@ - 1D638128161E211E003603ED /* PeripheralImon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1D638126161E211E003603ED /* PeripheralImon.cpp */; }; - 1DAFDB7C16DFDCA7007F8C68 /* PeripheralBusCEC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1DAFDB7A16DFDCA7007F8C68 /* PeripheralBusCEC.cpp */; }; - 1DE0443515828F4B005DDB4D /* Exception.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1DE0443315828F4B005DDB4D /* Exception.cpp */; }; -+ 2FD7EC5F18A14FE50047F86C /* GUIFontCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2FD7EC5D18A14FE50047F86C /* GUIFontCache.cpp */; }; -+ 2FD7EC6018A14FE50047F86C /* GUIFontCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2FD7EC5D18A14FE50047F86C /* GUIFontCache.cpp */; }; -+ 2FD7EC6118A14FE50047F86C /* GUIFontCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2FD7EC5D18A14FE50047F86C /* GUIFontCache.cpp */; }; - 32C631281423A90F00F18420 /* JpegIO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 32C631261423A90F00F18420 /* JpegIO.cpp */; }; - 36A9443D15821E2800727135 /* DatabaseUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 36A9443B15821E2800727135 /* DatabaseUtils.cpp */; }; - 36A9444115821E7C00727135 /* SortUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 36A9443F15821E7C00727135 /* SortUtils.cpp */; }; -@@ -4020,6 +4023,8 @@ - 1DAFDB7B16DFDCA7007F8C68 /* PeripheralBusCEC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PeripheralBusCEC.h; sourceTree = ""; }; - 1DE0443315828F4B005DDB4D /* Exception.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Exception.cpp; path = commons/Exception.cpp; sourceTree = ""; }; - 1DE0443415828F4B005DDB4D /* Exception.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Exception.h; path = commons/Exception.h; sourceTree = ""; }; -+ 2FD7EC5D18A14FE50047F86C /* GUIFontCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIFontCache.cpp; sourceTree = ""; }; -+ 2FD7EC5E18A14FE50047F86C /* GUIFontCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIFontCache.h; sourceTree = ""; }; - 32C631261423A90F00F18420 /* JpegIO.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JpegIO.cpp; sourceTree = ""; }; - 32C631271423A90F00F18420 /* JpegIO.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JpegIO.h; sourceTree = ""; }; - 36A9443B15821E2800727135 /* DatabaseUtils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DatabaseUtils.cpp; sourceTree = ""; }; -@@ -6533,6 +6538,8 @@ - 18B7C76A1294222E009E7A26 /* GUIFixedListContainer.cpp */, - 18B7C7101294222D009E7A26 /* GUIFixedListContainer.h */, - 18B7C76B1294222E009E7A26 /* GUIFont.cpp */, -+ 2FD7EC5D18A14FE50047F86C /* GUIFontCache.cpp */, -+ 2FD7EC5E18A14FE50047F86C /* GUIFontCache.h */, - 18B7C7111294222D009E7A26 /* GUIFont.h */, - 18B7C76C1294222E009E7A26 /* GUIFontManager.cpp */, - 18B7C7121294222D009E7A26 /* GUIFontManager.h */, -@@ -11858,6 +11865,7 @@ - DF033D381946612400BFC82E /* AEDeviceEnumerationOSX.cpp in Sources */, - 7C525DF5195E2D8100BE3482 /* SaveFileStateJob.cpp in Sources */, - 7C908894196358A8003D0619 /* auto_buffer.cpp in Sources */, -+ 2FD7EC5F18A14FE50047F86C /* GUIFontCache.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -@@ -13052,6 +13060,7 @@ - 7CAA469219427AED00008885 /* PosixDirectory.cpp in Sources */, - 7C525DF7195E2D8100BE3482 /* SaveFileStateJob.cpp in Sources */, - 7C908896196358A8003D0619 /* auto_buffer.cpp in Sources */, -+ 2FD7EC6118A14FE50047F86C /* GUIFontCache.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -@@ -14248,6 +14257,7 @@ - 7CAA469119427AED00008885 /* PosixDirectory.cpp in Sources */, - 7C525DF6195E2D8100BE3482 /* SaveFileStateJob.cpp in Sources */, - 7C908895196358A8003D0619 /* auto_buffer.cpp in Sources */, -+ 2FD7EC6018A14FE50047F86C /* GUIFontCache.cpp in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; --- -1.9.3 - - -From 366e8c48c165265b4f9d22b8e2b26fdddfa6467a Mon Sep 17 00:00:00 2001 -From: Ben Avison -Date: Tue, 4 Feb 2014 17:44:34 +0000 -Subject: [PATCH 016/102] Clang seems to be more picky than gcc about some C++ - template syntax - ---- - xbmc/guilib/GUIFontCache.cpp | 20 ++++++++++---------- - 1 file changed, 10 insertions(+), 10 deletions(-) - -diff --git a/xbmc/guilib/GUIFontCache.cpp b/xbmc/guilib/GUIFontCache.cpp -index 895fa72..bd84b9a 100644 ---- a/xbmc/guilib/GUIFontCache.cpp -+++ b/xbmc/guilib/GUIFontCache.cpp -@@ -61,26 +61,26 @@ Value &CGUIFontCache::Lookup(Position &pos, - alignment, maxPixelWidth, - scrolling, g_graphicsContext.GetGUIMatrix(), - g_graphicsContext.GetGUIScaleX(), g_graphicsContext.GetGUIScaleY()); -- EntryHashIterator i = m_list.get().find(key); -- if (i == m_list.get().end()) -+ EntryHashIterator i = m_list.template get().find(key); -+ if (i == m_list.template get().end()) - { - /* Cache miss */ -- EntryAgeIterator oldest = m_list.get().begin(); -- if (!m_list.get().empty() && nowMillis - oldest->m_lastUsedMillis > FONT_CACHE_TIME_LIMIT) -+ EntryAgeIterator oldest = m_list.template get().begin(); -+ if (!m_list.template get().empty() && nowMillis - oldest->m_lastUsedMillis > FONT_CACHE_TIME_LIMIT) - { - /* The oldest existing entry is old enough to expire and reuse */ -- m_list.get().modify(m_list.project(oldest), typename CGUIFontCacheEntry::Reassign(key, nowMillis)); -- m_list.get().relocate(m_list.get().end(), oldest); -+ m_list.template get().modify(m_list.template project(oldest), typename CGUIFontCacheEntry::Reassign(key, nowMillis)); -+ m_list.template get().relocate(m_list.template get().end(), oldest); - } - else - { - /* We need a new entry instead */ - /* Yes, this causes the creation an destruction of a temporary entry, but - * this code ought to only be used infrequently, when the cache needs to grow */ -- m_list.get().push_back(CGUIFontCacheEntry(*this, key, nowMillis)); -+ m_list.template get().push_back(CGUIFontCacheEntry(*this, key, nowMillis)); - } - dirtyCache = true; -- return (--m_list.get().end())->m_value; -+ return (--m_list.template get().end())->m_value; - } - else - { -@@ -90,7 +90,7 @@ Value &CGUIFontCache::Lookup(Position &pos, - pos.UpdateWithOffsets(i->m_key.m_pos, scrolling); - /* Update time in entry and move to the back of the list */ - i->m_lastUsedMillis = nowMillis; -- m_list.get().relocate(m_list.get().end(), m_list.project(i)); -+ m_list.template get().relocate(m_list.template get().end(), m_list.template project(i)); - dirtyCache = false; - return i->m_value; - } -@@ -99,7 +99,7 @@ Value &CGUIFontCache::Lookup(Position &pos, - template - void CGUIFontCache::Flush() - { -- m_list.get().clear(); -+ m_list.template get().clear(); - } - - template void CGUIFontCacheEntry::Reassign::operator()(CGUIFontCacheEntry &entry); --- -1.9.3 - - -From 88806afd0c118a2ca1e8f0dbf8ee425137aacfc3 Mon Sep 17 00:00:00 2001 -From: Ben Avison -Date: Tue, 4 Feb 2014 18:52:14 +0000 -Subject: [PATCH 017/102] Fix header to hopefully permit iOS builds to work - again. GUIShader.cpp added #include windowing/egl/WinSystemEGL.h inside a but - also need the header windowing/osx/WinSystemIOS.h instead. The only thing - GUIShader.cpp needed was g_windowing.GetViewPort, which is provided by the - common base class CRenderSystemGLES of g_windowing in both cases, so I think - it should be sufficient to use windowing/WindowingFactory.h instead, which is - abstracted away from the other header files. - ---- - xbmc/guilib/GUIShader.cpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/xbmc/guilib/GUIShader.cpp b/xbmc/guilib/GUIShader.cpp -index 53bce09..86330cc 100644 ---- a/xbmc/guilib/GUIShader.cpp -+++ b/xbmc/guilib/GUIShader.cpp -@@ -26,7 +26,7 @@ - #include "GUIShader.h" - #include "MatrixGLES.h" - #include "utils/log.h" --#include "windowing/egl/WinSystemEGL.h" -+#include "windowing/WindowingFactory.h" - #include "guilib/GraphicContext.h" - - CGUIShader::CGUIShader( const char *shader ) : CGLSLShaderProgram("guishader_vert.glsl", shader) --- -1.9.3 - - -From b981367182fb888f1cf0d8e5d335e3526af896c4 Mon Sep 17 00:00:00 2001 -From: Ben Avison -Date: Tue, 8 Apr 2014 18:14:55 +0100 -Subject: [PATCH 018/102] Fix font display in stereoscopic modes - CGUIFontTTFGL::LastEnd was previously using the relatively high-level - CGraphicContext::SetScissors function to enforce hardware clipping. However, - the coordinates it passed in already contained the stereoscopic offset, so - the CGraphicContext::SetScissors effectively ended up double-applying the - offset, with the effect that clip rectangles were always off-screen. Changed - to call the low-level SetScissors call instead (using g_Windowing to select - the correct implementation, e.g. CRenderSystemGLES::SetScissors). This also - skips the intersection of the scissors with the screen limits, but that does - not appear to matter in practice. - ---- - xbmc/guilib/GUIFontTTFGL.cpp | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/xbmc/guilib/GUIFontTTFGL.cpp b/xbmc/guilib/GUIFontTTFGL.cpp -index d476409..8466a81 100644 ---- a/xbmc/guilib/GUIFontTTFGL.cpp -+++ b/xbmc/guilib/GUIFontTTFGL.cpp -@@ -194,7 +194,7 @@ void CGUIFontTTFGL::LastEnd() - { - // Apply the clip rectangle - CRect clip = g_Windowing.ClipRectToScissorRect(m_vertexTrans[i].clip); -- g_graphicsContext.SetScissors(clip); -+ g_Windowing.SetScissors(clip); - - // Apply the translation to the currently active (top-of-stack) model view matrix - g_matrices.MatrixMode(MM_MODELVIEW); -@@ -224,7 +224,7 @@ void CGUIFontTTFGL::LastEnd() - g_matrices.PopMatrix(); - } - // Restore the original scissor rectangle -- g_graphicsContext.ResetScissors(); -+ g_Windowing.ResetScissors(); - // Restore the original model view matrix - glUniformMatrix4fv(modelLoc, 1, GL_FALSE, g_matrices.GetMatrix(MM_MODELVIEW)); - // Unbind GL_ARRAY_BUFFER and GL_ELEMENT_ARRAY_BUFFER --- -1.9.3 - - -From cffae5d7f38dfbbaa427e61c0e5a56fe00852380 Mon Sep 17 00:00:00 2001 +From 5c5d8889a0feb1914a4dfb7435df56a81e2ac887 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 10 Jan 2014 12:10:43 +0000 -Subject: [PATCH 019/102] [rbp] Don't override dvdplayer with omxplayer. +Subject: [PATCH 14/99] [rbp] Don't override dvdplayer with omxplayer. Using dvdplayer can be useful on the Pi. We can actually play sd (up to 640x480 MPEG-4 video) video in real time. This is useful for codec variants like DivX3 which we don't currently play. @@ -3357,7 +3233,7 @@ This may expose bugs where dvdplayer is incorrectly used as the default player w 1 file changed, 7 deletions(-) diff --git a/xbmc/cores/playercorefactory/PlayerCoreConfig.h b/xbmc/cores/playercorefactory/PlayerCoreConfig.h -index 27f0bec..fc12bb7 100644 +index 9524f94..2789bd8 100644 --- a/xbmc/cores/playercorefactory/PlayerCoreConfig.h +++ b/xbmc/cores/playercorefactory/PlayerCoreConfig.h @@ -88,14 +88,7 @@ friend class CPlayerCoreFactory; @@ -3379,10 +3255,10 @@ index 27f0bec..fc12bb7 100644 1.9.3 -From f3e06268a61b2fd42401fd810f9d6144adc7f6ab Mon Sep 17 00:00:00 2001 +From 0f194812cc12c1ef74845f2512174ca138cf4674 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 10 Jan 2014 15:37:41 +0000 -Subject: [PATCH 020/102] [players] Use default players rather than hard coded +Subject: [PATCH 15/99] [players] Use default players rather than hard coded DVDPlayer/PAPlayer --- @@ -3441,20 +3317,20 @@ index 57dfcdd..7be9799 100644 1.9.3 -From afe6ac464be227de30cc4177c50091231d607af9 Mon Sep 17 00:00:00 2001 +From 49897fff3b04a7ac092e874a55c26476bf915143 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 11 Jan 2014 18:23:42 +0000 -Subject: [PATCH 021/102] [rbp] Don't force dvdplayer for airplay +Subject: [PATCH 16/99] [rbp] Don't force dvdplayer for airplay --- xbmc/network/AirPlayServer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xbmc/network/AirPlayServer.cpp b/xbmc/network/AirPlayServer.cpp -index a2b930e..74a3b30 100644 +index 80ea552..497898f 100644 --- a/xbmc/network/AirPlayServer.cpp +++ b/xbmc/network/AirPlayServer.cpp -@@ -903,9 +903,11 @@ int CAirPlayServer::CTCPClient::ProcessRequest( CStdString& responseHeader, +@@ -903,9 +903,11 @@ int CAirPlayServer::CTCPClient::ProcessRequest( std::string& responseHeader, CFileItem fileToPlay(location, false); fileToPlay.SetProperty("StartPercent", position*100.0f); ServerInstance->AnnounceToClients(EVENT_LOADING); @@ -3470,10 +3346,10 @@ index a2b930e..74a3b30 100644 1.9.3 -From 5d75c8ba10041c285e9628e8d014530971d284f0 Mon Sep 17 00:00:00 2001 +From 9e7232aeed1265d898b016dee2ec1198c1d12c1a Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 13 Jan 2014 13:11:06 +0000 -Subject: [PATCH 022/102] [rbp] Give plugins omxplayer when they request +Subject: [PATCH 17/99] [rbp] Give plugins omxplayer when they request dvdplayer on pi --- @@ -3481,7 +3357,7 @@ Subject: [PATCH 022/102] [rbp] Give plugins omxplayer when they request 1 file changed, 4 insertions(+) diff --git a/xbmc/interfaces/legacy/ModuleXbmc.cpp b/xbmc/interfaces/legacy/ModuleXbmc.cpp -index db54d79..96031b2 100644 +index dfdca99..2a819ef 100644 --- a/xbmc/interfaces/legacy/ModuleXbmc.cpp +++ b/xbmc/interfaces/legacy/ModuleXbmc.cpp @@ -527,7 +527,11 @@ namespace XBMCAddon @@ -3500,10 +3376,10 @@ index db54d79..96031b2 100644 1.9.3 -From f1001b59dba7124ecaf64588d953dbbb232e38e1 Mon Sep 17 00:00:00 2001 +From 66715e35594eb121f33df1e4793ed7497ed53284 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 14 Jan 2014 18:04:07 +0000 -Subject: [PATCH 023/102] [rbp] Allow ALSA to be chosen in addition to Pi sink +Subject: [PATCH 18/99] [rbp] Allow ALSA to be chosen in addition to Pi sink Needs --enable-alsa in ./configure step and alsa support on platform --- @@ -3513,10 +3389,10 @@ Needs --enable-alsa in ./configure step and alsa support on platform 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/configure.in b/configure.in -index efd0574..a537a1c 100644 +index 83687bb..43e1f82 100644 --- a/configure.in +++ b/configure.in -@@ -705,7 +705,6 @@ case $use_platform in +@@ -693,7 +693,6 @@ case $use_platform in use_arch="arm" use_cpu=arm1176jzf-s use_hardcoded_tables="yes" @@ -3525,10 +3401,10 @@ index efd0574..a537a1c 100644 AC_DEFINE(HAS_EGLGLES, [1], [Define if supporting EGL based GLES Framebuffer]) USE_OMXLIB=1; AC_DEFINE([HAVE_OMXLIB],[1],["Define to 1 if OMX libs is enabled"]) diff --git a/tools/depends/target/Makefile b/tools/depends/target/Makefile -index 3e02fc0..eea2a06 100644 +index fce60df..8a3858e 100644 --- a/tools/depends/target/Makefile +++ b/tools/depends/target/Makefile -@@ -57,10 +57,11 @@ LINUX_SYSTEM_LIBS= +@@ -58,10 +58,11 @@ LINUX_SYSTEM_LIBS= ifeq ($(OS),linux) #not for raspberry pi ifneq ($(TARGET_PLATFORM),raspberry-pi) @@ -3594,10 +3470,10 @@ index e42d973..715b4f1 100644 1.9.3 -From 9e7fee9ceb9a58256985b22d5dec8e9b217a81c3 Mon Sep 17 00:00:00 2001 +From 0999497d6452e83ab5e708d871b5ee2d4866a68a Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 16 Jan 2014 01:39:29 +0000 -Subject: [PATCH 024/102] [omxcodec] Add hardware decode to dvdplayer for Pi +Subject: [PATCH 19/99] [omxcodec] Add hardware decode to dvdplayer for Pi Hijack the abandoned OpenMaxVideo codec --- @@ -3610,23 +3486,19 @@ Hijack the abandoned OpenMaxVideo codec .../DVDCodecs/Video/DVDVideoCodecOpenMax.cpp | 295 +--- .../DVDCodecs/Video/DVDVideoCodecOpenMax.h | 34 +- xbmc/cores/dvdplayer/DVDCodecs/Video/Makefile.in | 1 - - xbmc/cores/dvdplayer/DVDCodecs/Video/OpenMax.cpp | 269 ---- - xbmc/cores/dvdplayer/DVDCodecs/Video/OpenMax.h | 116 -- .../dvdplayer/DVDCodecs/Video/OpenMaxVideo.cpp | 1418 ++++++++++---------- .../cores/dvdplayer/DVDCodecs/Video/OpenMaxVideo.h | 120 +- xbmc/cores/dvdplayer/DVDPlayer.cpp | 2 + xbmc/cores/dvdplayer/DVDPlayerVideo.cpp | 21 +- xbmc/linux/OMXCore.cpp | 45 +- xbmc/linux/OMXCore.h | 2 +- - 17 files changed, 894 insertions(+), 1484 deletions(-) - delete mode 100644 xbmc/cores/dvdplayer/DVDCodecs/Video/OpenMax.cpp - delete mode 100644 xbmc/cores/dvdplayer/DVDCodecs/Video/OpenMax.h + 15 files changed, 894 insertions(+), 1099 deletions(-) diff --git a/configure.in b/configure.in -index a537a1c..62516d6 100644 +index 43e1f82..fb73c5f 100644 --- a/configure.in +++ b/configure.in -@@ -1968,9 +1968,24 @@ if test "$host_vendor" = "apple" ; then +@@ -1925,9 +1925,24 @@ if test "$host_vendor" = "apple" ; then USE_OPENMAX=0 AC_MSG_NOTICE($openmax_disabled) elif test "$target_platform" = "target_raspberry_pi"; then @@ -3725,7 +3597,7 @@ index 642cded..5a6a2be 100644 #ifdef HAVE_VIDEOTOOLBOXDECODER struct __CVBuffer *cvBufferRef; diff --git a/xbmc/cores/VideoRenderers/RenderManager.cpp b/xbmc/cores/VideoRenderers/RenderManager.cpp -index ca9aa84..1816407 100644 +index b6fb1a3..be3ce46 100644 --- a/xbmc/cores/VideoRenderers/RenderManager.cpp +++ b/xbmc/cores/VideoRenderers/RenderManager.cpp @@ -914,7 +914,7 @@ int CXBMCRenderManager::AddVideoPicture(DVDVideoPicture& pic) @@ -3738,7 +3610,7 @@ index ca9aa84..1816407 100644 #ifdef TARGET_DARWIN else if(pic.format == RENDER_FMT_CVBREF) diff --git a/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp -index f77ac40..5d37395 100644 +index 32d58d4..d58067c 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp @@ -268,9 +268,12 @@ CDVDVideoCodec* CDVDFactoryCodec::CreateVideoCodec(CDVDStreamInfo &hint, unsigne @@ -4198,403 +4070,6 @@ index 8a97889..ebf7123 100644 SRCS += OpenMaxVideo.cpp SRCS += DVDVideoCodecOpenMax.cpp endif -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/OpenMax.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/OpenMax.cpp -deleted file mode 100644 -index 7b0a0c2ef..0000000 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/OpenMax.cpp -+++ /dev/null -@@ -1,269 +0,0 @@ --/* -- * Copyright (C) 2010-2013 Team XBMC -- * http://xbmc.org -- * -- * This Program 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, or (at your option) -- * any later version. -- * -- * This Program 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 XBMC; see the file COPYING. If not, see -- * . -- * -- */ -- --#if (defined HAVE_CONFIG_H) && (!defined TARGET_WINDOWS) -- #include "config.h" --#elif defined(TARGET_WINDOWS) --#include "system.h" --#endif -- --#if defined(HAVE_LIBOPENMAX) --#include "OpenMax.h" --#include "DynamicDll.h" --#include "DVDClock.h" --#include "DVDStreamInfo.h" --#include "windowing/WindowingFactory.h" --#include "DVDVideoCodec.h" --#include "utils/log.h" --#include "utils/TimeUtils.h" --#include "ApplicationMessenger.h" --#include "Application.h" -- --#include --#include --#include --#include -- --#define CLASSNAME "COpenMax" -- -- --//////////////////////////////////////////////////////////////////////////////////////////// --class DllLibOpenMaxInterface --{ --public: -- virtual ~DllLibOpenMaxInterface() {} -- -- virtual OMX_ERRORTYPE OMX_Init(void) = 0; -- virtual OMX_ERRORTYPE OMX_Deinit(void) = 0; -- virtual OMX_ERRORTYPE OMX_GetHandle( -- OMX_HANDLETYPE *pHandle, OMX_STRING cComponentName, OMX_PTR pAppData, OMX_CALLBACKTYPE *pCallBacks) = 0; -- virtual OMX_ERRORTYPE OMX_FreeHandle(OMX_HANDLETYPE hComponent) = 0; -- virtual OMX_ERRORTYPE OMX_GetComponentsOfRole(OMX_STRING role, OMX_U32 *pNumComps, OMX_U8 **compNames) = 0; -- virtual OMX_ERRORTYPE OMX_GetRolesOfComponent(OMX_STRING compName, OMX_U32 *pNumRoles, OMX_U8 **roles) = 0; -- virtual OMX_ERRORTYPE OMX_ComponentNameEnum(OMX_STRING cComponentName, OMX_U32 nNameLength, OMX_U32 nIndex) = 0; --}; -- --class DllLibOpenMax : public DllDynamic, DllLibOpenMaxInterface --{ -- DECLARE_DLL_WRAPPER(DllLibOpenMax, "/usr/lib/libnvomx.so") -- -- DEFINE_METHOD0(OMX_ERRORTYPE, OMX_Init) -- DEFINE_METHOD0(OMX_ERRORTYPE, OMX_Deinit) -- DEFINE_METHOD4(OMX_ERRORTYPE, OMX_GetHandle, (OMX_HANDLETYPE *p1, OMX_STRING p2, OMX_PTR p3, OMX_CALLBACKTYPE *p4)) -- DEFINE_METHOD1(OMX_ERRORTYPE, OMX_FreeHandle, (OMX_HANDLETYPE p1)) -- DEFINE_METHOD3(OMX_ERRORTYPE, OMX_GetComponentsOfRole, (OMX_STRING p1, OMX_U32 *p2, OMX_U8 **p3)) -- DEFINE_METHOD3(OMX_ERRORTYPE, OMX_GetRolesOfComponent, (OMX_STRING p1, OMX_U32 *p2, OMX_U8 **p3)) -- DEFINE_METHOD3(OMX_ERRORTYPE, OMX_ComponentNameEnum, (OMX_STRING p1, OMX_U32 p2, OMX_U32 p3)) -- BEGIN_METHOD_RESOLVE() -- RESOLVE_METHOD(OMX_Init) -- RESOLVE_METHOD(OMX_Deinit) -- RESOLVE_METHOD(OMX_GetHandle) -- RESOLVE_METHOD(OMX_FreeHandle) -- RESOLVE_METHOD(OMX_GetComponentsOfRole) -- RESOLVE_METHOD(OMX_GetRolesOfComponent) -- RESOLVE_METHOD(OMX_ComponentNameEnum) -- END_METHOD_RESOLVE() --}; -- --//////////////////////////////////////////////////////////////////////////////////////////// --#define OMX_INIT_STRUCTURE(a) \ -- memset(&(a), 0, sizeof(a)); \ -- (a).nSize = sizeof(a); \ -- (a).nVersion.s.nVersionMajor = OMX_VERSION_MAJOR; \ -- (a).nVersion.s.nVersionMinor = OMX_VERSION_MINOR; \ -- (a).nVersion.s.nRevision = OMX_VERSION_REVISION; \ -- (a).nVersion.s.nStep = OMX_VERSION_STEP -- --//////////////////////////////////////////////////////////////////////////////////////////// --//////////////////////////////////////////////////////////////////////////////////////////// --COpenMax::COpenMax() --{ -- #if defined(OMX_DEBUG_VERBOSE) -- CLog::Log(LOGDEBUG, "%s::%s\n", CLASSNAME, __func__); -- #endif -- m_dll = new DllLibOpenMax; -- m_dll->Load(); -- m_is_open = false; -- -- m_omx_decoder = NULL; -- m_omx_client_state = DEAD; -- m_omx_decoder_state = 0; -- sem_init(m_omx_decoder_state_change, 0, 0); -- /* -- m_omx_flush_input = (sem_t*)malloc(sizeof(sem_t)); -- sem_init(m_omx_flush_input, 0, 0); -- m_omx_flush_output = (sem_t*)malloc(sizeof(sem_t)); -- sem_init(m_omx_flush_output, 0, 0); -- */ --} -- --COpenMax::~COpenMax() --{ -- #if defined(OMX_DEBUG_VERBOSE) -- CLog::Log(LOGDEBUG, "%s::%s\n", CLASSNAME, __func__); -- #endif -- /* -- sem_destroy(m_omx_flush_input); -- free(m_omx_flush_input); -- sem_destroy(m_omx_flush_output); -- free(m_omx_flush_output); -- */ -- delete m_dll; --} -- -- -- -- --//////////////////////////////////////////////////////////////////////////////////////////// --// DecoderEventHandler -- OMX event callback --OMX_ERRORTYPE COpenMax::DecoderEventHandlerCallback( -- OMX_HANDLETYPE hComponent, -- OMX_PTR pAppData, -- OMX_EVENTTYPE eEvent, -- OMX_U32 nData1, -- OMX_U32 nData2, -- OMX_PTR pEventData) --{ -- COpenMax *ctx = (COpenMax*)pAppData; -- return ctx->DecoderEventHandler(hComponent, pAppData, eEvent, nData1, nData2, pEventData); --} -- --// DecoderEmptyBufferDone -- OpenMax input buffer has been emptied --OMX_ERRORTYPE COpenMax::DecoderEmptyBufferDoneCallback( -- OMX_HANDLETYPE hComponent, -- OMX_PTR pAppData, -- OMX_BUFFERHEADERTYPE* pBuffer) --{ -- COpenMax *ctx = (COpenMax*)pAppData; -- return ctx->DecoderEmptyBufferDone( hComponent, pAppData, pBuffer); --} -- --// DecoderFillBufferDone -- OpenMax output buffer has been filled --OMX_ERRORTYPE COpenMax::DecoderFillBufferDoneCallback( -- OMX_HANDLETYPE hComponent, -- OMX_PTR pAppData, -- OMX_BUFFERHEADERTYPE* pBuffer) --{ -- COpenMax *ctx = (COpenMax*)pAppData; -- return ctx->DecoderFillBufferDone(hComponent, pAppData, pBuffer); --} -- -- -- --// Wait for a component to transition to the specified state --OMX_ERRORTYPE COpenMax::WaitForState(OMX_STATETYPE state) --{ -- OMX_STATETYPE test_state; -- int tries = 0; -- struct timespec timeout; -- OMX_ERRORTYPE omx_error = OMX_GetState(m_omx_decoder, &test_state); -- -- #if defined(OMX_DEBUG_VERBOSE) -- CLog::Log(LOGDEBUG, "%s::%s - waiting for state(%d)\n", CLASSNAME, __func__, state); -- #endif -- while ((omx_error == OMX_ErrorNone) && (test_state != state)) -- { -- clock_gettime(CLOCK_REALTIME, &timeout); -- timeout.tv_sec += 1; -- sem_timedwait(m_omx_decoder_state_change, &timeout); -- if (errno == ETIMEDOUT) -- tries++; -- if (tries > 5) -- return OMX_ErrorUndefined; -- -- omx_error = OMX_GetState(m_omx_decoder, &test_state); -- } -- -- return omx_error; --} -- --// SetStateForAllComponents --// Blocks until all state changes have completed --OMX_ERRORTYPE COpenMax::SetStateForComponent(OMX_STATETYPE state) --{ -- OMX_ERRORTYPE omx_err; -- -- #if defined(OMX_DEBUG_VERBOSE) -- CLog::Log(LOGDEBUG, "%s::%s - state(%d)\n", CLASSNAME, __func__, state); -- #endif -- omx_err = OMX_SendCommand(m_omx_decoder, OMX_CommandStateSet, state, 0); -- if (omx_err) -- CLog::Log(LOGERROR, "%s::%s - OMX_CommandStateSet failed with omx_err(0x%x)\n", -- CLASSNAME, __func__, omx_err); -- else -- omx_err = WaitForState(state); -- -- return omx_err; --} -- --bool COpenMax::Initialize( const CStdString &decoder_name) --{ -- OMX_ERRORTYPE omx_err = m_dll->OMX_Init(); -- if (omx_err) -- { -- CLog::Log(LOGERROR, -- "%s::%s - OpenMax failed to init, status(%d), ", // codec(%d), profile(%d), level(%d) -- CLASSNAME, __func__, omx_err );//, hints.codec, hints.profile, hints.level); -- return false; -- } -- -- // Get video decoder handle setting up callbacks, component is in loaded state on return. -- static OMX_CALLBACKTYPE decoder_callbacks = { -- &DecoderEventHandlerCallback, &DecoderEmptyBufferDoneCallback, &DecoderFillBufferDoneCallback }; -- omx_err = m_dll->OMX_GetHandle(&m_omx_decoder, (char*)decoder_name.c_str(), this, &decoder_callbacks); -- if (omx_err) -- { -- CLog::Log(LOGERROR, -- "%s::%s - could not get decoder handle\n", CLASSNAME, __func__); -- m_dll->OMX_Deinit(); -- return false; -- } -- -- return true; --} -- --void COpenMax::Deinitialize() --{ -- CLog::Log(LOGERROR, -- "%s::%s - failed to get component port parameter\n", CLASSNAME, __func__); -- m_dll->OMX_FreeHandle(m_omx_decoder); -- m_omx_decoder = NULL; -- m_dll->OMX_Deinit(); --} -- --// OpenMax decoder callback routines. --OMX_ERRORTYPE COpenMax::DecoderEventHandler(OMX_HANDLETYPE hComponent, OMX_PTR pAppData, -- OMX_EVENTTYPE eEvent, OMX_U32 nData1, OMX_U32 nData2, OMX_PTR pEventData) --{ -- return OMX_ErrorNone; --} -- --OMX_ERRORTYPE COpenMax::DecoderEmptyBufferDone(OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_BUFFERHEADERTYPE* pBuffer) --{ -- return OMX_ErrorNone; --} -- --OMX_ERRORTYPE COpenMax::DecoderFillBufferDone(OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_BUFFERHEADERTYPE* pBufferHeader) --{ -- return OMX_ErrorNone; --} -- --#endif -- -diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/OpenMax.h b/xbmc/cores/dvdplayer/DVDCodecs/Video/OpenMax.h -deleted file mode 100644 -index 0d9ff18..0000000 ---- a/xbmc/cores/dvdplayer/DVDCodecs/Video/OpenMax.h -+++ /dev/null -@@ -1,116 +0,0 @@ --#pragma once --/* -- * Copyright (C) 2010-2013 Team XBMC -- * http://xbmc.org -- * -- * This Program 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, or (at your option) -- * any later version. -- * -- * This Program 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 XBMC; see the file COPYING. If not, see -- * . -- * -- */ -- --#if defined(HAVE_LIBOPENMAX) -- --#include "cores/dvdplayer/DVDStreamInfo.h" --#include "DVDVideoCodec.h" --#include "threads/Event.h" -- --#include --#include --#include -- --//////////////////////////////////////////////////////////////////////////////////////////// --// debug spew defines --#if 0 --#define OMX_DEBUG_VERBOSE --#define OMX_DEBUG_EVENTHANDLER --#define OMX_DEBUG_FILLBUFFERDONE --#define OMX_DEBUG_EMPTYBUFFERDONE --#endif -- --typedef struct omx_codec_capability { -- // level is OMX_VIDEO_AVCPROFILETYPE, OMX_VIDEO_H263PROFILETYPE, -- // or OMX_VIDEO_MPEG4PROFILETYPE depending on context. -- OMX_U32 level; -- // level is OMX_VIDEO_AVCLEVELTYPE, OMX_VIDEO_H263LEVELTYPE, -- // or OMX_VIDEO_MPEG4PROFILETYPE depending on context. -- OMX_U32 profile; --} omx_codec_capability; -- --typedef struct omx_demux_packet { -- OMX_U8 *buff; -- int size; -- double dts; -- double pts; --} omx_demux_packet; -- --class DllLibOpenMax; --class COpenMax --{ --public: -- COpenMax(); -- virtual ~COpenMax(); -- --protected: -- enum OMX_CLIENT_STATE { -- DEAD, -- LOADED, -- LOADED_TO_IDLE, -- IDLE_TO_EXECUTING, -- EXECUTING, -- EXECUTING_TO_IDLE, -- IDLE_TO_LOADED, -- RECONFIGURING, -- ERROR -- }; -- -- // initialize OpenMax and get decoder component -- bool Initialize( const CStdString &decoder_name); -- void Deinitialize(); -- -- // OpenMax Decoder delegate callback routines. -- static OMX_ERRORTYPE DecoderEventHandlerCallback(OMX_HANDLETYPE hComponent, OMX_PTR pAppData, -- OMX_EVENTTYPE eEvent, OMX_U32 nData1, OMX_U32 nData2, OMX_PTR pEventData); -- static OMX_ERRORTYPE DecoderEmptyBufferDoneCallback( -- OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_BUFFERHEADERTYPE* pBuffer); -- static OMX_ERRORTYPE DecoderFillBufferDoneCallback( -- OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_BUFFERHEADERTYPE* pBufferHeader); -- -- // OpenMax decoder callback routines. -- virtual OMX_ERRORTYPE DecoderEventHandler(OMX_HANDLETYPE hComponent, OMX_PTR pAppData, -- OMX_EVENTTYPE eEvent, OMX_U32 nData1, OMX_U32 nData2, OMX_PTR pEventData); -- virtual OMX_ERRORTYPE DecoderEmptyBufferDone( -- OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_BUFFERHEADERTYPE* pBuffer); -- virtual OMX_ERRORTYPE DecoderFillBufferDone( -- OMX_HANDLETYPE hComponent, OMX_PTR pAppData, OMX_BUFFERHEADERTYPE* pBufferHeader); -- -- // OpenMax helper routines -- OMX_ERRORTYPE WaitForState(OMX_STATETYPE state); -- OMX_ERRORTYPE SetStateForComponent(OMX_STATETYPE state); -- -- DllLibOpenMax *m_dll; -- bool m_is_open; -- OMX_HANDLETYPE m_omx_decoder; // openmax decoder component reference -- -- // OpenMax state tracking -- OMX_CLIENT_STATE m_omx_client_state; -- volatile int m_omx_decoder_state; -- sem_t *m_omx_decoder_state_change; -- std::vector m_omx_decoder_capabilities; -- --private: -- COpenMax(const COpenMax& other); -- COpenMax& operator=(const COpenMax&); --}; -- --#endif diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/OpenMaxVideo.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/OpenMaxVideo.cpp index dcbdb1e..aca2e0d 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/Video/OpenMaxVideo.cpp @@ -6478,10 +5953,10 @@ index e06c41d..9079c13 100644 // defined(HAVE_LIBOPENMAX) diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index af0e493..d01089e 100644 +index 4f85e2a..adbc312 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -2974,7 +2974,9 @@ bool CDVDPlayer::OpenVideoStream(CDVDStreamInfo& hint, bool reset) +@@ -2968,7 +2968,9 @@ bool CDVDPlayer::OpenVideoStream(CDVDStreamInfo& hint, bool reset) hint.aspect = aspect; hint.forced_aspect = true; } @@ -6492,7 +5967,7 @@ index af0e493..d01089e 100644 CDVDInputStream::IMenus* pMenus = dynamic_cast(m_pInputStream); diff --git a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp -index 633e333..c6350cd 100644 +index be532ec..7403fd4 100644 --- a/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayerVideo.cpp @@ -324,6 +324,9 @@ void CDVDPlayerVideo::Process() @@ -6653,17 +6128,17 @@ index 1efb313..b4c8626 100644 1.9.3 -From a594ae2a26c942405520ebda5d9cbe2db40bad59 Mon Sep 17 00:00:00 2001 +From c95085d8a9875edb51081787641fb3abb56d7b0e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 20 Jan 2014 16:03:40 +0000 -Subject: [PATCH 025/102] [omxcodec] Enable for dvd menus +Subject: [PATCH 20/99] [omxcodec] Enable for dvd menus --- xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp b/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp -index 5d37395..6d1810f 100644 +index d58067c..f3fd3e2 100644 --- a/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp +++ b/xbmc/cores/dvdplayer/DVDCodecs/DVDFactoryCodec.cpp @@ -192,6 +192,10 @@ CDVDVideoCodec* CDVDFactoryCodec::CreateVideoCodec(CDVDStreamInfo &hint, unsigne @@ -6681,10 +6156,10 @@ index 5d37395..6d1810f 100644 1.9.3 -From 87b8052d31c20b3173c2a676b0f7d3068687f6bf Mon Sep 17 00:00:00 2001 +From 70e31ee44d902739bd25f31c25c4f6211932ad68 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 3 Feb 2014 22:27:44 +0000 -Subject: [PATCH 026/102] [omxcodec] Add omx specific texture +Subject: [PATCH 21/99] [omxcodec] Add omx specific texture create/upload/delete functions --- @@ -6762,10 +6237,10 @@ index 5a6a2be..52df291 100644 1.9.3 -From f2c59b5ce9460a04c52e014cf15c9e835f9c9933 Mon Sep 17 00:00:00 2001 +From 6e0a43ebc430fe18fc0f0956aa9703792db5e425 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 3 Feb 2014 22:50:43 +0000 -Subject: [PATCH 027/102] [omxcodec] Add shared pointer to delay shutdown of +Subject: [PATCH 22/99] [omxcodec] Add shared pointer to delay shutdown of codec until buffers are returned --- @@ -6946,10 +6421,10 @@ index 9079c13..0975e8a 100644 1.9.3 -From 43aaae9490318a6cc33d5546df73cf4138b0779a Mon Sep 17 00:00:00 2001 +From fd4617eec60aedd955a92de9f10bff68d85ec730 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 3 Feb 2014 23:11:31 +0000 -Subject: [PATCH 028/102] [omxcodec] Fix for aspect ratio in non-square pixel +Subject: [PATCH 23/99] [omxcodec] Fix for aspect ratio in non-square pixel modes --- @@ -7038,10 +6513,10 @@ index 0975e8a..9138a20 100644 1.9.3 -From c67d107b1e9fdb03ed4c9fa812b7dc41d56e0473 Mon Sep 17 00:00:00 2001 +From 958aa93e74eaddb4a36a090febd53ef11ac1530e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 3 Feb 2014 23:19:22 +0000 -Subject: [PATCH 029/102] [omxcodec] Report error when codec not enabled +Subject: [PATCH 24/99] [omxcodec] Report error when codec not enabled --- xbmc/cores/dvdplayer/DVDCodecs/Video/OpenMaxVideo.cpp | 10 +++++++++- @@ -7086,10 +6561,10 @@ index 7e23c87..2ae722b 100644 1.9.3 -From 84fd054b518469989f566fb5a007b1a3fbcb8f8e Mon Sep 17 00:00:00 2001 +From cb0c54b0740722ecb04170b4dd5cf4979e45cd68 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 4 Feb 2014 17:29:37 +0000 -Subject: [PATCH 030/102] [omxcodec] Add deinterlace support +Subject: [PATCH 25/99] [omxcodec] Add deinterlace support --- xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp | 2 +- @@ -7326,10 +6801,10 @@ index 9138a20..c8ad4d8 100644 1.9.3 -From f64991ff2b74d5600cc7dd1e2959fc4b2a4f60bc Mon Sep 17 00:00:00 2001 +From e6cc3100344927e13a5be2050d59f675636542ef Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 5 Feb 2014 11:46:33 +0000 -Subject: [PATCH 031/102] [rbp/settings] Allow av sync type to be enabled +Subject: [PATCH 26/99] [rbp/settings] Allow av sync type to be enabled It works for dvdplayer --- @@ -7358,10 +6833,10 @@ index 2b7d0a6..1429256 100644 1.9.3 -From 4dfa451d32f3302babeaefdbe7b6d29bb65353d4 Mon Sep 17 00:00:00 2001 +From f327c953cc9d77c4f02a01bca3d5e7ad9e2c041e Mon Sep 17 00:00:00 2001 From: Ben Avison Date: Thu, 1 May 2014 16:28:39 +0100 -Subject: [PATCH 032/102] Improved file buffering in CArchive +Subject: [PATCH 27/99] Improved file buffering in CArchive Even though memcpy is typically inlined by the compiler into byte/word loads and stores (at least for release builds), the frequency with which 1, 2 and 4 @@ -7424,10 +6899,10 @@ index 6ed0f8f..8506d95 100644 1.9.3 -From e1da30ac65ceedef2eb5bf3e795507f8f3c593b6 Mon Sep 17 00:00:00 2001 +From 673af4509532521db5b4dc739906d03e849d984e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 16 Feb 2014 17:38:05 +0000 -Subject: [PATCH 033/102] [omxcodec] Only do essential calls in texture thread +Subject: [PATCH 28/99] [omxcodec] Only do essential calls in texture thread [omxcodec] Fix for files with no valid pts values. [omxcodec] Fix stall on seek/trickplay - need to reset start flag [omxcodec] Make sure we have a valid context when video decode starts before first fanart is decoded @@ -7777,10 +7252,10 @@ index c8ad4d8..f234f6d 100644 1.9.3 -From dc58ddd6e648ba0be7a0b0c97fcff9fa10b799e5 Mon Sep 17 00:00:00 2001 +From b31370c5583dcee46d5fd5fae1abfcd1c88036a6 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 8 Mar 2014 15:36:06 +0000 -Subject: [PATCH 034/102] [hifiberry] Hack: force it to be recognised as IEC958 +Subject: [PATCH 29/99] [hifiberry] Hack: force it to be recognised as IEC958 capable to enable passthrough options --- @@ -7788,7 +7263,7 @@ Subject: [PATCH 034/102] [hifiberry] Hack: force it to be recognised as IEC958 1 file changed, 4 insertions(+) diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp -index 7cb049c..649bcb1 100644 +index 8dee4bc..cc79e80 100644 --- a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp +++ b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp @@ -1296,6 +1296,10 @@ void CAESinkALSA::EnumerateDevice(AEDeviceInfoList &list, const std::string &dev @@ -7806,20 +7281,20 @@ index 7cb049c..649bcb1 100644 1.9.3 -From 05a408c7f18de9f3b47806223538b05c4ad23358 Mon Sep 17 00:00:00 2001 +From 4f93a32a7c009500cfaa33c4c1591047418c61d0 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 11 Mar 2014 18:50:23 +0000 -Subject: [PATCH 035/102] [dvdplayer] Use inexact seeking like omxplayer +Subject: [PATCH 30/99] [dvdplayer] Use inexact seeking like omxplayer --- xbmc/cores/dvdplayer/DVDPlayer.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp -index d01089e..8122d2a 100644 +index adbc312..dc0d6b2 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp -@@ -1892,7 +1892,11 @@ void CDVDPlayer::CheckAutoSceneSkip() +@@ -1887,7 +1887,11 @@ void CDVDPlayer::CheckAutoSceneSkip() /* * Seeking is NOT flushed so any content up to the demux point is retained when playing forwards. */ @@ -7831,7 +7306,7 @@ index d01089e..8122d2a 100644 /* * Seek doesn't always work reliably. Last physical seek time is recorded to prevent looping * if there was an error with seeking and it landed somewhere unexpected, perhaps back in the -@@ -1910,7 +1914,11 @@ void CDVDPlayer::CheckAutoSceneSkip() +@@ -1905,7 +1909,11 @@ void CDVDPlayer::CheckAutoSceneSkip() /* * Seeking is NOT flushed so any content up to the demux point is retained when playing forwards. */ @@ -7843,7 +7318,7 @@ index d01089e..8122d2a 100644 /* * Each commercial break is only skipped once so poorly detected commercial breaks can be * manually re-entered. Start and end are recorded to prevent looping and to allow seeking back -@@ -3111,9 +3119,12 @@ void CDVDPlayer::UpdateClockMaster() +@@ -3105,9 +3113,12 @@ void CDVDPlayer::UpdateClockMaster() void CDVDPlayer::FlushBuffers(bool queued, double pts, bool accurate) { double startpts; @@ -7860,10 +7335,10 @@ index d01089e..8122d2a 100644 1.9.3 -From b27b04e4b4a043271832668f92b5119067d10c18 Mon Sep 17 00:00:00 2001 +From d5e9b2aa6486c6f15aae439bcdb74b54d114c3d5 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 7 Apr 2014 18:19:32 +0100 -Subject: [PATCH 036/102] [rbp/omxplayer] When opening a stream don't try to +Subject: [PATCH 31/99] [rbp/omxplayer] When opening a stream don't try to update gui so often --- @@ -7890,11 +7365,11 @@ index e9ba7d3..0fdc3c2 100644 1.9.3 -From 1e240825884ba363c4f340e3bcefde0e18436098 Mon Sep 17 00:00:00 2001 +From 543cb5fce2846f4822160189d792d09edff8fffa Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 7 Apr 2014 15:28:57 +0100 -Subject: [PATCH 037/102] [omxcodec] Clamp video texture at edges to avoid - image wrapping +Subject: [PATCH 32/99] [omxcodec] Clamp video texture at edges to avoid image + wrapping --- xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp | 2 ++ @@ -7917,10 +7392,10 @@ index 51f56aa..2929a37 100644 1.9.3 -From a107ddc2b9b85151e7bf77ff7401531e55866eff Mon Sep 17 00:00:00 2001 +From 3aaea5bd52ed3554771f6f14efbd8ddbebf6d845 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 30 Mar 2014 15:54:34 +0100 -Subject: [PATCH 038/102] [omxplayer] Make the sharpness control act as a +Subject: [PATCH 33/99] [omxplayer] Make the sharpness control act as a sharpness control. This fixes scaling kernel as Mitchell Netravali, and varies sharpness over range B=[5/3,0] C=[-1/3,1/2] @@ -7929,10 +7404,10 @@ This fixes scaling kernel as Mitchell Netravali, and varies sharpness over range 1 file changed, 338 insertions(+) diff --git a/xbmc/cores/omxplayer/OMXPlayer.cpp b/xbmc/cores/omxplayer/OMXPlayer.cpp -index a4cfa1f..668a72a 100644 +index ab651b9..9fcfa23 100644 --- a/xbmc/cores/omxplayer/OMXPlayer.cpp +++ b/xbmc/cores/omxplayer/OMXPlayer.cpp -@@ -1043,6 +1043,334 @@ bool COMXPlayer::IsBetterStream(COMXCurrentStream& current, CDemuxStream* stream +@@ -1042,6 +1042,334 @@ bool COMXPlayer::IsBetterStream(COMXCurrentStream& current, CDemuxStream* stream return false; } @@ -8267,7 +7742,7 @@ index a4cfa1f..668a72a 100644 void COMXPlayer::Process() { bool bOmxWaitVideo = false; -@@ -1175,6 +1503,8 @@ void COMXPlayer::Process() +@@ -1174,6 +1502,8 @@ void COMXPlayer::Process() SetCaching(CACHESTATE_FLUSH); EDEINTERLACEMODE current_deinterlace = CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode; @@ -8276,7 +7751,7 @@ index a4cfa1f..668a72a 100644 while (!m_bAbortRequest) { -@@ -1206,6 +1536,13 @@ void COMXPlayer::Process() +@@ -1205,6 +1535,13 @@ void COMXPlayer::Process() current_deinterlace = CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode; } @@ -8290,7 +7765,7 @@ index a4cfa1f..668a72a 100644 m_video_fifo = (int)(100.0*(m_omxPlayerVideo.GetDecoderBufferSize()-m_omxPlayerVideo.GetDecoderFreeSpace())/m_omxPlayerVideo.GetDecoderBufferSize()); m_audio_fifo = (int)(100.0*audio_fifo/m_omxPlayerAudio.GetCacheTotal()); -@@ -4574,6 +4911,7 @@ void COMXPlayer::GetRenderFeatures(std::vector &renderFeatures) +@@ -4553,6 +4890,7 @@ void COMXPlayer::GetRenderFeatures(std::vector &renderFeatures) renderFeatures.push_back(RENDERFEATURE_CROP); renderFeatures.push_back(RENDERFEATURE_PIXEL_RATIO); renderFeatures.push_back(RENDERFEATURE_ZOOM); @@ -8302,21 +7777,21 @@ index a4cfa1f..668a72a 100644 1.9.3 -From b0f1716de6047490c4c502bc5023219489c34ba7 Mon Sep 17 00:00:00 2001 +From 0d430b13c0052b9409c6de656667000d1011feba Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 16 Apr 2014 21:18:06 +0100 -Subject: [PATCH 039/102] [omxplayer] Don't propagate 3d flags based on - supported 3d modes +Subject: [PATCH 34/99] [omxplayer] Don't propagate 3d flags based on supported + 3d modes --- xbmc/cores/omxplayer/OMXPlayerVideo.cpp | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -index 2fdbe18..e6bf2d0 100644 +index af439e7..77dad37 100644 --- a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp +++ b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -@@ -746,36 +746,15 @@ void OMXPlayerVideo::ResolutionUpdateCallBack(uint32_t width, uint32_t height, f +@@ -747,36 +747,15 @@ void OMXPlayerVideo::ResolutionUpdateCallBack(uint32_t width, uint32_t height, f unsigned flags = 0; ERenderFormat format = RENDER_FMT_BYPASS; @@ -8361,10 +7836,10 @@ index 2fdbe18..e6bf2d0 100644 1.9.3 -From 605211b04a4bcbd6a7e5b98fdd748c01d2455fbc Mon Sep 17 00:00:00 2001 +From 1e9ed1c6954c05d18da107fc8c500a0e685cb4b1 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 17 Apr 2014 13:00:52 +0100 -Subject: [PATCH 040/102] [graphics] Don't set stereo mode based on resolution +Subject: [PATCH 35/99] [graphics] Don't set stereo mode based on resolution The resolution change should follow stereo mode --- @@ -8408,10 +7883,10 @@ index 5bffdf5..7e4fdd4 100644 1.9.3 -From b02ed2e1e04e2d082ff8421b7e2fcb80e15e6e62 Mon Sep 17 00:00:00 2001 +From 293fc1887aa64325e7cf8a6dc3a8c8444ddedcfe Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 17 Apr 2014 13:01:51 +0100 -Subject: [PATCH 041/102] [graphics] Allow switching to a more suitable 3D +Subject: [PATCH 36/99] [graphics] Allow switching to a more suitable 3D resolution --- @@ -8501,10 +7976,10 @@ index 0a27643..df55e92 100644 1.9.3 -From fb3ce65df80a323c9809ddb795aba36a3fbb9a1e Mon Sep 17 00:00:00 2001 +From 084fc70894c4da7fb38a67c7be84faa04570102e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 17 Apr 2014 13:38:55 +0100 -Subject: [PATCH 042/102] [3D] Support switching to 3D resolutions +Subject: [PATCH 37/99] [3D] Support switching to 3D resolutions Include matching 3D flags (SBS/TAB) in the score of a resolution to switch to, to enable switching to 3d modes. Also remove the old code that treated 3D modes differently when assigning a score. @@ -8589,10 +8064,10 @@ index 83c3adb..8076e76 100644 1.9.3 -From cee7c61f26e7ef4eee06450a549bcc6d1595a252 Mon Sep 17 00:00:00 2001 +From d4bde73fbf844088d448dcd067e656e12267c6e3 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 23 Apr 2014 00:05:07 +0100 -Subject: [PATCH 043/102] [graphics] Make pixel ratio for 3d modes consistent +Subject: [PATCH 38/99] [graphics] Make pixel ratio for 3d modes consistent Note: Use the stored stereo flags from lists of resolutions. Use current stereo mode for current resolution. @@ -8780,10 +8255,10 @@ index 90b57e1..5b26b20 100644 1.9.3 -From 50b494ec8d7c50d1b62e4c98a2e442ad72d70700 Mon Sep 17 00:00:00 2001 +From e75402b7fdbdc4c7037f4fdfd542bba048501350 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 23 Apr 2014 21:07:51 +0100 -Subject: [PATCH 044/102] [PiSink] More attempts to reduce underrun audio +Subject: [PATCH 39/99] [PiSink] More attempts to reduce underrun audio glitches with multichannl and high samplerate --- @@ -8906,10 +8381,10 @@ index 19a9411..0a09275 100644 1.9.3 -From ba6de3c9448a90c35df2b4bccf12f354c8422a55 Mon Sep 17 00:00:00 2001 +From ec1b483946a1d269ba36933b62aa8e61318d987c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 22 Apr 2014 12:23:23 +0100 -Subject: [PATCH 045/102] [omxplayer] Make dvdplayer the default for dvd images +Subject: [PATCH 40/99] [omxplayer] Make dvdplayer the default for dvd images --- xbmc/cores/omxplayer/omxplayer_advancedsettings.xml | 2 +- @@ -8931,11 +8406,11 @@ index 77c6a15..51c0daf 100644 1.9.3 -From 4f6bde16d4768b34732df62ca04418b123d027b5 Mon Sep 17 00:00:00 2001 +From 8b8c3a1f2fb66b2b849c75492d117513106aaa9c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 26 Apr 2014 17:27:52 +0100 -Subject: [PATCH 046/102] [cec] Don't suspend pi on tv switch off - it can't - wake up +Subject: [PATCH 41/99] [cec] Don't suspend pi on tv switch off - it can't wake + up --- system/peripherals.xml | 2 +- @@ -8958,10 +8433,10 @@ index a906628..9b5271a 100644 1.9.3 -From b7433fb3abf84933605135201fa4499aed15b1b7 Mon Sep 17 00:00:00 2001 +From c5b85f1ce7154626cff40645f813e77e2b547fab Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 27 Jun 2013 01:25:57 +0100 -Subject: [PATCH 048/102] [rbp/omxplayer] Do we need discontinuity handling? +Subject: [PATCH 43/99] [rbp/omxplayer] Do we need discontinuity handling? So far I've not seen what this is needed for and it does cause problems for some files. --- @@ -8969,10 +8444,10 @@ So far I've not seen what this is needed for and it does cause problems for some 1 file changed, 1 insertion(+) diff --git a/xbmc/cores/omxplayer/OMXPlayer.cpp b/xbmc/cores/omxplayer/OMXPlayer.cpp -index 668a72a..ebb59d5 100644 +index 9fcfa23..030d7b6 100644 --- a/xbmc/cores/omxplayer/OMXPlayer.cpp +++ b/xbmc/cores/omxplayer/OMXPlayer.cpp -@@ -2387,6 +2387,7 @@ static void UpdateLimits(double& minimum, double& maximum, double dts) +@@ -2382,6 +2382,7 @@ static void UpdateLimits(double& minimum, double& maximum, double dts) void COMXPlayer::CheckContinuity(COMXCurrentStream& current, DemuxPacket* pPacket) { @@ -8984,11 +8459,11 @@ index 668a72a..ebb59d5 100644 1.9.3 -From 66a9d175627a9a298aa7f41c81428ccc48c7dd8d Mon Sep 17 00:00:00 2001 +From 7cfce548f1e59cbace180692e4dec5f19214801e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Thu, 24 Oct 2013 00:53:26 +0100 -Subject: [PATCH 049/102] [rbp/omxplayer] Avoid marking non-monotonic - timestamps as unknown +Subject: [PATCH 44/99] [rbp/omxplayer] Avoid marking non-monotonic timestamps + as unknown Following a single spurious timestamp that is in the future, all subsequent timestamps will be marked unknown causing out of sync. @@ -9029,10 +8504,11 @@ index 77731a9..5f9d028 100644 1.9.3 -From 953b12e91da05a8202f7fbc69ab0b818f25964da Mon Sep 17 00:00:00 2001 + +From a503852a52721d5cc0dac3a4f5dffd4886087294 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 13 Dec 2013 16:25:23 +0000 -Subject: [PATCH 051/102] Add time taken to resample to log +Subject: [PATCH 46/99] Add time taken to resample to log --- xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 7 +++++++ @@ -9040,10 +8516,10 @@ Subject: [PATCH 051/102] Add time taken to resample to log 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -index 4ee53ec..a4337f1 100644 +index d6a18f5..65a0756 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -@@ -2610,7 +2610,14 @@ void CActiveAE::ResampleSounds() +@@ -2647,7 +2647,14 @@ void CActiveAE::ResampleSounds() { if (!(*it)->IsConverted()) { @@ -9059,10 +8535,10 @@ index 4ee53ec..a4337f1 100644 break; } diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESound.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESound.h -index 9324e1e..4405f66 100644 +index 01aafe3..5ab83a2 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESound.h +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESound.h -@@ -58,8 +58,8 @@ class CActiveAESound : public IAESound +@@ -57,8 +57,8 @@ class CActiveAESound : public IAESound static int Read(void *h, uint8_t* buf, int size); static int64_t Seek(void *h, int64_t pos, int whence); @@ -9076,10 +8552,10 @@ index 9324e1e..4405f66 100644 1.9.3 -From 6145eb43d0dfda3fcbb739dbed4af84d2c272a00 Mon Sep 17 00:00:00 2001 +From 789d5b5fa3f90d4a0b477cf8cba81473734107d1 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 14 Dec 2013 16:55:05 +0000 -Subject: [PATCH 052/102] logging: Add microsecond timer to log messages +Subject: [PATCH 47/99] logging: Add microsecond timer to log messages --- xbmc/utils/log.cpp | 12 +++++++++--- @@ -9140,10 +8616,10 @@ index dd6ef26..8edf2fd 100644 1.9.3 -From d7817a5e964c2e85ab49b74ac73b0d28491702d0 Mon Sep 17 00:00:00 2001 +From 6f03e6732cf7a560dd342ead48ea81363817f99d Mon Sep 17 00:00:00 2001 From: Jonathan Marshall Date: Sat, 2 Nov 2013 23:49:17 +1300 -Subject: [PATCH 053/102] adds GetTvShowSeasons +Subject: [PATCH 48/99] adds GetTvShowSeasons --- xbmc/video/VideoDatabase.cpp | 30 ++++++++++++++++++++++++------ @@ -9151,10 +8627,10 @@ Subject: [PATCH 053/102] adds GetTvShowSeasons 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp -index 8ac7e41..6d28a42 100644 +index 55036e0..8ef5311 100644 --- a/xbmc/video/VideoDatabase.cpp +++ b/xbmc/video/VideoDatabase.cpp -@@ -4060,7 +4060,7 @@ bool CVideoDatabase::RemoveArtForItem(int mediaId, const MediaType &mediaType, c +@@ -4075,7 +4075,7 @@ bool CVideoDatabase::RemoveArtForItem(int mediaId, const MediaType &mediaType, c return result; } @@ -9163,7 +8639,7 @@ index 8ac7e41..6d28a42 100644 { try { -@@ -4071,19 +4071,37 @@ bool CVideoDatabase::GetTvShowSeasonArt(int showId, map +@@ -4086,19 +4086,37 @@ bool CVideoDatabase::GetTvShowSeasonArt(int showId, map CStdString sql = PrepareSQL("select idSeason,season from seasons where idShow=%i", showId); m_pDS2->query(sql.c_str()); @@ -9207,10 +8683,10 @@ index 8ac7e41..6d28a42 100644 return true; } diff --git a/xbmc/video/VideoDatabase.h b/xbmc/video/VideoDatabase.h -index 093a48e..9db34f4 100644 +index 492eebb..f6026c2 100644 --- a/xbmc/video/VideoDatabase.h +++ b/xbmc/video/VideoDatabase.h -@@ -738,6 +738,7 @@ class CVideoDatabase : public CDatabase +@@ -744,6 +744,7 @@ class CVideoDatabase : public CDatabase std::string GetArtForItem(int mediaId, const MediaType &mediaType, const std::string &artType); bool RemoveArtForItem(int mediaId, const MediaType &mediaType, const std::string &artType); bool RemoveArtForItem(int mediaId, const MediaType &mediaType, const std::set &artTypes); @@ -9222,20 +8698,20 @@ index 093a48e..9db34f4 100644 1.9.3 -From e66f4c004028a0abdb10f630f7e5c3aec2c1d9c1 Mon Sep 17 00:00:00 2001 +From 0daa19069981aa0fa60cc03cad74465b120ca152 Mon Sep 17 00:00:00 2001 From: Jonathan Marshall Date: Sat, 2 Nov 2013 23:50:10 +1300 -Subject: [PATCH 054/102] move AddSeason() public. +Subject: [PATCH 49/99] move AddSeason() public. --- xbmc/video/VideoDatabase.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xbmc/video/VideoDatabase.h b/xbmc/video/VideoDatabase.h -index 9db34f4..eaf2e36 100644 +index f6026c2..a7acea3 100644 --- a/xbmc/video/VideoDatabase.h +++ b/xbmc/video/VideoDatabase.h -@@ -749,6 +749,7 @@ class CVideoDatabase : public CDatabase +@@ -755,6 +755,7 @@ class CVideoDatabase : public CDatabase virtual bool GetFilter(CDbUrl &videoUrl, Filter &filter, SortDescription &sorting); @@ -9243,7 +8719,7 @@ index 9db34f4..eaf2e36 100644 int AddSet(const CStdString& strSet); void ClearMovieSet(int idMovie); void SetMovieSet(int idMovie, int idSet); -@@ -779,7 +780,6 @@ class CVideoDatabase : public CDatabase +@@ -785,7 +786,6 @@ class CVideoDatabase : public CDatabase int AddTvShow(); int AddMusicVideo(const CStdString& strFilenameAndPath); @@ -9255,10 +8731,10 @@ index 9db34f4..eaf2e36 100644 1.9.3 -From a621b135be3841fa8a3b20f8c63c2d3f81a8d8c2 Mon Sep 17 00:00:00 2001 +From 295a279646f63c880570a6edd282e29b099f1c95 Mon Sep 17 00:00:00 2001 From: Jonathan Marshall Date: Sat, 2 Nov 2013 23:48:24 +1300 -Subject: [PATCH 055/102] adds GetArt function to (video) scraper, allowing art +Subject: [PATCH 50/99] adds GetArt function to (video) scraper, allowing art to be fetched given the video identifier. --- @@ -9269,7 +8745,7 @@ Subject: [PATCH 055/102] adds GetArt function to (video) scraper, allowing art 4 files changed, 53 insertions(+) diff --git a/xbmc/addons/Scraper.cpp b/xbmc/addons/Scraper.cpp -index 8ab526c..9c32bb5 100644 +index 225220b..4f93865 100644 --- a/xbmc/addons/Scraper.cpp +++ b/xbmc/addons/Scraper.cpp @@ -925,6 +925,44 @@ EPISODELIST CScraper::GetEpisodeList(XFILE::CCurlFile &fcurl, const CScraperUrl @@ -9318,7 +8794,7 @@ index 8ab526c..9c32bb5 100644 bool CScraper::GetVideoDetails(XFILE::CCurlFile &fcurl, const CScraperUrl &scurl, bool fMovie/*else episode*/, CVideoInfoTag &video) diff --git a/xbmc/addons/Scraper.h b/xbmc/addons/Scraper.h -index 717a480..d27747a 100644 +index c7274f2..5df5296 100644 --- a/xbmc/addons/Scraper.h +++ b/xbmc/addons/Scraper.h @@ -18,6 +18,8 @@ @@ -9333,7 +8809,7 @@ index 717a480..d27747a 100644 @@ -146,6 +148,7 @@ class CScraper : public CAddon CAlbum &album); bool GetArtistDetails(XFILE::CCurlFile &fcurl, const CScraperUrl &scurl, - const CStdString &sSearch, CArtist &artist); + const std::string &sSearch, CArtist &artist); + bool GetArt(XFILE::CCurlFile &fcurl, const std::string &id, CVideoInfoTag &video); private: @@ -9376,11 +8852,11 @@ index 22ac229..75bc341 100644 1.9.3 -From a42f7ed37045b85d7ae79a79230438d6834e8d13 Mon Sep 17 00:00:00 2001 +From 36c7b7aee6007665a45667839c0857a69f4c23dd Mon Sep 17 00:00:00 2001 From: Jonathan Marshall Date: Sat, 2 Nov 2013 23:53:14 +1300 -Subject: [PATCH 056/102] refresh season art if a new season is found that - isn't recorded in the database yet. Fixes #14339 +Subject: [PATCH 51/99] refresh season art if a new season is found that isn't + recorded in the database yet. Fixes #14339 --- xbmc/video/VideoInfoScanner.cpp | 33 ++++++++++++++++++++++++++++++++- @@ -9388,10 +8864,10 @@ Subject: [PATCH 056/102] refresh season art if a new season is found that 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/xbmc/video/VideoInfoScanner.cpp b/xbmc/video/VideoInfoScanner.cpp -index b5a5864..e0056bd 100644 +index 04e578b..b86746a 100644 --- a/xbmc/video/VideoInfoScanner.cpp +++ b/xbmc/video/VideoInfoScanner.cpp -@@ -1361,6 +1361,10 @@ namespace VIDEO +@@ -1360,6 +1360,10 @@ namespace VIDEO pDlgProgress->Progress(); } @@ -9402,7 +8878,7 @@ index b5a5864..e0056bd 100644 EPISODELIST episodes; bool hasEpisodeGuide = false; -@@ -1409,6 +1413,8 @@ namespace VIDEO +@@ -1408,6 +1412,8 @@ namespace VIDEO } if (AddVideo(&item, CONTENT_TVSHOWS, file->isFolder, true, &showInfo) < 0) return INFO_ERROR; @@ -9411,7 +8887,7 @@ index b5a5864..e0056bd 100644 continue; } -@@ -1538,6 +1544,8 @@ namespace VIDEO +@@ -1537,6 +1543,8 @@ namespace VIDEO if (AddVideo(&item, CONTENT_TVSHOWS, file->isFolder, useLocal, &showInfo) < 0) return INFO_ERROR; @@ -9420,7 +8896,7 @@ index b5a5864..e0056bd 100644 } else { -@@ -1546,9 +1554,27 @@ namespace VIDEO +@@ -1545,9 +1553,27 @@ namespace VIDEO file->cDate.GetAsLocalizedDate().c_str(), file->strTitle.c_str()); } } @@ -9448,7 +8924,7 @@ index b5a5864..e0056bd 100644 CStdString CVideoInfoScanner::GetnfoFile(CFileItem *item, bool bGrabAny) const { CStdString nfoFile; -@@ -1817,6 +1843,11 @@ namespace VIDEO +@@ -1812,6 +1838,11 @@ namespace VIDEO } for (int season = -1; season <= maxSeasons; season++) { @@ -9460,7 +8936,7 @@ index b5a5864..e0056bd 100644 map art; if (useLocal) { -@@ -1870,7 +1901,7 @@ namespace VIDEO +@@ -1865,7 +1896,7 @@ namespace VIDEO art.insert(make_pair(artTypes.front(), image)); } @@ -9470,26 +8946,26 @@ index b5a5864..e0056bd 100644 } diff --git a/xbmc/video/VideoInfoScanner.h b/xbmc/video/VideoInfoScanner.h -index 2f0d60f..94fca85 100644 +index 7da1bf2..c764e20 100644 --- a/xbmc/video/VideoInfoScanner.h +++ b/xbmc/video/VideoInfoScanner.h -@@ -228,6 +228,8 @@ namespace VIDEO +@@ -230,6 +230,8 @@ namespace VIDEO */ INFO_RET OnProcessSeriesFolder(EPISODELIST& files, const ADDON::ScraperPtr &scraper, bool useLocal, const CVideoInfoTag& showInfo, CGUIDialogProgress* pDlgProgress = NULL); + void UpdateSeasons(const CVideoInfoTag &showInfo, const ADDON::ScraperPtr &scraper, bool useLocal); + bool EnumerateSeriesFolder(CFileItem* item, EPISODELIST& episodeList); - bool EnumerateEpisodeItem(const CFileItem *item, EPISODELIST& episodeList); bool ProcessItemByVideoInfoTag(const CFileItem *item, EPISODELIST &episodeList); + -- 1.9.3 -From fbb40d3e32c9f0181c39e025d8ef05fbfdb0b31f Mon Sep 17 00:00:00 2001 +From 7023dcb9c045af7916b7ddf11cab9ff5f11d262c Mon Sep 17 00:00:00 2001 From: Jonathan Marshall Date: Sat, 2 Nov 2013 23:53:34 +1300 -Subject: [PATCH 057/102] REMOVEME: updated thetvdb.com scraper to support art +Subject: [PATCH 52/99] REMOVEME: updated thetvdb.com scraper to support art updates --- @@ -9600,17 +9076,17 @@ index 39e604d..60a0e96 100644 1.9.3 -From 8d71a5c0f9f90c5450c1a644c3f8d510494bef4f Mon Sep 17 00:00:00 2001 +From 9a8011041d2b0b17aac4b23155136daaeb4a684b Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 22 Mar 2014 16:40:01 +0000 -Subject: [PATCH 058/102] Enable PYTHONOPTIMIZE for Pi +Subject: [PATCH 53/99] Enable PYTHONOPTIMIZE for Pi --- xbmc/interfaces/python/XBPython.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xbmc/interfaces/python/XBPython.cpp b/xbmc/interfaces/python/XBPython.cpp -index 0d6dabc..c3fd0f1 100644 +index 099c042..95caaa0 100644 --- a/xbmc/interfaces/python/XBPython.cpp +++ b/xbmc/interfaces/python/XBPython.cpp @@ -462,6 +462,10 @@ bool XBPython::InitializeEngine() @@ -9628,10 +9104,10 @@ index 0d6dabc..c3fd0f1 100644 1.9.3 -From 4d75c729f34c7a3240c7ba2f4ba4f685b98772f5 Mon Sep 17 00:00:00 2001 +From 8c41eb9ed90a3959021d8f9e5da5f88f873f3ab4 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 28 Apr 2014 18:07:45 +0100 -Subject: [PATCH 059/102] [rpi] Make ActiveAE thread higher priority to make +Subject: [PATCH 54/99] [rpi] Make ActiveAE thread higher priority to make audio underrun less likely --- @@ -9639,7 +9115,7 @@ Subject: [PATCH 059/102] [rpi] Make ActiveAE thread higher priority to make 1 file changed, 6 insertions(+) diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -index a4337f1..3ac182a 100644 +index 65a0756..c022b5c 100644 --- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp +++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp @@ -2168,6 +2168,12 @@ void CActiveAE::LoadSettings() @@ -9659,3507 +9135,10 @@ index a4337f1..3ac182a 100644 1.9.3 -From 8ac8fd1742b9ee3cf118806f13798760f19cab63 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 29 Apr 2014 15:23:22 +0100 -Subject: [PATCH 060/102] [ffmpeg] Speed up wtv index creation - -The index creation is O(N^2) with number of entries (typically thousands). -On a Pi this can take more than 60 seconds to execute for a recording of a few hours. - -By replacing with an O(N) loop, this takes virtually zero time ---- - tools/depends/target/ffmpeg/Makefile | 3 +- - .../ffmpeg_Speed_up_wtv_index_creation.patch | 47 ++++++++++++++++++++++ - 2 files changed, 49 insertions(+), 1 deletion(-) - create mode 100644 tools/depends/target/ffmpeg/ffmpeg_Speed_up_wtv_index_creation.patch - -diff --git a/tools/depends/target/ffmpeg/Makefile b/tools/depends/target/ffmpeg/Makefile -index 51e1918..f514ae6 100644 ---- a/tools/depends/target/ffmpeg/Makefile -+++ b/tools/depends/target/ffmpeg/Makefile -@@ -1,6 +1,6 @@ - include ../../Makefile.include - include FFMPEG-VERSION --DEPS= ../../Makefile.include FFMPEG-VERSION Makefile -+DEPS= ../../Makefile.include FFMPEG-VERSION Makefile ffmpeg_Speed_up_wtv_index_creation.patch - - # set to "yes" to enable patching - # we don't apply patches until we move to a vanilla ffmpeg tarball -@@ -63,6 +63,7 @@ $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) - rm -rf $(PLATFORM); mkdir -p $(PLATFORM) - cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE) - cd $(PLATFORM); sed -i".bak" -e "s%pkg_config_default=pkg-config%export PKG_CONFIG_LIBDIR=$(PREFIX)/lib/pkgconfig\npkg_config_default=$(NATIVEPREFIX)/bin/pkg-config%" configure -+ cd $(PLATFORM); patch -p3 < ../ffmpeg_Speed_up_wtv_index_creation.patch - cd $(PLATFORM);\ - CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \ - ./configure $(ffmpg_config) -diff --git a/tools/depends/target/ffmpeg/ffmpeg_Speed_up_wtv_index_creation.patch b/tools/depends/target/ffmpeg/ffmpeg_Speed_up_wtv_index_creation.patch -new file mode 100644 -index 0000000..8f5f989 ---- /dev/null -+++ b/tools/depends/target/ffmpeg/ffmpeg_Speed_up_wtv_index_creation.patch -@@ -0,0 +1,47 @@ -+commit 0e7427498cb1131671f6fe9d054245ae7e5a36f5 -+Author: popcornmix -+Date: Tue Mar 25 19:43:07 2014 +0000 -+ -+ [ffmpeg] Speed up wtv index creation -+ -+ The index creation is O(N^2) with number of entries (typically thousands). -+ On a Pi this can take more than 60 seconds to execute for a recording of a few hours. -+ -+ By replacing with an O(N) loop, this takes virtually zero time -+ -+diff --git a/lib/ffmpeg/libavformat/wtvdec.c b/lib/ffmpeg/libavformat/wtvdec.c -+index e423370..70898bd 100644 -+--- a/lib/ffmpeg/libavformat/wtvdec.c -++++ b/lib/ffmpeg/libavformat/wtvdec.c -+@@ -980,21 +980,23 @@ static int read_header(AVFormatContext *s) -+ pb = wtvfile_open(s, root, root_size, ff_timeline_table_0_entries_Events_le16); -+ if (pb) { -+ int i; -++ AVIndexEntry *e = wtv->index_entries; -++ AVIndexEntry *e_end = wtv->index_entries + wtv->nb_index_entries - 1; -++ uint64_t last_position = 0; -+ while (1) { -+ uint64_t frame_nb = avio_rl64(pb); -+ uint64_t position = avio_rl64(pb); -++ while (frame_nb > e->size && e <= e_end) { -++ e->pos = last_position; -++ e++; -++ } -+ if (url_feof(pb)) -+ break; -+- for (i = wtv->nb_index_entries - 1; i >= 0; i--) { -+- AVIndexEntry *e = wtv->index_entries + i; -+- if (frame_nb > e->size) -+- break; -+- if (position > e->pos) -+- e->pos = position; -+- } -++ last_position = position; -+ } -++ e_end->pos = last_position; -+ wtvfile_close(pb); -+- st->duration = wtv->index_entries[wtv->nb_index_entries - 1].timestamp; -++ st->duration = e_end->timestamp; -+ } -+ } -+ } --- -1.9.3 - - -From 5a4f696fb8f2406f3caafbe88447db0ed3368283 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 29 Apr 2014 15:55:28 +0100 -Subject: [PATCH 061/102] [ffmpeg] vc-1: Optimise parser (with special - attention to ARM) - -Backport from upstream ffmpeg ---- - ...earch-code-search-functions-into-separate.patch | 752 +++++++++++++++++++++ - ...atform-specific-start-code-search-routine.patch | 143 ++++ - ...mise-parser-with-special-attention-to-ARM.patch | 401 +++++++++++ - tools/depends/target/ffmpeg/Makefile | 8 +- - 4 files changed, 1303 insertions(+), 1 deletion(-) - create mode 100644 tools/depends/target/ffmpeg/0001-h264-Move-search-code-search-functions-into-separate.patch - create mode 100644 tools/depends/target/ffmpeg/0002-vc-1-Add-platform-specific-start-code-search-routine.patch - create mode 100644 tools/depends/target/ffmpeg/0003-vc-1-Optimise-parser-with-special-attention-to-ARM.patch - -diff --git a/tools/depends/target/ffmpeg/0001-h264-Move-search-code-search-functions-into-separate.patch b/tools/depends/target/ffmpeg/0001-h264-Move-search-code-search-functions-into-separate.patch -new file mode 100644 -index 0000000..62e473d ---- /dev/null -+++ b/tools/depends/target/ffmpeg/0001-h264-Move-search-code-search-functions-into-separate.patch -@@ -0,0 +1,752 @@ -+From 8cdb3bf2837a3fb4fff3c6586316f81ae5f7b6cd Mon Sep 17 00:00:00 2001 -+From: Ben Avison -+Date: Wed, 16 Apr 2014 01:51:31 +0100 -+Subject: [PATCH 1/3] h264: Move search code search functions into separate -+ source files. -+ -+This permits re-use with parsers for codecs which use similar start codes. -+ -+Signed-off-by: Michael Niedermayer -+--- -+ libavcodec/Makefile | 2 +- -+ libavcodec/arm/Makefile | 2 +- -+ libavcodec/arm/h264dsp_armv6.S | 253 -------------------------------------- -+ libavcodec/arm/h264dsp_init_arm.c | 4 +- -+ libavcodec/arm/startcode_armv6.S | 253 ++++++++++++++++++++++++++++++++++++++ -+ libavcodec/h264dsp.c | 31 +---- -+ libavcodec/startcode.c | 57 +++++++++ -+ libavcodec/startcode.h | 35 ++++++ -+ 8 files changed, 351 insertions(+), 286 deletions(-) -+ delete mode 100644 libavcodec/arm/h264dsp_armv6.S -+ create mode 100644 libavcodec/arm/startcode_armv6.S -+ create mode 100644 libavcodec/startcode.c -+ create mode 100644 libavcodec/startcode.h -+ -+diff --git a/libavcodec/Makefile b/libavcodec/Makefile -+index b56ecd1..19caf11 100644 -+--- a/libavcodec/Makefile -++++ b/libavcodec/Makefile -+@@ -49,7 +49,7 @@ OBJS-$(CONFIG_FFT) += avfft.o fft_fixed.o fft_float.o \ -+ OBJS-$(CONFIG_GOLOMB) += golomb.o -+ OBJS-$(CONFIG_H263DSP) += h263dsp.o -+ OBJS-$(CONFIG_H264CHROMA) += h264chroma.o -+-OBJS-$(CONFIG_H264DSP) += h264dsp.o h264idct.o -++OBJS-$(CONFIG_H264DSP) += h264dsp.o h264idct.o startcode.o -+ OBJS-$(CONFIG_H264PRED) += h264pred.o -+ OBJS-$(CONFIG_H264QPEL) += h264qpel.o -+ OBJS-$(CONFIG_HPELDSP) += hpeldsp.o -+diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile -+index a8446b2..b6410b2 100644 -+--- a/libavcodec/arm/Makefile -++++ b/libavcodec/arm/Makefile -+@@ -47,7 +47,7 @@ ARMV6-OBJS-$(CONFIG_DSPUTIL) += arm/dsputil_init_armv6.o \ -+ arm/simple_idct_armv6.o \ -+ -+ ARMV6-OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_armv6.o -+-ARMV6-OBJS-$(CONFIG_H264DSP) += arm/h264dsp_armv6.o -++ARMV6-OBJS-$(CONFIG_H264DSP) += arm/startcode_armv6.o -+ ARMV6-OBJS-$(CONFIG_HPELDSP) += arm/hpeldsp_init_armv6.o \ -+ arm/hpeldsp_armv6.o -+ ARMV6-OBJS-$(CONFIG_MPEGAUDIODSP) += arm/mpegaudiodsp_fixed_armv6.o -+diff --git a/libavcodec/arm/h264dsp_armv6.S b/libavcodec/arm/h264dsp_armv6.S -+deleted file mode 100644 -+index 2758262..0000000 -+--- a/libavcodec/arm/h264dsp_armv6.S -++++ /dev/null -+@@ -1,253 +0,0 @@ -+-/* -+- * Copyright (c) 2013 RISC OS Open Ltd -+- * Author: Ben Avison -+- * -+- * This file is part of FFmpeg. -+- * -+- * FFmpeg is free software; you can redistribute it and/or -+- * modify it under the terms of the GNU Lesser General Public -+- * License as published by the Free Software Foundation; either -+- * version 2.1 of the License, or (at your option) any later version. -+- * -+- * FFmpeg 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 -+- * Lesser General Public License for more details. -+- * -+- * You should have received a copy of the GNU Lesser General Public -+- * License along with FFmpeg; if not, write to the Free Software -+- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -+- */ -+- -+-#include "libavutil/arm/asm.S" -+- -+-RESULT .req a1 -+-BUF .req a1 -+-SIZE .req a2 -+-PATTERN .req a3 -+-PTR .req a4 -+-DAT0 .req v1 -+-DAT1 .req v2 -+-DAT2 .req v3 -+-DAT3 .req v4 -+-TMP0 .req v5 -+-TMP1 .req v6 -+-TMP2 .req ip -+-TMP3 .req lr -+- -+-#define PRELOAD_DISTANCE 4 -+- -+-.macro innerloop4 -+- ldr DAT0, [PTR], #4 -+- subs SIZE, SIZE, #4 @ C flag survives rest of macro -+- sub TMP0, DAT0, PATTERN, lsr #14 -+- bic TMP0, TMP0, DAT0 -+- ands TMP0, TMP0, PATTERN -+-.endm -+- -+-.macro innerloop16 decrement, do_preload -+- ldmia PTR!, {DAT0,DAT1,DAT2,DAT3} -+- .ifnc "\do_preload","" -+- pld [PTR, #PRELOAD_DISTANCE*32] -+- .endif -+- .ifnc "\decrement","" -+- subs SIZE, SIZE, #\decrement @ C flag survives rest of macro -+- .endif -+- sub TMP0, DAT0, PATTERN, lsr #14 -+- sub TMP1, DAT1, PATTERN, lsr #14 -+- bic TMP0, TMP0, DAT0 -+- bic TMP1, TMP1, DAT1 -+- sub TMP2, DAT2, PATTERN, lsr #14 -+- sub TMP3, DAT3, PATTERN, lsr #14 -+- ands TMP0, TMP0, PATTERN -+- bic TMP2, TMP2, DAT2 -+- it eq -+- andseq TMP1, TMP1, PATTERN -+- bic TMP3, TMP3, DAT3 -+- itt eq -+- andseq TMP2, TMP2, PATTERN -+- andseq TMP3, TMP3, PATTERN -+-.endm -+- -+-/* int ff_h264_find_start_code_candidate_armv6(const uint8_t *buf, int size) */ -+-function ff_h264_find_start_code_candidate_armv6, export=1 -+- push {v1-v6,lr} -+- mov PTR, BUF -+- @ Ensure there are at least (PRELOAD_DISTANCE+2) complete cachelines to go -+- @ before using code that does preloads -+- cmp SIZE, #(PRELOAD_DISTANCE+3)*32 - 1 -+- blo 60f -+- -+- @ Get to word-alignment, 1 byte at a time -+- tst PTR, #3 -+- beq 2f -+-1: ldrb DAT0, [PTR], #1 -+- sub SIZE, SIZE, #1 -+- teq DAT0, #0 -+- beq 90f -+- tst PTR, #3 -+- bne 1b -+-2: @ Get to 4-word alignment, 1 word at a time -+- ldr PATTERN, =0x80008000 -+- setend be -+- tst PTR, #12 -+- beq 4f -+-3: innerloop4 -+- bne 91f -+- tst PTR, #12 -+- bne 3b -+-4: @ Get to cacheline (8-word) alignment -+- tst PTR, #16 -+- beq 5f -+- innerloop16 16 -+- bne 93f -+-5: @ Check complete cachelines, with preloading -+- @ We need to stop when there are still (PRELOAD_DISTANCE+1) -+- @ complete cachelines to go -+- sub SIZE, SIZE, #(PRELOAD_DISTANCE+2)*32 -+-6: innerloop16 , do_preload -+- bne 93f -+- innerloop16 32 -+- bne 93f -+- bcs 6b -+- @ Preload trailing part-cacheline, if any -+- tst SIZE, #31 -+- beq 7f -+- pld [PTR, #(PRELOAD_DISTANCE+1)*32] -+- @ Check remaining data without doing any more preloads. First -+- @ do in chunks of 4 words: -+-7: adds SIZE, SIZE, #(PRELOAD_DISTANCE+2)*32 - 16 -+- bmi 9f -+-8: innerloop16 16 -+- bne 93f -+- bcs 8b -+- @ Then in words: -+-9: adds SIZE, SIZE, #16 - 4 -+- bmi 11f -+-10: innerloop4 -+- bne 91f -+- bcs 10b -+-11: setend le -+- @ Check second byte of final halfword -+- ldrb DAT0, [PTR, #-1] -+- teq DAT0, #0 -+- beq 90f -+- @ Check any remaining bytes -+- tst SIZE, #3 -+- beq 13f -+-12: ldrb DAT0, [PTR], #1 -+- sub SIZE, SIZE, #1 -+- teq DAT0, #0 -+- beq 90f -+- tst SIZE, #3 -+- bne 12b -+- @ No candidate found -+-13: sub RESULT, PTR, BUF -+- b 99f -+- -+-60: @ Small buffer - simply check by looping over bytes -+- subs SIZE, SIZE, #1 -+- bcc 99f -+-61: ldrb DAT0, [PTR], #1 -+- subs SIZE, SIZE, #1 -+- teq DAT0, #0 -+- beq 90f -+- bcs 61b -+- @ No candidate found -+- sub RESULT, PTR, BUF -+- b 99f -+- -+-90: @ Found a candidate at the preceding byte -+- sub RESULT, PTR, BUF -+- sub RESULT, RESULT, #1 -+- b 99f -+- -+-91: @ Found a candidate somewhere in the preceding 4 bytes -+- sub RESULT, PTR, BUF -+- sub RESULT, RESULT, #4 -+- sub TMP0, DAT0, #0x20000 -+- bics TMP0, TMP0, DAT0 -+- itt pl -+- ldrbpl DAT0, [PTR, #-3] -+- addpl RESULT, RESULT, #2 -+- bpl 92f -+- teq RESULT, #0 -+- beq 98f @ don't look back a byte if found at first byte in buffer -+- ldrb DAT0, [PTR, #-5] -+-92: teq DAT0, #0 -+- it eq -+- subeq RESULT, RESULT, #1 -+- b 98f -+- -+-93: @ Found a candidate somewhere in the preceding 16 bytes -+- sub RESULT, PTR, BUF -+- sub RESULT, RESULT, #16 -+- teq TMP0, #0 -+- beq 95f @ not in first 4 bytes -+- sub TMP0, DAT0, #0x20000 -+- bics TMP0, TMP0, DAT0 -+- itt pl -+- ldrbpl DAT0, [PTR, #-15] -+- addpl RESULT, RESULT, #2 -+- bpl 94f -+- teq RESULT, #0 -+- beq 98f @ don't look back a byte if found at first byte in buffer -+- ldrb DAT0, [PTR, #-17] -+-94: teq DAT0, #0 -+- it eq -+- subeq RESULT, RESULT, #1 -+- b 98f -+-95: add RESULT, RESULT, #4 -+- teq TMP1, #0 -+- beq 96f @ not in next 4 bytes -+- sub TMP1, DAT1, #0x20000 -+- bics TMP1, TMP1, DAT1 -+- itee mi -+- ldrbmi DAT0, [PTR, #-13] -+- ldrbpl DAT0, [PTR, #-11] -+- addpl RESULT, RESULT, #2 -+- teq DAT0, #0 -+- it eq -+- subeq RESULT, RESULT, #1 -+- b 98f -+-96: add RESULT, RESULT, #4 -+- teq TMP2, #0 -+- beq 97f @ not in next 4 bytes -+- sub TMP2, DAT2, #0x20000 -+- bics TMP2, TMP2, DAT2 -+- itee mi -+- ldrbmi DAT0, [PTR, #-9] -+- ldrbpl DAT0, [PTR, #-7] -+- addpl RESULT, RESULT, #2 -+- teq DAT0, #0 -+- it eq -+- subeq RESULT, RESULT, #1 -+- b 98f -+-97: add RESULT, RESULT, #4 -+- sub TMP3, DAT3, #0x20000 -+- bics TMP3, TMP3, DAT3 -+- itee mi -+- ldrbmi DAT0, [PTR, #-5] -+- ldrbpl DAT0, [PTR, #-3] -+- addpl RESULT, RESULT, #2 -+- teq DAT0, #0 -+- it eq -+- subeq RESULT, RESULT, #1 -+- @ drop through to 98f -+-98: setend le -+-99: pop {v1-v6,pc} -+-endfunc -+- -+- .unreq RESULT -+- .unreq BUF -+- .unreq SIZE -+- .unreq PATTERN -+- .unreq PTR -+- .unreq DAT0 -+- .unreq DAT1 -+- .unreq DAT2 -+- .unreq DAT3 -+- .unreq TMP0 -+- .unreq TMP1 -+- .unreq TMP2 -+- .unreq TMP3 -+diff --git a/libavcodec/arm/h264dsp_init_arm.c b/libavcodec/arm/h264dsp_init_arm.c -+index a0418fd..eb6c514 100644 -+--- a/libavcodec/arm/h264dsp_init_arm.c -++++ b/libavcodec/arm/h264dsp_init_arm.c -+@@ -24,7 +24,7 @@ -+ #include "libavutil/arm/cpu.h" -+ #include "libavcodec/h264dsp.h" -+ -+-int ff_h264_find_start_code_candidate_armv6(const uint8_t *buf, int size); -++int ff_startcode_find_candidate_armv6(const uint8_t *buf, int size); -+ -+ void ff_h264_v_loop_filter_luma_neon(uint8_t *pix, int stride, int alpha, -+ int beta, int8_t *tc0); -+@@ -109,7 +109,7 @@ av_cold void ff_h264dsp_init_arm(H264DSPContext *c, const int bit_depth, -+ int cpu_flags = av_get_cpu_flags(); -+ -+ if (have_armv6(cpu_flags)) -+- c->h264_find_start_code_candidate = ff_h264_find_start_code_candidate_armv6; -++ c->h264_find_start_code_candidate = ff_startcode_find_candidate_armv6; -+ if (have_neon(cpu_flags)) -+ h264dsp_init_neon(c, bit_depth, chroma_format_idc); -+ } -+diff --git a/libavcodec/arm/startcode_armv6.S b/libavcodec/arm/startcode_armv6.S -+new file mode 100644 -+index 0000000..a46f009 -+--- /dev/null -++++ b/libavcodec/arm/startcode_armv6.S -+@@ -0,0 +1,253 @@ -++/* -++ * Copyright (c) 2013 RISC OS Open Ltd -++ * Author: Ben Avison -++ * -++ * This file is part of FFmpeg. -++ * -++ * FFmpeg is free software; you can redistribute it and/or -++ * modify it under the terms of the GNU Lesser General Public -++ * License as published by the Free Software Foundation; either -++ * version 2.1 of the License, or (at your option) any later version. -++ * -++ * FFmpeg 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 -++ * Lesser General Public License for more details. -++ * -++ * You should have received a copy of the GNU Lesser General Public -++ * License along with FFmpeg; if not, write to the Free Software -++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -++ */ -++ -++#include "libavutil/arm/asm.S" -++ -++RESULT .req a1 -++BUF .req a1 -++SIZE .req a2 -++PATTERN .req a3 -++PTR .req a4 -++DAT0 .req v1 -++DAT1 .req v2 -++DAT2 .req v3 -++DAT3 .req v4 -++TMP0 .req v5 -++TMP1 .req v6 -++TMP2 .req ip -++TMP3 .req lr -++ -++#define PRELOAD_DISTANCE 4 -++ -++.macro innerloop4 -++ ldr DAT0, [PTR], #4 -++ subs SIZE, SIZE, #4 @ C flag survives rest of macro -++ sub TMP0, DAT0, PATTERN, lsr #14 -++ bic TMP0, TMP0, DAT0 -++ ands TMP0, TMP0, PATTERN -++.endm -++ -++.macro innerloop16 decrement, do_preload -++ ldmia PTR!, {DAT0,DAT1,DAT2,DAT3} -++ .ifnc "\do_preload","" -++ pld [PTR, #PRELOAD_DISTANCE*32] -++ .endif -++ .ifnc "\decrement","" -++ subs SIZE, SIZE, #\decrement @ C flag survives rest of macro -++ .endif -++ sub TMP0, DAT0, PATTERN, lsr #14 -++ sub TMP1, DAT1, PATTERN, lsr #14 -++ bic TMP0, TMP0, DAT0 -++ bic TMP1, TMP1, DAT1 -++ sub TMP2, DAT2, PATTERN, lsr #14 -++ sub TMP3, DAT3, PATTERN, lsr #14 -++ ands TMP0, TMP0, PATTERN -++ bic TMP2, TMP2, DAT2 -++ it eq -++ andseq TMP1, TMP1, PATTERN -++ bic TMP3, TMP3, DAT3 -++ itt eq -++ andseq TMP2, TMP2, PATTERN -++ andseq TMP3, TMP3, PATTERN -++.endm -++ -++/* int ff_startcode_find_candidate_armv6(const uint8_t *buf, int size) */ -++function ff_startcode_find_candidate_armv6, export=1 -++ push {v1-v6,lr} -++ mov PTR, BUF -++ @ Ensure there are at least (PRELOAD_DISTANCE+2) complete cachelines to go -++ @ before using code that does preloads -++ cmp SIZE, #(PRELOAD_DISTANCE+3)*32 - 1 -++ blo 60f -++ -++ @ Get to word-alignment, 1 byte at a time -++ tst PTR, #3 -++ beq 2f -++1: ldrb DAT0, [PTR], #1 -++ sub SIZE, SIZE, #1 -++ teq DAT0, #0 -++ beq 90f -++ tst PTR, #3 -++ bne 1b -++2: @ Get to 4-word alignment, 1 word at a time -++ ldr PATTERN, =0x80008000 -++ setend be -++ tst PTR, #12 -++ beq 4f -++3: innerloop4 -++ bne 91f -++ tst PTR, #12 -++ bne 3b -++4: @ Get to cacheline (8-word) alignment -++ tst PTR, #16 -++ beq 5f -++ innerloop16 16 -++ bne 93f -++5: @ Check complete cachelines, with preloading -++ @ We need to stop when there are still (PRELOAD_DISTANCE+1) -++ @ complete cachelines to go -++ sub SIZE, SIZE, #(PRELOAD_DISTANCE+2)*32 -++6: innerloop16 , do_preload -++ bne 93f -++ innerloop16 32 -++ bne 93f -++ bcs 6b -++ @ Preload trailing part-cacheline, if any -++ tst SIZE, #31 -++ beq 7f -++ pld [PTR, #(PRELOAD_DISTANCE+1)*32] -++ @ Check remaining data without doing any more preloads. First -++ @ do in chunks of 4 words: -++7: adds SIZE, SIZE, #(PRELOAD_DISTANCE+2)*32 - 16 -++ bmi 9f -++8: innerloop16 16 -++ bne 93f -++ bcs 8b -++ @ Then in words: -++9: adds SIZE, SIZE, #16 - 4 -++ bmi 11f -++10: innerloop4 -++ bne 91f -++ bcs 10b -++11: setend le -++ @ Check second byte of final halfword -++ ldrb DAT0, [PTR, #-1] -++ teq DAT0, #0 -++ beq 90f -++ @ Check any remaining bytes -++ tst SIZE, #3 -++ beq 13f -++12: ldrb DAT0, [PTR], #1 -++ sub SIZE, SIZE, #1 -++ teq DAT0, #0 -++ beq 90f -++ tst SIZE, #3 -++ bne 12b -++ @ No candidate found -++13: sub RESULT, PTR, BUF -++ b 99f -++ -++60: @ Small buffer - simply check by looping over bytes -++ subs SIZE, SIZE, #1 -++ bcc 99f -++61: ldrb DAT0, [PTR], #1 -++ subs SIZE, SIZE, #1 -++ teq DAT0, #0 -++ beq 90f -++ bcs 61b -++ @ No candidate found -++ sub RESULT, PTR, BUF -++ b 99f -++ -++90: @ Found a candidate at the preceding byte -++ sub RESULT, PTR, BUF -++ sub RESULT, RESULT, #1 -++ b 99f -++ -++91: @ Found a candidate somewhere in the preceding 4 bytes -++ sub RESULT, PTR, BUF -++ sub RESULT, RESULT, #4 -++ sub TMP0, DAT0, #0x20000 -++ bics TMP0, TMP0, DAT0 -++ itt pl -++ ldrbpl DAT0, [PTR, #-3] -++ addpl RESULT, RESULT, #2 -++ bpl 92f -++ teq RESULT, #0 -++ beq 98f @ don't look back a byte if found at first byte in buffer -++ ldrb DAT0, [PTR, #-5] -++92: teq DAT0, #0 -++ it eq -++ subeq RESULT, RESULT, #1 -++ b 98f -++ -++93: @ Found a candidate somewhere in the preceding 16 bytes -++ sub RESULT, PTR, BUF -++ sub RESULT, RESULT, #16 -++ teq TMP0, #0 -++ beq 95f @ not in first 4 bytes -++ sub TMP0, DAT0, #0x20000 -++ bics TMP0, TMP0, DAT0 -++ itt pl -++ ldrbpl DAT0, [PTR, #-15] -++ addpl RESULT, RESULT, #2 -++ bpl 94f -++ teq RESULT, #0 -++ beq 98f @ don't look back a byte if found at first byte in buffer -++ ldrb DAT0, [PTR, #-17] -++94: teq DAT0, #0 -++ it eq -++ subeq RESULT, RESULT, #1 -++ b 98f -++95: add RESULT, RESULT, #4 -++ teq TMP1, #0 -++ beq 96f @ not in next 4 bytes -++ sub TMP1, DAT1, #0x20000 -++ bics TMP1, TMP1, DAT1 -++ itee mi -++ ldrbmi DAT0, [PTR, #-13] -++ ldrbpl DAT0, [PTR, #-11] -++ addpl RESULT, RESULT, #2 -++ teq DAT0, #0 -++ it eq -++ subeq RESULT, RESULT, #1 -++ b 98f -++96: add RESULT, RESULT, #4 -++ teq TMP2, #0 -++ beq 97f @ not in next 4 bytes -++ sub TMP2, DAT2, #0x20000 -++ bics TMP2, TMP2, DAT2 -++ itee mi -++ ldrbmi DAT0, [PTR, #-9] -++ ldrbpl DAT0, [PTR, #-7] -++ addpl RESULT, RESULT, #2 -++ teq DAT0, #0 -++ it eq -++ subeq RESULT, RESULT, #1 -++ b 98f -++97: add RESULT, RESULT, #4 -++ sub TMP3, DAT3, #0x20000 -++ bics TMP3, TMP3, DAT3 -++ itee mi -++ ldrbmi DAT0, [PTR, #-5] -++ ldrbpl DAT0, [PTR, #-3] -++ addpl RESULT, RESULT, #2 -++ teq DAT0, #0 -++ it eq -++ subeq RESULT, RESULT, #1 -++ @ drop through to 98f -++98: setend le -++99: pop {v1-v6,pc} -++endfunc -++ -++ .unreq RESULT -++ .unreq BUF -++ .unreq SIZE -++ .unreq PATTERN -++ .unreq PTR -++ .unreq DAT0 -++ .unreq DAT1 -++ .unreq DAT2 -++ .unreq DAT3 -++ .unreq TMP0 -++ .unreq TMP1 -++ .unreq TMP2 -++ .unreq TMP3 -+diff --git a/libavcodec/h264dsp.c b/libavcodec/h264dsp.c -+index a2a4aba..a4da776 100644 -+--- a/libavcodec/h264dsp.c -++++ b/libavcodec/h264dsp.c -+@@ -33,6 +33,7 @@ -+ #include "avcodec.h" -+ #include "h264dsp.h" -+ #include "h264idct.h" -++#include "startcode.h" -+ #include "libavutil/common.h" -+ -+ #define BIT_DEPTH 8 -+@@ -63,34 +64,6 @@ -+ #include "h264addpx_template.c" -+ #undef BIT_DEPTH -+ -+-static int h264_find_start_code_candidate_c(const uint8_t *buf, int size) -+-{ -+- int i = 0; -+-#if HAVE_FAST_UNALIGNED -+- /* we check i < size instead of i + 3 / 7 because it is -+- * simpler and there must be FF_INPUT_BUFFER_PADDING_SIZE -+- * bytes at the end. -+- */ -+-# if HAVE_FAST_64BIT -+- while (i < size && -+- !((~*(const uint64_t *)(buf + i) & -+- (*(const uint64_t *)(buf + i) - 0x0101010101010101ULL)) & -+- 0x8080808080808080ULL)) -+- i += 8; -+-# else -+- while (i < size && -+- !((~*(const uint32_t *)(buf + i) & -+- (*(const uint32_t *)(buf + i) - 0x01010101U)) & -+- 0x80808080U)) -+- i += 4; -+-# endif -+-#endif -+- for (; i < size; i++) -+- if (!buf[i]) -+- break; -+- return i; -+-} -+- -+ av_cold void ff_h264dsp_init(H264DSPContext *c, const int bit_depth, -+ const int chroma_format_idc) -+ { -+@@ -178,7 +151,7 @@ av_cold void ff_h264dsp_init(H264DSPContext *c, const int bit_depth, -+ H264_DSP(8); -+ break; -+ } -+- c->h264_find_start_code_candidate = h264_find_start_code_candidate_c; -++ c->h264_find_start_code_candidate = ff_startcode_find_candidate_c; -+ -+ if (ARCH_AARCH64) ff_h264dsp_init_aarch64(c, bit_depth, chroma_format_idc); -+ if (ARCH_ARM) ff_h264dsp_init_arm(c, bit_depth, chroma_format_idc); -+diff --git a/libavcodec/startcode.c b/libavcodec/startcode.c -+new file mode 100644 -+index 0000000..5df7695 -+--- /dev/null -++++ b/libavcodec/startcode.c -+@@ -0,0 +1,57 @@ -++/* -++ * Copyright (c) 2003-2010 Michael Niedermayer -++ * -++ * This file is part of FFmpeg. -++ * -++ * FFmpeg is free software; you can redistribute it and/or -++ * modify it under the terms of the GNU Lesser General Public -++ * License as published by the Free Software Foundation; either -++ * version 2.1 of the License, or (at your option) any later version. -++ * -++ * FFmpeg 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 -++ * Lesser General Public License for more details. -++ * -++ * You should have received a copy of the GNU Lesser General Public -++ * License along with FFmpeg; if not, write to the Free Software -++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -++ */ -++ -++/** -++ * @file -++ * Accelerated start code search function for start codes common to -++ * MPEG-1/2/4 video, VC-1, H.264/5 -++ * @author Michael Niedermayer -++ */ -++ -++#include "startcode.h" -++#include "config.h" -++ -++int ff_startcode_find_candidate_c(const uint8_t *buf, int size) -++{ -++ int i = 0; -++#if HAVE_FAST_UNALIGNED -++ /* we check i < size instead of i + 3 / 7 because it is -++ * simpler and there must be FF_INPUT_BUFFER_PADDING_SIZE -++ * bytes at the end. -++ */ -++# if HAVE_FAST_64BIT -++ while (i < size && -++ !((~*(const uint64_t *)(buf + i) & -++ (*(const uint64_t *)(buf + i) - 0x0101010101010101ULL)) & -++ 0x8080808080808080ULL)) -++ i += 8; -++# else -++ while (i < size && -++ !((~*(const uint32_t *)(buf + i) & -++ (*(const uint32_t *)(buf + i) - 0x01010101U)) & -++ 0x80808080U)) -++ i += 4; -++# endif -++#endif -++ for (; i < size; i++) -++ if (!buf[i]) -++ break; -++ return i; -++} -+diff --git a/libavcodec/startcode.h b/libavcodec/startcode.h -+new file mode 100644 -+index 0000000..cc55d5f -+--- /dev/null -++++ b/libavcodec/startcode.h -+@@ -0,0 +1,35 @@ -++/* -++ * Copyright (c) 2003-2010 Michael Niedermayer -++ * -++ * This file is part of FFmpeg. -++ * -++ * FFmpeg is free software; you can redistribute it and/or -++ * modify it under the terms of the GNU Lesser General Public -++ * License as published by the Free Software Foundation; either -++ * version 2.1 of the License, or (at your option) any later version. -++ * -++ * FFmpeg 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 -++ * Lesser General Public License for more details. -++ * -++ * You should have received a copy of the GNU Lesser General Public -++ * License along with FFmpeg; if not, write to the Free Software -++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -++ */ -++ -++/** -++ * @file -++ * Accelerated start code search function for start codes common to -++ * MPEG-1/2/4 video, VC-1, H.264/5 -++ * @author Michael Niedermayer -++ */ -++ -++#ifndef AVCODEC_STARTCODE_H -++#define AVCODEC_STARTCODE_H -++ -++#include -++ -++int ff_startcode_find_candidate_c(const uint8_t *buf, int size); -++ -++#endif /* AVCODEC_STARTCODE_H */ -+-- -+1.9.1 -diff --git a/tools/depends/target/ffmpeg/0002-vc-1-Add-platform-specific-start-code-search-routine.patch b/tools/depends/target/ffmpeg/0002-vc-1-Add-platform-specific-start-code-search-routine.patch -new file mode 100644 -index 0000000..e84ace6 ---- /dev/null -+++ b/tools/depends/target/ffmpeg/0002-vc-1-Add-platform-specific-start-code-search-routine.patch -@@ -0,0 +1,143 @@ -+From a60747132a1a6652ac0d18f3f110a20ea637ac30 Mon Sep 17 00:00:00 2001 -+From: Ben Avison -+Date: Wed, 16 Apr 2014 01:51:32 +0100 -+Subject: [PATCH 2/3] vc-1: Add platform-specific start code search routine to -+ VC1DSPContext. -+ -+Initialise VC1DSPContext for parser as well as for decoder. -+Note, the VC-1 code doesn't actually use the function pointer yet. -+ -+Signed-off-by: Michael Niedermayer -+--- -+ libavcodec/Makefile | 6 +++--- -+ libavcodec/arm/Makefile | 2 ++ -+ libavcodec/arm/vc1dsp_init_arm.c | 4 ++++ -+ libavcodec/vc1.c | 2 ++ -+ libavcodec/vc1dec.c | 1 - -+ libavcodec/vc1dsp.c | 3 +++ -+ libavcodec/vc1dsp.h | 8 ++++++++ -+ 7 files changed, 22 insertions(+), 4 deletions(-) -+ -+diff --git a/libavcodec/Makefile b/libavcodec/Makefile -+index 19caf11..120f85a 100644 -+--- a/libavcodec/Makefile -++++ b/libavcodec/Makefile -+@@ -458,7 +458,7 @@ OBJS-$(CONFIG_VB_DECODER) += vb.o -+ OBJS-$(CONFIG_VBLE_DECODER) += vble.o -+ OBJS-$(CONFIG_VC1_DECODER) += vc1dec.o vc1.o vc1data.o vc1dsp.o \ -+ msmpeg4dec.o msmpeg4.o msmpeg4data.o \ -+- wmv2dsp.o -++ wmv2dsp.o startcode.o -+ OBJS-$(CONFIG_VCR1_DECODER) += vcr1.o -+ OBJS-$(CONFIG_VMDAUDIO_DECODER) += vmdav.o -+ OBJS-$(CONFIG_VMDVIDEO_DECODER) += vmdav.o -+@@ -783,9 +783,9 @@ OBJS-$(CONFIG_PNM_PARSER) += pnm_parser.o pnm.o -+ OBJS-$(CONFIG_RV30_PARSER) += rv34_parser.o -+ OBJS-$(CONFIG_RV40_PARSER) += rv34_parser.o -+ OBJS-$(CONFIG_TAK_PARSER) += tak_parser.o tak.o -+-OBJS-$(CONFIG_VC1_PARSER) += vc1_parser.o vc1.o vc1data.o \ -++OBJS-$(CONFIG_VC1_PARSER) += vc1_parser.o vc1.o vc1data.o vc1dsp.o \ -+ msmpeg4.o msmpeg4data.o mpeg4video.o \ -+- h263.o -++ h263.o startcode.o -+ OBJS-$(CONFIG_VORBIS_PARSER) += vorbis_parser.o xiph.o -+ OBJS-$(CONFIG_VP3_PARSER) += vp3_parser.o -+ OBJS-$(CONFIG_VP8_PARSER) += vp8_parser.o -+diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile -+index b6410b2..fa2b18e 100644 -+--- a/libavcodec/arm/Makefile -++++ b/libavcodec/arm/Makefile -+@@ -51,6 +51,8 @@ ARMV6-OBJS-$(CONFIG_H264DSP) += arm/startcode_armv6.o -+ ARMV6-OBJS-$(CONFIG_HPELDSP) += arm/hpeldsp_init_armv6.o \ -+ arm/hpeldsp_armv6.o -+ ARMV6-OBJS-$(CONFIG_MPEGAUDIODSP) += arm/mpegaudiodsp_fixed_armv6.o -++ARMV6-OBJS-$(CONFIG_VC1_DECODER) += arm/startcode_armv6.o -++ARMV6-OBJS-$(CONFIG_VC1_PARSER) += arm/startcode_armv6.o -+ ARMV6-OBJS-$(CONFIG_VP8_DECODER) += arm/vp8_armv6.o \ -+ arm/vp8dsp_init_armv6.o \ -+ arm/vp8dsp_armv6.o -+diff --git a/libavcodec/arm/vc1dsp_init_arm.c b/libavcodec/arm/vc1dsp_init_arm.c -+index 47d4126..4a84848 100644 -+--- a/libavcodec/arm/vc1dsp_init_arm.c -++++ b/libavcodec/arm/vc1dsp_init_arm.c -+@@ -23,10 +23,14 @@ -+ #include "libavcodec/vc1dsp.h" -+ #include "vc1dsp.h" -+ -++int ff_startcode_find_candidate_armv6(const uint8_t *buf, int size); -++ -+ av_cold void ff_vc1dsp_init_arm(VC1DSPContext *dsp) -+ { -+ int cpu_flags = av_get_cpu_flags(); -+ -++ if (have_armv6(cpu_flags)) -++ dsp->vc1_find_start_code_candidate = ff_startcode_find_candidate_armv6; -+ if (have_neon(cpu_flags)) -+ ff_vc1dsp_init_neon(dsp); -+ } -+diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c -+index 49d4885..cb941dd 100644 -+--- a/libavcodec/vc1.c -++++ b/libavcodec/vc1.c -+@@ -1706,5 +1706,7 @@ av_cold int ff_vc1_init_common(VC1Context *v) -+ v->pq = -1; -+ v->mvrange = 0; /* 7.1.1.18, p80 */ -+ -++ ff_vc1dsp_init(&v->vc1dsp); -++ -+ return 0; -+ } -+diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c -+index 30fee47..67cda42 100644 -+--- a/libavcodec/vc1dec.c -++++ b/libavcodec/vc1dec.c -+@@ -5631,7 +5631,6 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) -+ ff_vc1_decode_end(avctx); -+ -+ ff_h264chroma_init(&v->h264chroma, 8); -+- ff_vc1dsp_init(&v->vc1dsp); -+ -+ if (avctx->codec_id == AV_CODEC_ID_WMV3 || avctx->codec_id == AV_CODEC_ID_WMV3IMAGE) { -+ int count = 0; -+diff --git a/libavcodec/vc1dsp.c b/libavcodec/vc1dsp.c -+index ec9c17b..09a9006 100644 -+--- a/libavcodec/vc1dsp.c -++++ b/libavcodec/vc1dsp.c -+@@ -30,6 +30,7 @@ -+ #include "h264chroma.h" -+ #include "rnd_avg.h" -+ #include "vc1dsp.h" -++#include "startcode.h" -+ -+ /* Apply overlap transform to horizontal edge */ -+ static void vc1_v_overlap_c(uint8_t *src, int stride) -+@@ -947,6 +948,8 @@ av_cold void ff_vc1dsp_init(VC1DSPContext *dsp) -+ dsp->sprite_v_double_twoscale = sprite_v_double_twoscale_c; -+ #endif /* CONFIG_WMV3IMAGE_DECODER || CONFIG_VC1IMAGE_DECODER */ -+ -++ dsp->vc1_find_start_code_candidate = ff_startcode_find_candidate_c; -++ -+ if (ARCH_AARCH64) -+ ff_vc1dsp_init_aarch64(dsp); -+ if (ARCH_ARM) -+diff --git a/libavcodec/vc1dsp.h b/libavcodec/vc1dsp.h -+index 990fbc3..6a90eed 100644 -+--- a/libavcodec/vc1dsp.h -++++ b/libavcodec/vc1dsp.h -+@@ -74,6 +74,14 @@ typedef struct VC1DSPContext { -+ void (*sprite_v_double_twoscale)(uint8_t *dst, const uint8_t *src1a, const uint8_t *src1b, int offset1, -+ const uint8_t *src2a, const uint8_t *src2b, int offset2, -+ int alpha, int width); -++ -++ /** -++ * Search buf from the start for up to size bytes. Return the index -++ * of a zero byte, or >= size if not found. Ideally, use lookahead -++ * to filter out any zero bytes that are known to not be followed by -++ * one or more further zero bytes and a one byte. -++ */ -++ int (*vc1_find_start_code_candidate)(const uint8_t *buf, int size); -+ } VC1DSPContext; -+ -+ void ff_vc1dsp_init(VC1DSPContext* c); -+-- -+1.9.1 -diff --git a/tools/depends/target/ffmpeg/0003-vc-1-Optimise-parser-with-special-attention-to-ARM.patch b/tools/depends/target/ffmpeg/0003-vc-1-Optimise-parser-with-special-attention-to-ARM.patch -new file mode 100644 -index 0000000..1f0cf40 ---- /dev/null -+++ b/tools/depends/target/ffmpeg/0003-vc-1-Optimise-parser-with-special-attention-to-ARM.patch -@@ -0,0 +1,401 @@ -+From c39df43eae03768427243668c040de8437c4f79c Mon Sep 17 00:00:00 2001 -+From: Ben Avison -+Date: Wed, 23 Apr 2014 01:41:04 +0100 -+Subject: [PATCH 3/3] vc-1: Optimise parser (with special attention to ARM) -+ -+The previous implementation of the parser made four passes over each input -+buffer (reduced to two if the container format already guaranteed the input -+buffer corresponded to frames, such as with MKV). But these buffers are -+often 200K in size, certainly enough to flush the data out of L1 cache, and -+for many CPUs, all the way out to main memory. The passes were: -+ -+1) locate frame boundaries (not needed for MKV etc) -+2) copy the data into a contiguous block (not needed for MKV etc) -+3) locate the start codes within each frame -+4) unescape the data between start codes -+ -+After this, the unescaped data was parsed to extract certain header fields, -+but because the unescape operation was so large, this was usually also -+effectively operating on uncached memory. Most of the unescaped data was -+simply thrown away and never processed further. Only step 2 - because it -+used memcpy - was using prefetch, making things even worse. -+ -+This patch reorganises these steps so that, aside from the copying, the -+operations are performed in parallel, maximising cache utilisation. No more -+than the worst-case number of bytes needed for header parsing is unescaped. -+Most of the data is, in practice, only read in order to search for a start -+code, for which optimised implementations already existed in the H264 codec -+(notably the ARM version uses prefetch, so we end up doing both remaining -+passes at maximum speed). For MKV files, we know when we've found the last -+start code of interest in a given frame, so we are able to avoid doing even -+that one remaining pass for most of the buffer. -+ -+In some use-cases (such as the Raspberry Pi) video decode is handled by the -+GPU, but the entire elementary stream is still fed through the parser to -+pick out certain elements of the header which are necessary to manage the -+decode process. As you might expect, in these cases, the performance of the -+parser is significant. -+ -+To measure parser performance, I used the same VC-1 elementary stream in -+either an MPEG-2 transport stream or a MKV file, and fed it through ffmpeg -+with -c:v copy -c:a copy -f null. These are the gperftools counts for -+those streams, both filtered to only include vc1_parse() and its callees, -+and unfiltered (to include the whole binary). Lower numbers are better: -+ -+ Before After -+File Filtered Mean StdDev Mean StdDev Confidence Change -+M2TS No 861.7 8.2 650.5 8.1 100.0% +32.5% -+MKV No 868.9 7.4 731.7 9.0 100.0% +18.8% -+M2TS Yes 250.0 11.2 27.2 3.4 100.0% +817.9% -+MKV Yes 149.0 12.8 1.7 0.8 100.0% +8526.3% -+ -+Yes, that last case shows vc1_parse() running 86 times faster! The M2TS -+case does show a larger absolute improvement though, since it was worse -+to begin with. -+ -+This patch has been tested with the FATE suite (albeit on x86 for speed). -+ -+Signed-off-by: Michael Niedermayer -+--- -+ libavcodec/vc1_parser.c | 284 ++++++++++++++++++++++++++++++------------------ -+ 1 file changed, 180 insertions(+), 104 deletions(-) -+ -+diff --git a/libavcodec/vc1_parser.c b/libavcodec/vc1_parser.c -+index cc29ce1..4ed14bc 100644 -+--- a/libavcodec/vc1_parser.c -++++ b/libavcodec/vc1_parser.c -+@@ -30,122 +30,88 @@ -+ #include "vc1.h" -+ #include "get_bits.h" -+ -++/** The maximum number of bytes of a sequence, entry point or -++ * frame header whose values we pay any attention to */ -++#define UNESCAPED_THRESHOLD 37 -++ -++/** The maximum number of bytes of a sequence, entry point or -++ * frame header which must be valid memory (because they are -++ * used to update the bitstream cache in skip_bits() calls) -++ */ -++#define UNESCAPED_LIMIT 144 -++ -++typedef enum { -++ NO_MATCH, -++ ONE_ZERO, -++ TWO_ZEROS, -++ ONE -++} VC1ParseSearchState; -++ -+ typedef struct { -+ ParseContext pc; -+ VC1Context v; -++ uint8_t prev_start_code; -++ size_t bytes_to_skip; -++ uint8_t unesc_buffer[UNESCAPED_LIMIT]; -++ size_t unesc_index; -++ VC1ParseSearchState search_state; -+ } VC1ParseContext; -+ -+-static void vc1_extract_headers(AVCodecParserContext *s, AVCodecContext *avctx, -+- const uint8_t *buf, int buf_size) -++static void vc1_extract_header(AVCodecParserContext *s, AVCodecContext *avctx, -++ const uint8_t *buf, int buf_size) -+ { -++ /* Parse the header we just finished unescaping */ -+ VC1ParseContext *vpc = s->priv_data; -+ GetBitContext gb; -+- const uint8_t *start, *end, *next; -+- uint8_t *buf2 = av_mallocz(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); -+- -++ int ret; -+ vpc->v.s.avctx = avctx; -+ vpc->v.parse_only = 1; -+- vpc->v.first_pic_header_flag = 1; -+- next = buf; -+- s->repeat_pict = 0; -+- -+- for(start = buf, end = buf + buf_size; next < end; start = next){ -+- int buf2_size, size; -+- int ret; -+- -+- next = find_next_marker(start + 4, end); -+- size = next - start - 4; -+- buf2_size = vc1_unescape_buffer(start + 4, size, buf2); -+- init_get_bits(&gb, buf2, buf2_size * 8); -+- if(size <= 0) continue; -+- switch(AV_RB32(start)){ -+- case VC1_CODE_SEQHDR: -+- ff_vc1_decode_sequence_header(avctx, &vpc->v, &gb); -+- break; -+- case VC1_CODE_ENTRYPOINT: -+- ff_vc1_decode_entry_point(avctx, &vpc->v, &gb); -+- break; -+- case VC1_CODE_FRAME: -+- if(vpc->v.profile < PROFILE_ADVANCED) -+- ret = ff_vc1_parse_frame_header (&vpc->v, &gb); -+- else -+- ret = ff_vc1_parse_frame_header_adv(&vpc->v, &gb); -+- -+- if (ret < 0) -+- break; -+- -+- /* keep AV_PICTURE_TYPE_BI internal to VC1 */ -+- if (vpc->v.s.pict_type == AV_PICTURE_TYPE_BI) -+- s->pict_type = AV_PICTURE_TYPE_B; -+- else -+- s->pict_type = vpc->v.s.pict_type; -+- -+- if (avctx->ticks_per_frame > 1){ -+- // process pulldown flags -+- s->repeat_pict = 1; -+- // Pulldown flags are only valid when 'broadcast' has been set. -+- // So ticks_per_frame will be 2 -+- if (vpc->v.rff){ -+- // repeat field -+- s->repeat_pict = 2; -+- }else if (vpc->v.rptfrm){ -+- // repeat frames -+- s->repeat_pict = vpc->v.rptfrm * 2 + 1; -+- } -+- } -+- -+- if (vpc->v.broadcast && vpc->v.interlace && !vpc->v.psf) -+- s->field_order = vpc->v.tff ? AV_FIELD_TT : AV_FIELD_BB; -+- else -+- s->field_order = AV_FIELD_PROGRESSIVE; -++ init_get_bits(&gb, buf, buf_size * 8); -++ switch (vpc->prev_start_code) { -++ case VC1_CODE_SEQHDR & 0xFF: -++ ff_vc1_decode_sequence_header(avctx, &vpc->v, &gb); -++ break; -++ case VC1_CODE_ENTRYPOINT & 0xFF: -++ ff_vc1_decode_entry_point(avctx, &vpc->v, &gb); -++ break; -++ case VC1_CODE_FRAME & 0xFF: -++ if(vpc->v.profile < PROFILE_ADVANCED) -++ ret = ff_vc1_parse_frame_header (&vpc->v, &gb); -++ else -++ ret = ff_vc1_parse_frame_header_adv(&vpc->v, &gb); -+ -++ if (ret < 0) -+ break; -+- } -+- } -+ -+- av_free(buf2); -+-} -++ /* keep AV_PICTURE_TYPE_BI internal to VC1 */ -++ if (vpc->v.s.pict_type == AV_PICTURE_TYPE_BI) -++ s->pict_type = AV_PICTURE_TYPE_B; -++ else -++ s->pict_type = vpc->v.s.pict_type; -+ -+-/** -+- * Find the end of the current frame in the bitstream. -+- * @return the position of the first byte of the next frame, or -1 -+- */ -+-static int vc1_find_frame_end(ParseContext *pc, const uint8_t *buf, -+- int buf_size) { -+- int pic_found, i; -+- uint32_t state; -+- -+- pic_found= pc->frame_start_found; -+- state= pc->state; -+- -+- i=0; -+- if(!pic_found){ -+- for(i=0; iticks_per_frame > 1){ -++ // process pulldown flags -++ s->repeat_pict = 1; -++ // Pulldown flags are only valid when 'broadcast' has been set. -++ // So ticks_per_frame will be 2 -++ if (vpc->v.rff){ -++ // repeat field -++ s->repeat_pict = 2; -++ }else if (vpc->v.rptfrm){ -++ // repeat frames -++ s->repeat_pict = vpc->v.rptfrm * 2 + 1; -+ } -++ }else{ -++ s->repeat_pict = 0; -+ } -+- } -+ -+- if(pic_found){ -+- /* EOF considered as end of frame */ -+- if (buf_size == 0) -+- return 0; -+- for(; iframe_start_found=0; -+- pc->state=-1; -+- return i-3; -+- } -+- } -++ if (vpc->v.broadcast && vpc->v.interlace && !vpc->v.psf) -++ s->field_order = vpc->v.tff ? AV_FIELD_TT : AV_FIELD_BB; -++ else -++ s->field_order = AV_FIELD_PROGRESSIVE; -++ -++ break; -+ } -+- pc->frame_start_found= pic_found; -+- pc->state= state; -+- return END_NOT_FOUND; -+ } -+ -+ static int vc1_parse(AVCodecParserContext *s, -+@@ -153,22 +119,127 @@ static int vc1_parse(AVCodecParserContext *s, -+ const uint8_t **poutbuf, int *poutbuf_size, -+ const uint8_t *buf, int buf_size) -+ { -++ /* Here we do the searching for frame boundaries and headers at -++ * the same time. Only a minimal amount at the start of each -++ * header is unescaped. */ -+ VC1ParseContext *vpc = s->priv_data; -+- int next; -++ int pic_found = vpc->pc.frame_start_found; -++ uint8_t *unesc_buffer = vpc->unesc_buffer; -++ size_t unesc_index = vpc->unesc_index; -++ VC1ParseSearchState search_state = vpc->search_state; -++ int next = END_NOT_FOUND; -++ int i = vpc->bytes_to_skip; -++ -++ if (pic_found && buf_size == 0) { -++ /* EOF considered as end of frame */ -++ memset(unesc_buffer + unesc_index, 0, UNESCAPED_THRESHOLD - unesc_index); -++ vc1_extract_header(s, avctx, unesc_buffer, unesc_index); -++ next = 0; -++ } -++ while (i < buf_size) { -++ int start_code_found = 0; -++ uint8_t b; -++ while (i < buf_size && unesc_index < UNESCAPED_THRESHOLD) { -++ b = buf[i++]; -++ unesc_buffer[unesc_index++] = b; -++ if (search_state <= ONE_ZERO) -++ search_state = b ? NO_MATCH : search_state + 1; -++ else if (search_state == TWO_ZEROS) { -++ if (b == 1) -++ search_state = ONE; -++ else if (b > 1) { -++ if (b == 3) -++ unesc_index--; // swallow emulation prevention byte -++ search_state = NO_MATCH; -++ } -++ } -++ else { // search_state == ONE -++ // Header unescaping terminates early due to detection of next start code -++ search_state = NO_MATCH; -++ start_code_found = 1; -++ break; -++ } -++ } -++ if ((s->flags & PARSER_FLAG_COMPLETE_FRAMES) && -++ unesc_index >= UNESCAPED_THRESHOLD && -++ vpc->prev_start_code == (VC1_CODE_FRAME & 0xFF)) -++ { -++ // No need to keep scanning the rest of the buffer for -++ // start codes if we know it contains a complete frame and -++ // we've already unescaped all we need of the frame header -++ vc1_extract_header(s, avctx, unesc_buffer, unesc_index); -++ break; -++ } -++ if (unesc_index >= UNESCAPED_THRESHOLD && !start_code_found) { -++ while (i < buf_size) { -++ if (search_state == NO_MATCH) { -++ i += vpc->v.vc1dsp.vc1_find_start_code_candidate(buf + i, buf_size - i); -++ if (i < buf_size) { -++ search_state = ONE_ZERO; -++ } -++ i++; -++ } else { -++ b = buf[i++]; -++ if (search_state == ONE_ZERO) -++ search_state = b ? NO_MATCH : TWO_ZEROS; -++ else if (search_state == TWO_ZEROS) { -++ if (b >= 1) -++ search_state = b == 1 ? ONE : NO_MATCH; -++ } -++ else { // search_state == ONE -++ search_state = NO_MATCH; -++ start_code_found = 1; -++ break; -++ } -++ } -++ } -++ } -++ if (start_code_found) { -++ vc1_extract_header(s, avctx, unesc_buffer, unesc_index); -++ -++ vpc->prev_start_code = b; -++ unesc_index = 0; -++ -++ if (!(s->flags & PARSER_FLAG_COMPLETE_FRAMES)) { -++ if (!pic_found && (b == (VC1_CODE_FRAME & 0xFF) || b == (VC1_CODE_FIELD & 0xFF))) { -++ pic_found = 1; -++ } -++ else if (pic_found && b != (VC1_CODE_FIELD & 0xFF) && b != (VC1_CODE_SLICE & 0xFF)) { -++ next = i - 4; -++ pic_found = b == (VC1_CODE_FRAME & 0xFF); -++ break; -++ } -++ } -++ } -++ } -+ -+- if(s->flags & PARSER_FLAG_COMPLETE_FRAMES){ -+- next= buf_size; -+- }else{ -+- next= vc1_find_frame_end(&vpc->pc, buf, buf_size); -++ vpc->pc.frame_start_found = pic_found; -++ vpc->unesc_index = unesc_index; -++ vpc->search_state = search_state; -+ -++ if (s->flags & PARSER_FLAG_COMPLETE_FRAMES) { -++ next = buf_size; -++ } else { -+ if (ff_combine_frame(&vpc->pc, next, &buf, &buf_size) < 0) { -++ vpc->bytes_to_skip = 0; -+ *poutbuf = NULL; -+ *poutbuf_size = 0; -+ return buf_size; -+ } -+ } -+ -+- vc1_extract_headers(s, avctx, buf, buf_size); -++ vpc->v.first_pic_header_flag = 1; -++ -++ /* If we return with a valid pointer to a combined frame buffer -++ * then on the next call then we'll have been unhelpfully rewound -++ * by up to 4 bytes (depending upon whether the start code -++ * overlapped the input buffer, and if so by how much). We don't -++ * want this: it will either cause spurious second detections of -++ * the start code we've already seen, or cause extra bytes to be -++ * inserted at the start of the unescaped buffer. */ -++ vpc->bytes_to_skip = 4; -++ if (next < 0) -++ vpc->bytes_to_skip += next; -+ -+ *poutbuf = buf; -+ *poutbuf_size = buf_size; -+@@ -199,6 +270,11 @@ static av_cold int vc1_parse_init(AVCodecParserContext *s) -+ { -+ VC1ParseContext *vpc = s->priv_data; -+ vpc->v.s.slice_context_count = 1; -++ vpc->v.first_pic_header_flag = 1; -++ vpc->prev_start_code = 0; -++ vpc->bytes_to_skip = 0; -++ vpc->unesc_index = 0; -++ vpc->search_state = NO_MATCH; -+ return ff_vc1_init_common(&vpc->v); -+ } -+ -+-- -+1.9.1 -diff --git a/tools/depends/target/ffmpeg/Makefile b/tools/depends/target/ffmpeg/Makefile -index f514ae6..863ee41 100644 ---- a/tools/depends/target/ffmpeg/Makefile -+++ b/tools/depends/target/ffmpeg/Makefile -@@ -1,6 +1,9 @@ - include ../../Makefile.include - include FFMPEG-VERSION --DEPS= ../../Makefile.include FFMPEG-VERSION Makefile ffmpeg_Speed_up_wtv_index_creation.patch -+DEPS= ../../Makefile.include FFMPEG-VERSION Makefile \ -+ ffmpeg_Speed_up_wtv_index_creation.patch 0001-h264-Move-search-code-search-functions-into-separate.patch \ -+ 0002-vc-1-Add-platform-specific-start-code-search-routine.patch 0003-vc-1-Optimise-parser-with-special-attention-to-ARM.patch -+ - - # set to "yes" to enable patching - # we don't apply patches until we move to a vanilla ffmpeg tarball -@@ -64,6 +67,9 @@ $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) - cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE) - cd $(PLATFORM); sed -i".bak" -e "s%pkg_config_default=pkg-config%export PKG_CONFIG_LIBDIR=$(PREFIX)/lib/pkgconfig\npkg_config_default=$(NATIVEPREFIX)/bin/pkg-config%" configure - cd $(PLATFORM); patch -p3 < ../ffmpeg_Speed_up_wtv_index_creation.patch -+ cd $(PLATFORM); patch -p1 < ../0001-h264-Move-search-code-search-functions-into-separate.patch -+ cd $(PLATFORM); patch -p1 < ../0002-vc-1-Add-platform-specific-start-code-search-routine.patch -+ cd $(PLATFORM); patch -p1 < ../0003-vc-1-Optimise-parser-with-special-attention-to-ARM.patch - cd $(PLATFORM);\ - CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \ - ./configure $(ffmpg_config) --- -1.9.3 - - -From 7ed755d1a64b291f94f367e457755bd9f0640b2d Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Tue, 29 Apr 2014 16:53:32 +0100 -Subject: [PATCH 062/102] [ffmpeg] truehd: Optimise with special attention to - ARM - -Backport from upstream ffmpeg ---- - .../0001-truehd-tune-VLC-decoding-for-ARM.patch | 65 ++ - ...hand-scheduled-ARM-asm-version-of-mlp_fil.patch | 557 +++++++++++++++++ - ...k-out-part-of-rematrix_channels-into-plat.patch | 158 +++++ - ...hand-scheduled-ARM-asm-version-of-ff_mlp_.patch | 285 +++++++++ - ...k-out-part-of-output_data-into-platform-s.patch | 197 ++++++ - ...hand-scheduled-ARM-asm-version-of-ff_mlp_.patch | 689 +++++++++++++++++++++ - tools/depends/target/ffmpeg/Makefile | 13 +- - 7 files changed, 1962 insertions(+), 2 deletions(-) - create mode 100644 tools/depends/target/ffmpeg/0001-truehd-tune-VLC-decoding-for-ARM.patch - create mode 100644 tools/depends/target/ffmpeg/0002-truehd-add-hand-scheduled-ARM-asm-version-of-mlp_fil.patch - create mode 100644 tools/depends/target/ffmpeg/0003-truehd-break-out-part-of-rematrix_channels-into-plat.patch - create mode 100644 tools/depends/target/ffmpeg/0004-truehd-add-hand-scheduled-ARM-asm-version-of-ff_mlp_.patch - create mode 100644 tools/depends/target/ffmpeg/0005-truehd-break-out-part-of-output_data-into-platform-s.patch - create mode 100644 tools/depends/target/ffmpeg/0006-truehd-add-hand-scheduled-ARM-asm-version-of-ff_mlp_.patch - -diff --git a/tools/depends/target/ffmpeg/0001-truehd-tune-VLC-decoding-for-ARM.patch b/tools/depends/target/ffmpeg/0001-truehd-tune-VLC-decoding-for-ARM.patch -new file mode 100644 -index 0000000..2950843 ---- /dev/null -+++ b/tools/depends/target/ffmpeg/0001-truehd-tune-VLC-decoding-for-ARM.patch -@@ -0,0 +1,65 @@ -+From 425d69b993d25489e4830766507d9d8f6c819802 Mon Sep 17 00:00:00 2001 -+From: Ben Avison -+Date: Wed, 19 Mar 2014 17:26:19 +0000 -+Subject: [PATCH 1/6] truehd: tune VLC decoding for ARM. -+ -+Profiling on a Raspberry Pi revealed the best performance to correspond -+with VLC_BITS = 5. Results for overall audio decode and the get_vlc2 function -+in particular are as follows: -+ -+ Before After -+ Mean StdDev Mean StdDev Confidence Change -+6:2 total 348.8 20.1 339.6 15.1 88.8% +2.7% (insignificant) -+6:2 function 38.1 8.1 26.4 4.1 100.0% +44.5% -+8:2 total 339.1 15.4 324.5 15.5 99.4% +4.5% -+8:2 function 33.8 7.0 27.3 5.6 99.7% +23.6% -+6:6 total 604.6 20.8 572.8 20.6 100.0% +5.6% -+6:6 function 95.8 8.4 68.9 8.2 100.0% +39.1% -+8:8 total 766.4 17.6 741.5 21.2 100.0% +3.4% -+8:8 function 106.0 11.4 86.1 9.9 100.0% +23.1% -+ -+Signed-off-by: Michael Niedermayer -+--- -+ libavcodec/mlpdec.c | 13 ++++++++++--- -+ 1 file changed, 10 insertions(+), 3 deletions(-) -+ -+diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c -+index 93ed552..cbd9000 100644 -+--- a/libavcodec/mlpdec.c -++++ b/libavcodec/mlpdec.c -+@@ -37,9 +37,16 @@ -+ #include "mlp_parser.h" -+ #include "mlpdsp.h" -+ #include "mlp.h" -++#include "config.h" -+ -+ /** number of bits used for VLC lookup - longest Huffman code is 9 */ -++#if ARCH_ARM == 1 -++#define VLC_BITS 5 -++#define VLC_STATIC_SIZE 64 -++#else -+ #define VLC_BITS 9 -++#define VLC_STATIC_SIZE 512 -++#endif -+ -+ typedef struct SubStream { -+ /// Set if a valid restart header has been read. Otherwise the substream cannot be decoded. -+@@ -193,13 +200,13 @@ static av_cold void init_static(void) -+ if (!huff_vlc[0].bits) { -+ INIT_VLC_STATIC(&huff_vlc[0], VLC_BITS, 18, -+ &ff_mlp_huffman_tables[0][0][1], 2, 1, -+- &ff_mlp_huffman_tables[0][0][0], 2, 1, 512); -++ &ff_mlp_huffman_tables[0][0][0], 2, 1, VLC_STATIC_SIZE); -+ INIT_VLC_STATIC(&huff_vlc[1], VLC_BITS, 16, -+ &ff_mlp_huffman_tables[1][0][1], 2, 1, -+- &ff_mlp_huffman_tables[1][0][0], 2, 1, 512); -++ &ff_mlp_huffman_tables[1][0][0], 2, 1, VLC_STATIC_SIZE); -+ INIT_VLC_STATIC(&huff_vlc[2], VLC_BITS, 15, -+ &ff_mlp_huffman_tables[2][0][1], 2, 1, -+- &ff_mlp_huffman_tables[2][0][0], 2, 1, 512); -++ &ff_mlp_huffman_tables[2][0][0], 2, 1, VLC_STATIC_SIZE); -+ } -+ -+ ff_mlp_init_crc(); -+-- -+1.9.1 -diff --git a/tools/depends/target/ffmpeg/0002-truehd-add-hand-scheduled-ARM-asm-version-of-mlp_fil.patch b/tools/depends/target/ffmpeg/0002-truehd-add-hand-scheduled-ARM-asm-version-of-mlp_fil.patch -new file mode 100644 -index 0000000..4aea35f ---- /dev/null -+++ b/tools/depends/target/ffmpeg/0002-truehd-add-hand-scheduled-ARM-asm-version-of-mlp_fil.patch -@@ -0,0 +1,557 @@ -+From bfe3d8c8e4e046163dc314aa16207413e377283f Mon Sep 17 00:00:00 2001 -+From: Ben Avison -+Date: Mon, 3 Mar 2014 19:44:23 +0000 -+Subject: [PATCH 2/6] truehd: add hand-scheduled ARM asm version of -+ mlp_filter_channel. -+ -+Profiling results for overall audio decode and the mlp_filter_channel(_arm) -+function in particular are as follows: -+ -+ Before After -+ Mean StdDev Mean StdDev Confidence Change -+6:2 total 380.4 22.0 370.8 17.0 87.4% +2.6% (insignificant) -+6:2 function 60.7 7.2 36.6 8.1 100.0% +65.8% -+8:2 total 357.0 17.5 343.2 19.0 97.8% +4.0% (insignificant) -+8:2 function 60.3 8.8 37.3 3.8 100.0% +61.8% -+6:6 total 717.2 23.2 658.4 15.7 100.0% +8.9% -+6:6 function 140.4 12.9 81.5 9.2 100.0% +72.4% -+8:8 total 981.9 16.2 896.2 24.5 100.0% +9.6% -+8:8 function 193.4 15.0 103.3 11.5 100.0% +87.2% -+ -+Experiments with adding preload instructions to this function yielded no -+useful benefit, so these have not been included. -+ -+The assembly version has also been tested with a fuzz tester to ensure that -+any combinations of inputs not exercised by my available test streams still -+generate mathematically identical results to the C version. -+--- -+ libavcodec/arm/Makefile | 2 + -+ libavcodec/arm/mlpdsp_arm.S | 433 +++++++++++++++++++++++++++++++++++++++ -+ libavcodec/arm/mlpdsp_init_arm.c | 36 ++++ -+ libavcodec/mlpdsp.c | 2 + -+ libavcodec/mlpdsp.h | 1 + -+ 5 files changed, 474 insertions(+) -+ create mode 100644 libavcodec/arm/mlpdsp_arm.S -+ create mode 100644 libavcodec/arm/mlpdsp_init_arm.c -+ -+diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile -+index a8446b2..ba673b1 100644 -+--- a/libavcodec/arm/Makefile -++++ b/libavcodec/arm/Makefile -+@@ -22,6 +22,8 @@ OBJS-$(CONFIG_H264PRED) += arm/h264pred_init_arm.o -+ OBJS-$(CONFIG_H264QPEL) += arm/h264qpel_init_arm.o -+ OBJS-$(CONFIG_HPELDSP) += arm/hpeldsp_init_arm.o \ -+ arm/hpeldsp_arm.o -++OBJS-$(CONFIG_MLP_DECODER) += arm/mlpdsp_init_arm.o \ -++ arm/mlpdsp_arm.o -+ OBJS-$(CONFIG_MPEGAUDIODSP) += arm/mpegaudiodsp_init_arm.o -+ OBJS-$(CONFIG_MPEGVIDEO) += arm/mpegvideo_arm.o -+ OBJS-$(CONFIG_NEON_CLOBBER_TEST) += arm/neontest.o -+diff --git a/libavcodec/arm/mlpdsp_arm.S b/libavcodec/arm/mlpdsp_arm.S -+new file mode 100644 -+index 0000000..615819d -+--- /dev/null -++++ b/libavcodec/arm/mlpdsp_arm.S -+@@ -0,0 +1,433 @@ -++/* -++ * Copyright (c) 2014 RISC OS Open Ltd -++ * Author: Ben Avison -++ * -++ * This file is part of FFmpeg. -++ * -++ * FFmpeg is free software; you can redistribute it and/or -++ * modify it under the terms of the GNU Lesser General Public -++ * License as published by the Free Software Foundation; either -++ * version 2.1 of the License, or (at your option) any later version. -++ * -++ * FFmpeg 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 -++ * Lesser General Public License for more details. -++ * -++ * You should have received a copy of the GNU Lesser General Public -++ * License along with FFmpeg; if not, write to the Free Software -++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -++ */ -++ -++#include "libavutil/arm/asm.S" -++ -++#define MAX_CHANNELS 8 -++#define MAX_FIR_ORDER 8 -++#define MAX_IIR_ORDER 4 -++#define MAX_RATEFACTOR 4 -++#define MAX_BLOCKSIZE (40 * MAX_RATEFACTOR) -++ -++PST .req a1 -++PCO .req a2 -++AC0 .req a3 -++AC1 .req a4 -++CO0 .req v1 -++CO1 .req v2 -++CO2 .req v3 -++CO3 .req v4 -++ST0 .req v5 -++ST1 .req v6 -++ST2 .req sl -++ST3 .req fp -++I .req ip -++PSAMP .req lr -++ -++ -++// Some macros that do loads/multiplies where the register number is determined -++// from an assembly-time expression. Boy is GNU assembler's syntax ugly... -++ -++.macro load group, index, base, offset -++ .altmacro -++ load_ \group, %(\index), \base, \offset -++ .noaltmacro -++.endm -++ -++.macro load_ group, index, base, offset -++ ldr \group\index, [\base, #\offset] -++.endm -++ -++.macro loadd group, index, base, offset -++ .altmacro -++ loadd_ \group, %(\index), %(\index+1), \base, \offset -++ .noaltmacro -++.endm -++ -++.macro loadd_ group, index0, index1, base, offset -++A .if offset >= 256 -++A ldr \group\index0, [\base, #\offset] -++A ldr \group\index1, [\base, #(\offset) + 4] -++A .else -++ ldrd \group\index0, \group\index1, [\base, #\offset] -++A .endif -++.endm -++ -++.macro multiply index, accumulate, long -++ .altmacro -++ multiply_ %(\index), \accumulate, \long -++ .noaltmacro -++.endm -++ -++.macro multiply_ index, accumulate, long -++ .if \long -++ .if \accumulate -++ smlal AC0, AC1, CO\index, ST\index -++ .else -++ smull AC0, AC1, CO\index, ST\index -++ .endif -++ .else -++ .if \accumulate -++ mla AC0, CO\index, ST\index, AC0 -++ .else -++ mul AC0, CO\index, ST\index -++ .endif -++ .endif -++.endm -++ -++// A macro to update the load register number and load offsets -++ -++.macro inc howmany -++ .set LOAD_REG, (LOAD_REG + \howmany) & 3 -++ .set OFFSET_CO, OFFSET_CO + 4 * \howmany -++ .set OFFSET_ST, OFFSET_ST + 4 * \howmany -++ .if FIR_REMAIN > 0 -++ .set FIR_REMAIN, FIR_REMAIN - \howmany -++ .if FIR_REMAIN == 0 -++ .set OFFSET_CO, 4 * MAX_FIR_ORDER -++ .set OFFSET_ST, 4 * (MAX_BLOCKSIZE + MAX_FIR_ORDER) -++ .endif -++ .elseif IIR_REMAIN > 0 -++ .set IIR_REMAIN, IIR_REMAIN - \howmany -++ .endif -++.endm -++ -++// Macro to implement the inner loop for one specific combination of parameters -++ -++.macro implement_filter mask_minus1, shift_0, shift_8, iir_taps, fir_taps -++ .set TOTAL_TAPS, \iir_taps + \fir_taps -++ -++ // Deal with register allocation... -++ .set DEFINED_SHIFT, 0 -++ .set DEFINED_MASK, 0 -++ .set SHUFFLE_SHIFT, 0 -++ .set SHUFFLE_MASK, 0 -++ .set SPILL_SHIFT, 0 -++ .set SPILL_MASK, 0 -++ .if TOTAL_TAPS == 0 -++ // Little register pressure in this case - just keep MASK where it was -++ .if !\mask_minus1 -++ MASK .req ST1 -++ .set DEFINED_MASK, 1 -++ .endif -++ .else -++ .if \shift_0 -++ .if !\mask_minus1 -++ // AC1 is unused with shift 0 -++ MASK .req AC1 -++ .set DEFINED_MASK, 1 -++ .set SHUFFLE_MASK, 1 -++ .endif -++ .elseif \shift_8 -++ .if !\mask_minus1 -++ .if TOTAL_TAPS <= 4 -++ // All coefficients are preloaded (so pointer not needed) -++ MASK .req PCO -++ .set DEFINED_MASK, 1 -++ .set SHUFFLE_MASK, 1 -++ .else -++ .set SPILL_MASK, 1 -++ .endif -++ .endif -++ .else // shift not 0 or 8 -++ .if TOTAL_TAPS <= 3 -++ // All coefficients are preloaded, and at least one CO register is unused -++ .if \fir_taps & 1 -++ SHIFT .req CO0 -++ .set DEFINED_SHIFT, 1 -++ .set SHUFFLE_SHIFT, 1 -++ .else -++ SHIFT .req CO3 -++ .set DEFINED_SHIFT, 1 -++ .set SHUFFLE_SHIFT, 1 -++ .endif -++ .if !\mask_minus1 -++ MASK .req PCO -++ .set DEFINED_MASK, 1 -++ .set SHUFFLE_MASK, 1 -++ .endif -++ .elseif TOTAL_TAPS == 4 -++ // All coefficients are preloaded -++ SHIFT .req PCO -++ .set DEFINED_SHIFT, 1 -++ .set SHUFFLE_SHIFT, 1 -++ .if !\mask_minus1 -++ .set SPILL_MASK, 1 -++ .endif -++ .else -++ .set SPILL_SHIFT, 1 -++ .if !\mask_minus1 -++ .set SPILL_MASK, 1 -++ .endif -++ .endif -++ .endif -++ .endif -++ .if SPILL_SHIFT -++ SHIFT .req ST0 -++ .set DEFINED_SHIFT, 1 -++ .endif -++ .if SPILL_MASK -++ MASK .req ST1 -++ .set DEFINED_MASK, 1 -++ .endif -++ -++ // Preload coefficients if possible -++ .if TOTAL_TAPS <= 4 -++ .set OFFSET_CO, 0 -++ .if \fir_taps & 1 -++ .set LOAD_REG, 1 -++ .else -++ .set LOAD_REG, 0 -++ .endif -++ .rept \fir_taps -++ load CO, LOAD_REG, PCO, OFFSET_CO -++ .set LOAD_REG, (LOAD_REG + 1) & 3 -++ .set OFFSET_CO, OFFSET_CO + 4 -++ .endr -++ .set OFFSET_CO, 4 * MAX_FIR_ORDER -++ .rept \iir_taps -++ load CO, LOAD_REG, PCO, OFFSET_CO -++ .set LOAD_REG, (LOAD_REG + 1) & 3 -++ .set OFFSET_CO, OFFSET_CO + 4 -++ .endr -++ .endif -++ -++ // Move mask/shift to final positions if necessary -++ // Need to do this after preloading, because in some cases we -++ // reuse the coefficient pointer register -++ .if SHUFFLE_SHIFT -++ mov SHIFT, ST0 -++ .endif -++ .if SHUFFLE_MASK -++ mov MASK, ST1 -++ .endif -++ -++ // Begin loop -++01: -++ .if TOTAL_TAPS == 0 -++ // Things simplify a lot in this case -++ // In fact this could be pipelined further if it's worth it... -++ ldr ST0, [PSAMP] -++ subs I, I, #1 -++ .if !\mask_minus1 -++ and ST0, ST0, MASK -++ .endif -++ str ST0, [PST, #-4]! -++ str ST0, [PST, #4 * (MAX_BLOCKSIZE + MAX_FIR_ORDER)] -++ str ST0, [PSAMP], #4 * MAX_CHANNELS -++ bne 01b -++ .else -++ .if \fir_taps & 1 -++ .set LOAD_REG, 1 -++ .else -++ .set LOAD_REG, 0 -++ .endif -++ .set LOAD_BANK, 0 -++ .set FIR_REMAIN, \fir_taps -++ .set IIR_REMAIN, \iir_taps -++ .if FIR_REMAIN == 0 // only IIR terms -++ .set OFFSET_CO, 4 * MAX_FIR_ORDER -++ .set OFFSET_ST, 4 * (MAX_BLOCKSIZE + MAX_FIR_ORDER) -++ .else -++ .set OFFSET_CO, 0 -++ .set OFFSET_ST, 0 -++ .endif -++ .set MUL_REG, LOAD_REG -++ .set COUNTER, 0 -++ .rept TOTAL_TAPS + 2 -++ // Do load(s) -++ .if FIR_REMAIN != 0 || IIR_REMAIN != 0 -++ .if COUNTER == 0 -++ .if TOTAL_TAPS > 4 -++ load CO, LOAD_REG, PCO, OFFSET_CO -++ .endif -++ load ST, LOAD_REG, PST, OFFSET_ST -++ inc 1 -++ .elseif COUNTER == 1 && (\fir_taps & 1) == 0 -++ .if TOTAL_TAPS > 4 -++ load CO, LOAD_REG, PCO, OFFSET_CO -++ .endif -++ load ST, LOAD_REG, PST, OFFSET_ST -++ inc 1 -++ .elseif LOAD_BANK == 0 -++ .if TOTAL_TAPS > 4 -++ .if FIR_REMAIN == 0 && IIR_REMAIN == 1 -++ load CO, LOAD_REG, PCO, OFFSET_CO -++ .else -++ loadd CO, LOAD_REG, PCO, OFFSET_CO -++ .endif -++ .endif -++ .set LOAD_BANK, 1 -++ .else -++ .if FIR_REMAIN == 0 && IIR_REMAIN == 1 -++ load ST, LOAD_REG, PST, OFFSET_ST -++ inc 1 -++ .else -++ loadd ST, LOAD_REG, PST, OFFSET_ST -++ inc 2 -++ .endif -++ .set LOAD_BANK, 0 -++ .endif -++ .endif -++ -++ // Do interleaved multiplies, slightly delayed -++ .if COUNTER >= 2 -++ multiply MUL_REG, COUNTER > 2, !\shift_0 -++ .set MUL_REG, (MUL_REG + 1) & 3 -++ .endif -++ .set COUNTER, COUNTER + 1 -++ .endr -++ -++ // Post-process the result of the multiplies -++ .if SPILL_SHIFT -++ ldr SHIFT, [sp, #9*4 + 0*4] -++ .endif -++ .if SPILL_MASK -++ ldr MASK, [sp, #9*4 + 1*4] -++ .endif -++ ldr ST2, [PSAMP] -++ subs I, I, #1 -++ .if \shift_8 -++ mov AC0, AC0, lsr #8 -++ orr AC0, AC0, AC1, lsl #24 -++ .elseif !\shift_0 -++ rsb ST3, SHIFT, #32 -++ mov AC0, AC0, lsr SHIFT -++A orr AC0, AC0, AC1, lsl ST3 -++T mov AC1, AC1, lsl ST3 -++T orr AC0, AC0, AC1 -++ .endif -++ .if \mask_minus1 -++ add ST3, ST2, AC0 -++ .else -++ add ST2, ST2, AC0 -++ and ST3, ST2, MASK -++ sub ST2, ST3, AC0 -++ .endif -++ str ST3, [PST, #-4]! -++ str ST2, [PST, #4 * (MAX_BLOCKSIZE + MAX_FIR_ORDER)] -++ str ST3, [PSAMP], #4 * MAX_CHANNELS -++ bne 01b -++ .endif -++ b 99f -++ -++ .if DEFINED_SHIFT -++ .unreq SHIFT -++ .endif -++ .if DEFINED_MASK -++ .unreq MASK -++ .endif -++.endm -++ -++.macro switch_on_fir_taps mask_minus1, shift_0, shift_8, iir_taps -++A ldr pc, [pc, a3, LSL #2] // firorder is in range 0-(8-iir_taps) -++T tbh [pc, a3, lsl #1] -++0: -++A .word 0, 70f, 71f, 72f, 73f, 74f -++T .hword (70f - 0b) / 2, (71f - 0b) / 2, (72f - 0b) / 2, (73f - 0b) / 2, (74f - 0b) / 2 -++ .if \iir_taps <= 3 -++A .word 75f -++T .hword (75f - 0b) / 2 -++ .if \iir_taps <= 2 -++A .word 76f -++T .hword (76f - 0b) / 2 -++ .if \iir_taps <= 1 -++A .word 77f -++T .hword (77f - 0b) / 2 -++ .if \iir_taps == 0 -++A .word 78f -++T .hword (78f - 0b) / 2 -++ .endif -++ .endif -++ .endif -++ .endif -++70: implement_filter \mask_minus1, \shift_0, \shift_8, \iir_taps, 0 -++71: implement_filter \mask_minus1, \shift_0, \shift_8, \iir_taps, 1 -++72: implement_filter \mask_minus1, \shift_0, \shift_8, \iir_taps, 2 -++73: implement_filter \mask_minus1, \shift_0, \shift_8, \iir_taps, 3 -++74: implement_filter \mask_minus1, \shift_0, \shift_8, \iir_taps, 4 -++ .if \iir_taps <= 3 -++75: implement_filter \mask_minus1, \shift_0, \shift_8, \iir_taps, 5 -++ .if \iir_taps <= 2 -++76: implement_filter \mask_minus1, \shift_0, \shift_8, \iir_taps, 6 -++ .if \iir_taps <= 1 -++77: implement_filter \mask_minus1, \shift_0, \shift_8, \iir_taps, 7 -++ .if \iir_taps == 0 -++78: implement_filter \mask_minus1, \shift_0, \shift_8, \iir_taps, 8 -++ .endif -++ .endif -++ .endif -++ .endif -++.endm -++ -++.macro switch_on_iir_taps mask_minus1, shift_0, shift_8 -++A ldr pc, [pc, a4, LSL #2] // irorder is in range 0-4 -++T tbh [pc, a4, lsl #1] -++0: -++A .word 0, 60f, 61f, 62f, 63f, 64f -++T .hword (60f - 0b) / 2, (61f - 0b) / 2, (62f - 0b) / 2, (63f - 0b) / 2, (64f - 0b) / 2 -++60: switch_on_fir_taps \mask_minus1, \shift_0, \shift_8, 0 -++61: switch_on_fir_taps \mask_minus1, \shift_0, \shift_8, 1 -++62: switch_on_fir_taps \mask_minus1, \shift_0, \shift_8, 2 -++63: switch_on_fir_taps \mask_minus1, \shift_0, \shift_8, 3 -++64: switch_on_fir_taps \mask_minus1, \shift_0, \shift_8, 4 -++.endm -++ -++/* void ff_mlp_filter_channel_arm(int32_t *state, const int32_t *coeff, -++ * int firorder, int iirorder, -++ * unsigned int filter_shift, int32_t mask, -++ * int blocksize, int32_t *sample_buffer); -++ */ -++function ff_mlp_filter_channel_arm, export=1 -++ push {v1-fp,lr} -++ add v1, sp, #9*4 // point at arguments on stack -++ ldm v1, {ST0,ST1,I,PSAMP} -++ cmp ST1, #-1 -++ bne 30f -++ movs ST2, ST0, lsl #29 // shift is in range 0-15; we want to special-case 0 and 8 -++ bne 20f -++ bcs 10f -++ switch_on_iir_taps 1, 1, 0 -++10: switch_on_iir_taps 1, 0, 1 -++20: switch_on_iir_taps 1, 0, 0 -++30: movs ST2, ST0, lsl #29 // shift is in range 0-15; we want to special-case 0 and 8 -++ bne 50f -++ bcs 40f -++ switch_on_iir_taps 0, 1, 0 -++40: switch_on_iir_taps 0, 0, 1 -++50: switch_on_iir_taps 0, 0, 0 -++99: pop {v1-fp,pc} -++endfunc -++ -++ .unreq PST -++ .unreq PCO -++ .unreq AC0 -++ .unreq AC1 -++ .unreq CO0 -++ .unreq CO1 -++ .unreq CO2 -++ .unreq CO3 -++ .unreq ST0 -++ .unreq ST1 -++ .unreq ST2 -++ .unreq ST3 -++ .unreq I -++ .unreq PSAMP -+diff --git a/libavcodec/arm/mlpdsp_init_arm.c b/libavcodec/arm/mlpdsp_init_arm.c -+new file mode 100644 -+index 0000000..9a14815 -+--- /dev/null -++++ b/libavcodec/arm/mlpdsp_init_arm.c -+@@ -0,0 +1,36 @@ -++/* -++ * Copyright (c) 2014 RISC OS Open Ltd -++ * Author: Ben Avison -++ * -++ * This file is part of FFmpeg. -++ * -++ * FFmpeg is free software; you can redistribute it and/or -++ * modify it under the terms of the GNU Lesser General Public -++ * License as published by the Free Software Foundation; either -++ * version 2.1 of the License, or (at your option) any later version. -++ * -++ * FFmpeg 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 -++ * Lesser General Public License for more details. -++ * -++ * You should have received a copy of the GNU Lesser General Public -++ * License along with FFmpeg; if not, write to the Free Software -++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -++ */ -++ -++#include -++ -++#include "libavutil/arm/cpu.h" -++#include "libavutil/attributes.h" -++#include "libavcodec/mlpdsp.h" -++ -++void ff_mlp_filter_channel_arm(int32_t *state, const int32_t *coeff, -++ int firorder, int iirorder, -++ unsigned int filter_shift, int32_t mask, -++ int blocksize, int32_t *sample_buffer); -++ -++av_cold void ff_mlpdsp_init_arm(MLPDSPContext *c) -++{ -++ c->mlp_filter_channel = ff_mlp_filter_channel_arm; -++} -+diff --git a/libavcodec/mlpdsp.c b/libavcodec/mlpdsp.c -+index b413e86..4b403b8 100644 -+--- a/libavcodec/mlpdsp.c -++++ b/libavcodec/mlpdsp.c -+@@ -60,6 +60,8 @@ static void mlp_filter_channel(int32_t *state, const int32_t *coeff, -+ av_cold void ff_mlpdsp_init(MLPDSPContext *c) -+ { -+ c->mlp_filter_channel = mlp_filter_channel; -++ if (ARCH_ARM) -++ ff_mlpdsp_init_arm(c); -+ if (ARCH_X86) -+ ff_mlpdsp_init_x86(c); -+ } -+diff --git a/libavcodec/mlpdsp.h b/libavcodec/mlpdsp.h -+index 84a8aa3..129bcfe 100644 -+--- a/libavcodec/mlpdsp.h -++++ b/libavcodec/mlpdsp.h -+@@ -32,6 +32,7 @@ typedef struct MLPDSPContext { -+ } MLPDSPContext; -+ -+ void ff_mlpdsp_init(MLPDSPContext *c); -++void ff_mlpdsp_init_arm(MLPDSPContext *c); -+ void ff_mlpdsp_init_x86(MLPDSPContext *c); -+ -+ #endif /* AVCODEC_MLPDSP_H */ -+-- -+1.9.1 -diff --git a/tools/depends/target/ffmpeg/0003-truehd-break-out-part-of-rematrix_channels-into-plat.patch b/tools/depends/target/ffmpeg/0003-truehd-break-out-part-of-rematrix_channels-into-plat.patch -new file mode 100644 -index 0000000..9c06f8f ---- /dev/null -+++ b/tools/depends/target/ffmpeg/0003-truehd-break-out-part-of-rematrix_channels-into-plat.patch -@@ -0,0 +1,158 @@ -+From bb74fc44081fb6d7923ce1b7ed3e3e6514695f3e Mon Sep 17 00:00:00 2001 -+From: Ben Avison -+Date: Wed, 5 Mar 2014 21:01:28 +0000 -+Subject: [PATCH 3/6] truehd: break out part of rematrix_channels into -+ platform-specific callback. -+ -+Verified with profiling that this doesn't have a measurable effect upon -+overall performance. -+--- -+ libavcodec/mlpdec.c | 37 ++++++++++++------------------------- -+ libavcodec/mlpdsp.c | 33 +++++++++++++++++++++++++++++++++ -+ libavcodec/mlpdsp.h | 23 +++++++++++++++++++++++ -+ 3 files changed, 68 insertions(+), 25 deletions(-) -+ -+diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c -+index cbd9000..01ded5c 100644 -+--- a/libavcodec/mlpdec.c -++++ b/libavcodec/mlpdec.c -+@@ -1024,7 +1024,7 @@ static void fill_noise_buffer(MLPDecodeContext *m, unsigned int substr) -+ static void rematrix_channels(MLPDecodeContext *m, unsigned int substr) -+ { -+ SubStream *s = &m->substream[substr]; -+- unsigned int mat, src_ch, i; -++ unsigned int mat; -+ unsigned int maxchan; -+ -+ maxchan = s->max_matrix_channel; -+@@ -1036,31 +1036,18 @@ static void rematrix_channels(MLPDecodeContext *m, unsigned int substr) -+ } -+ -+ for (mat = 0; mat < s->num_primitive_matrices; mat++) { -+- int matrix_noise_shift = s->matrix_noise_shift[mat]; -+ unsigned int dest_ch = s->matrix_out_ch[mat]; -+- int32_t mask = MSB_MASK(s->quant_step_size[dest_ch]); -+- int32_t *coeffs = s->matrix_coeff[mat]; -+- int index = s->num_primitive_matrices - mat; -+- int index2 = 2 * index + 1; -+- -+- /* TODO: DSPContext? */ -+- -+- for (i = 0; i < s->blockpos; i++) { -+- int32_t bypassed_lsb = m->bypassed_lsbs[i][mat]; -+- int32_t *samples = m->sample_buffer[i]; -+- int64_t accum = 0; -+- -+- for (src_ch = 0; src_ch <= maxchan; src_ch++) -+- accum += (int64_t) samples[src_ch] * coeffs[src_ch]; -+- -+- if (matrix_noise_shift) { -+- index &= m->access_unit_size_pow2 - 1; -+- accum += m->noise_buffer[index] << (matrix_noise_shift + 7); -+- index += index2; -+- } -+- -+- samples[dest_ch] = ((accum >> 14) & mask) + bypassed_lsb; -+- } -++ m->dsp.mlp_rematrix_channel(&m->sample_buffer[0][0], -++ s->matrix_coeff[mat], -++ &m->bypassed_lsbs[0][mat], -++ m->noise_buffer, -++ s->num_primitive_matrices - mat, -++ dest_ch, -++ s->blockpos, -++ maxchan, -++ s->matrix_noise_shift[mat], -++ m->access_unit_size_pow2, -++ MSB_MASK(s->quant_step_size[dest_ch])); -+ } -+ } -+ -+diff --git a/libavcodec/mlpdsp.c b/libavcodec/mlpdsp.c -+index 4b403b8..7a359b0 100644 -+--- a/libavcodec/mlpdsp.c -++++ b/libavcodec/mlpdsp.c -+@@ -57,9 +57,42 @@ static void mlp_filter_channel(int32_t *state, const int32_t *coeff, -+ } -+ } -+ -++void ff_mlp_rematrix_channel(int32_t *samples, -++ const int32_t *coeffs, -++ const uint8_t *bypassed_lsbs, -++ const int8_t *noise_buffer, -++ int index, -++ unsigned int dest_ch, -++ uint16_t blockpos, -++ unsigned int maxchan, -++ int matrix_noise_shift, -++ int access_unit_size_pow2, -++ int32_t mask) -++{ -++ unsigned int src_ch, i; -++ int index2 = 2 * index + 1; -++ for (i = 0; i < blockpos; i++) { -++ int64_t accum = 0; -++ -++ for (src_ch = 0; src_ch <= maxchan; src_ch++) -++ accum += (int64_t) samples[src_ch] * coeffs[src_ch]; -++ -++ if (matrix_noise_shift) { -++ index &= access_unit_size_pow2 - 1; -++ accum += noise_buffer[index] << (matrix_noise_shift + 7); -++ index += index2; -++ } -++ -++ samples[dest_ch] = ((accum >> 14) & mask) + *bypassed_lsbs; -++ bypassed_lsbs += MAX_CHANNELS; -++ samples += MAX_CHANNELS; -++ } -++} -++ -+ av_cold void ff_mlpdsp_init(MLPDSPContext *c) -+ { -+ c->mlp_filter_channel = mlp_filter_channel; -++ c->mlp_rematrix_channel = ff_mlp_rematrix_channel; -+ if (ARCH_ARM) -+ ff_mlpdsp_init_arm(c); -+ if (ARCH_X86) -+diff --git a/libavcodec/mlpdsp.h b/libavcodec/mlpdsp.h -+index 129bcfe..f98e9be 100644 -+--- a/libavcodec/mlpdsp.h -++++ b/libavcodec/mlpdsp.h -+@@ -24,11 +24,34 @@ -+ -+ #include -+ -++void ff_mlp_rematrix_channel(int32_t *samples, -++ const int32_t *coeffs, -++ const uint8_t *bypassed_lsbs, -++ const int8_t *noise_buffer, -++ int index, -++ unsigned int dest_ch, -++ uint16_t blockpos, -++ unsigned int maxchan, -++ int matrix_noise_shift, -++ int access_unit_size_pow2, -++ int32_t mask); -++ -+ typedef struct MLPDSPContext { -+ void (*mlp_filter_channel)(int32_t *state, const int32_t *coeff, -+ int firorder, int iirorder, -+ unsigned int filter_shift, int32_t mask, -+ int blocksize, int32_t *sample_buffer); -++ void (*mlp_rematrix_channel)(int32_t *samples, -++ const int32_t *coeffs, -++ const uint8_t *bypassed_lsbs, -++ const int8_t *noise_buffer, -++ int index, -++ unsigned int dest_ch, -++ uint16_t blockpos, -++ unsigned int maxchan, -++ int matrix_noise_shift, -++ int access_unit_size_pow2, -++ int32_t mask); -+ } MLPDSPContext; -+ -+ void ff_mlpdsp_init(MLPDSPContext *c); -+-- -+1.9.1 -diff --git a/tools/depends/target/ffmpeg/0004-truehd-add-hand-scheduled-ARM-asm-version-of-ff_mlp_.patch b/tools/depends/target/ffmpeg/0004-truehd-add-hand-scheduled-ARM-asm-version-of-ff_mlp_.patch -new file mode 100644 -index 0000000..575622e ---- /dev/null -+++ b/tools/depends/target/ffmpeg/0004-truehd-add-hand-scheduled-ARM-asm-version-of-ff_mlp_.patch -@@ -0,0 +1,285 @@ -+From 98428a8cf593587b403076bb54b46cc70ed17ff2 Mon Sep 17 00:00:00 2001 -+From: Ben Avison -+Date: Mon, 10 Mar 2014 14:42:05 +0000 -+Subject: [PATCH 4/6] truehd: add hand-scheduled ARM asm version of -+ ff_mlp_rematrix_channel. -+ -+Profiling results for overall audio decode and the rematrix_channels function -+in particular are as follows: -+ -+ Before After -+ Mean StdDev Mean StdDev Confidence Change -+6:2 total 370.8 17.0 348.8 20.1 99.9% +6.3% -+6:2 function 46.4 8.4 45.8 6.6 18.0% +1.2% (insignificant) -+8:2 total 343.2 19.0 339.1 15.4 54.7% +1.2% (insignificant) -+8:2 function 38.9 3.9 40.2 6.9 52.4% -3.2% (insignificant) -+6:6 total 658.4 15.7 604.6 20.8 100.0% +8.9% -+6:6 function 109.0 8.7 59.5 5.4 100.0% +83.3% -+8:8 total 896.2 24.5 766.4 17.6 100.0% +16.9% -+8:8 function 223.4 12.8 93.8 5.0 100.0% +138.3% -+ -+The assembly version has also been tested with a fuzz tester to ensure that -+any combinations of inputs not exercised by my available test streams still -+generate mathematically identical results to the C version. -+--- -+ libavcodec/arm/mlpdsp_arm.S | 222 +++++++++++++++++++++++++++++++++++++++ -+ libavcodec/arm/mlpdsp_init_arm.c | 12 +++ -+ 2 files changed, 234 insertions(+) -+ -+diff --git a/libavcodec/arm/mlpdsp_arm.S b/libavcodec/arm/mlpdsp_arm.S -+index 615819d..9b51d0c 100644 -+--- a/libavcodec/arm/mlpdsp_arm.S -++++ b/libavcodec/arm/mlpdsp_arm.S -+@@ -431,3 +431,225 @@ endfunc -+ .unreq ST3 -+ .unreq I -+ .unreq PSAMP -++ -++/********************************************************************/ -++ -++PSA .req a1 // samples -++PCO .req a2 // coeffs -++PBL .req a3 // bypassed_lsbs -++INDEX .req a4 -++CO0 .req v1 -++CO1 .req v2 -++CO2 .req v3 -++CO3 .req v4 -++SA0 .req v5 -++SA1 .req v6 -++SA2 .req sl -++SA3 .req fp -++AC0 .req ip -++AC1 .req lr -++NOISE .req SA0 -++LSB .req SA1 -++DCH .req SA2 // dest_ch -++MASK .req SA3 -++ -++ // INDEX is used as follows: -++ // bits 0..6 index2 (values up to 17, but wider so that we can -++ // add to index field without needing to mask) -++ // bits 7..14 i (values up to 160) -++ // bit 15 underflow detect for i -++ // bits 25..31 (if access_unit_size_pow2 == 128) \ index -++ // bits 26..31 (if access_unit_size_pow2 == 64) / -++ -++.macro implement_rematrix shift, index_mask, mask_minus1, maxchan -++ .if \maxchan == 1 -++ // We can just leave the coefficients in registers in this case -++ ldrd CO0, CO1, [PCO] -++ .endif -++1: -++ .if \maxchan == 1 -++ ldrd SA0, SA1, [PSA] -++ smull AC0, AC1, CO0, SA0 -++ .elseif \maxchan == 5 -++ ldr CO0, [PCO, #0] -++ ldr SA0, [PSA, #0] -++ ldr CO1, [PCO, #4] -++ ldr SA1, [PSA, #4] -++ ldrd CO2, CO3, [PCO, #8] -++ smull AC0, AC1, CO0, SA0 -++ ldrd SA2, SA3, [PSA, #8] -++ smlal AC0, AC1, CO1, SA1 -++ ldrd CO0, CO1, [PCO, #16] -++ smlal AC0, AC1, CO2, SA2 -++ ldrd SA0, SA1, [PSA, #16] -++ smlal AC0, AC1, CO3, SA3 -++ smlal AC0, AC1, CO0, SA0 -++ .else // \maxchan == 7 -++ ldr CO2, [PCO, #0] -++ ldr SA2, [PSA, #0] -++ ldr CO3, [PCO, #4] -++ ldr SA3, [PSA, #4] -++ ldrd CO0, CO1, [PCO, #8] -++ smull AC0, AC1, CO2, SA2 -++ ldrd SA0, SA1, [PSA, #8] -++ smlal AC0, AC1, CO3, SA3 -++ ldrd CO2, CO3, [PCO, #16] -++ smlal AC0, AC1, CO0, SA0 -++ ldrd SA2, SA3, [PSA, #16] -++ smlal AC0, AC1, CO1, SA1 -++ ldrd CO0, CO1, [PCO, #24] -++ smlal AC0, AC1, CO2, SA2 -++ ldrd SA0, SA1, [PSA, #24] -++ smlal AC0, AC1, CO3, SA3 -++ smlal AC0, AC1, CO0, SA0 -++ .endif -++ ldm sp, {NOISE, DCH, MASK} -++ smlal AC0, AC1, CO1, SA1 -++ .if \shift != 0 -++ .if \index_mask == 63 -++ add NOISE, NOISE, INDEX, lsr #32-6 -++ ldrb LSB, [PBL], #MAX_CHANNELS -++ ldrsb NOISE, [NOISE] -++ add INDEX, INDEX, INDEX, lsl #32-6 -++ .else // \index_mask == 127 -++ add NOISE, NOISE, INDEX, lsr #32-7 -++ ldrb LSB, [PBL], #MAX_CHANNELS -++ ldrsb NOISE, [NOISE] -++ add INDEX, INDEX, INDEX, lsl #32-7 -++ .endif -++ sub INDEX, INDEX, #1<<7 -++ adds AC0, AC0, NOISE, lsl #\shift + 7 -++ adc AC1, AC1, NOISE, asr #31 -++ .else -++ ldrb LSB, [PBL], #MAX_CHANNELS -++ sub INDEX, INDEX, #1<<7 -++ .endif -++ add PSA, PSA, #MAX_CHANNELS*4 -++ mov AC0, AC0, lsr #14 -++ orr AC0, AC0, AC1, lsl #18 -++ .if !\mask_minus1 -++ and AC0, AC0, MASK -++ .endif -++ add AC0, AC0, LSB -++ tst INDEX, #1<<15 -++ str AC0, [PSA, DCH, lsl #2] // DCH is precompensated for the early increment of PSA -++ beq 1b -++ b 98f -++.endm -++ -++.macro switch_on_maxchan shift, index_mask, mask_minus1 -++ cmp v4, #5 -++ blo 51f -++ beq 50f -++ implement_rematrix \shift, \index_mask, \mask_minus1, 7 -++50: implement_rematrix \shift, \index_mask, \mask_minus1, 5 -++51: implement_rematrix \shift, \index_mask, \mask_minus1, 1 -++.endm -++ -++.macro switch_on_mask shift, index_mask -++ cmp sl, #-1 -++ bne 40f -++ switch_on_maxchan \shift, \index_mask, 1 -++40: switch_on_maxchan \shift, \index_mask, 0 -++.endm -++ -++.macro switch_on_au_size shift -++ .if \shift == 0 -++ switch_on_mask \shift, undefined -++ .else -++ teq v6, #64 -++ bne 30f -++ orr INDEX, INDEX, v1, lsl #32-6 -++ switch_on_mask \shift, 63 -++30: orr INDEX, INDEX, v1, lsl #32-7 -++ switch_on_mask \shift, 127 -++ .endif -++.endm -++ -++/* void ff_mlp_rematrix_channel_arm(int32_t *samples, -++ * const int32_t *coeffs, -++ * const uint8_t *bypassed_lsbs, -++ * const int8_t *noise_buffer, -++ * int index, -++ * unsigned int dest_ch, -++ * uint16_t blockpos, -++ * unsigned int maxchan, -++ * int matrix_noise_shift, -++ * int access_unit_size_pow2, -++ * int32_t mask); -++ */ -++function ff_mlp_rematrix_channel_arm, export=1 -++ push {v1-fp,lr} -++ add v1, sp, #9*4 // point at arguments on stack -++ ldm v1, {v1-sl} -++ teq v4, #1 -++ itt ne -++ teqne v4, #5 -++ teqne v4, #7 -++ bne 99f -++ teq v6, #64 -++ it ne -++ teqne v6, #128 -++ bne 99f -++ sub v2, v2, #MAX_CHANNELS -++ push {a4,v2,sl} // initialise NOISE,DCH,MASK; make sp dword-aligned -++ movs INDEX, v3, lsl #7 -++ beq 98f // just in case, do nothing if blockpos = 0 -++ subs INDEX, INDEX, #1<<7 // offset by 1 so we borrow at the right time -++ adc lr, v1, v1 // calculate index2 (C was set by preceding subs) -++ orr INDEX, INDEX, lr -++ // Switch on matrix_noise_shift: values 0 and 1 are -++ // disproportionately common so do those in a form the branch -++ // predictor can accelerate. Values can only go up to 15. -++ cmp v5, #1 -++ beq 11f -++ blo 10f -++A ldr pc, [pc, v5, lsl #2] -++T tbh [pc, v5, lsl #1] -++0: -++A .word 0, 0, 0, 12f, 13f, 14f, 15f, 16f, 17f, 18f, 19f, 20f, 21f, 22f, 23f, 24f, 25f -++T .hword 0, 0, (12f - 0b) / 2, (13f - 0b) / 2, (14f - 0b) / 2, (15f - 0b) / 2 -++T .hword (16f - 0b) / 2, (17f - 0b) / 2, (18f - 0b) / 2, (19f - 0b) / 2 -++T .hword (20f - 0b) / 2, (21f - 0b) / 2, (22f - 0b) / 2, (23f - 0b) / 2, (24f - 0b) / 2, (25f - 0b) / 2 -++10: switch_on_au_size 0 -++11: switch_on_au_size 1 -++12: switch_on_au_size 2 -++13: switch_on_au_size 3 -++14: switch_on_au_size 4 -++15: switch_on_au_size 5 -++16: switch_on_au_size 6 -++17: switch_on_au_size 7 -++18: switch_on_au_size 8 -++19: switch_on_au_size 9 -++20: switch_on_au_size 10 -++21: switch_on_au_size 11 -++22: switch_on_au_size 12 -++23: switch_on_au_size 13 -++24: switch_on_au_size 14 -++25: switch_on_au_size 15 -++ -++98: add sp, sp, #3*4 -++ pop {v1-fp,pc} -++99: // Can't handle these parameters, drop back to C -++ pop {v1-fp,lr} -++ b X(ff_mlp_rematrix_channel) -++endfunc -++ -++ .unreq PSA -++ .unreq PCO -++ .unreq PBL -++ .unreq INDEX -++ .unreq CO0 -++ .unreq CO1 -++ .unreq CO2 -++ .unreq CO3 -++ .unreq SA0 -++ .unreq SA1 -++ .unreq SA2 -++ .unreq SA3 -++ .unreq AC0 -++ .unreq AC1 -++ .unreq NOISE -++ .unreq LSB -++ .unreq DCH -++ .unreq MASK -+diff --git a/libavcodec/arm/mlpdsp_init_arm.c b/libavcodec/arm/mlpdsp_init_arm.c -+index 9a14815..1bb2276 100644 -+--- a/libavcodec/arm/mlpdsp_init_arm.c -++++ b/libavcodec/arm/mlpdsp_init_arm.c -+@@ -29,8 +29,20 @@ void ff_mlp_filter_channel_arm(int32_t *state, const int32_t *coeff, -+ int firorder, int iirorder, -+ unsigned int filter_shift, int32_t mask, -+ int blocksize, int32_t *sample_buffer); -++void ff_mlp_rematrix_channel_arm(int32_t *samples, -++ const int32_t *coeffs, -++ const uint8_t *bypassed_lsbs, -++ const int8_t *noise_buffer, -++ int index, -++ unsigned int dest_ch, -++ uint16_t blockpos, -++ unsigned int maxchan, -++ int matrix_noise_shift, -++ int access_unit_size_pow2, -++ int32_t mask); -+ -+ av_cold void ff_mlpdsp_init_arm(MLPDSPContext *c) -+ { -+ c->mlp_filter_channel = ff_mlp_filter_channel_arm; -++ c->mlp_rematrix_channel = ff_mlp_rematrix_channel_arm; -+ } -+-- -+1.9.1 -diff --git a/tools/depends/target/ffmpeg/0005-truehd-break-out-part-of-output_data-into-platform-s.patch b/tools/depends/target/ffmpeg/0005-truehd-break-out-part-of-output_data-into-platform-s.patch -new file mode 100644 -index 0000000..c5880e9 ---- /dev/null -+++ b/tools/depends/target/ffmpeg/0005-truehd-break-out-part-of-output_data-into-platform-s.patch -@@ -0,0 +1,197 @@ -+From 5bfcb7a691eb63c56f1485b60f399d79ff943799 Mon Sep 17 00:00:00 2001 -+From: Ben Avison -+Date: Wed, 12 Mar 2014 18:18:39 +0000 -+Subject: [PATCH 5/6] truehd: break out part of output_data into -+ platform-specific callback. -+ -+Verified with profiling that this doesn't have a measurable effect upon -+overall performance. -+--- -+ libavcodec/mlpdec.c | 40 +++++++++++++++++++++++----------------- -+ libavcodec/mlpdsp.c | 38 ++++++++++++++++++++++++++++++++++++++ -+ libavcodec/mlpdsp.h | 22 ++++++++++++++++++++++ -+ 3 files changed, 83 insertions(+), 17 deletions(-) -+ -+diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c -+index 01ded5c..061dabc 100644 -+--- a/libavcodec/mlpdec.c -++++ b/libavcodec/mlpdec.c -+@@ -363,6 +363,10 @@ static int read_major_sync(MLPDecodeContext *m, GetBitContext *gb) -+ m->avctx->sample_fmt = AV_SAMPLE_FMT_S32; -+ else -+ m->avctx->sample_fmt = AV_SAMPLE_FMT_S16; -++ m->dsp.mlp_pack_output = m->dsp.mlp_select_pack_output(m->substream[m->max_decoded_substream].ch_assign, -++ m->substream[m->max_decoded_substream].output_shift, -++ m->substream[m->max_decoded_substream].max_matrix_channel, -++ m->avctx->sample_fmt == AV_SAMPLE_FMT_S32); -+ -+ m->params_valid = 1; -+ for (substr = 0; substr < MAX_SUBSTREAMS; substr++) -+@@ -612,6 +616,10 @@ FF_ENABLE_DEPRECATION_WARNINGS -+ if (substr == m->max_decoded_substream) { -+ m->avctx->channels = s->max_matrix_channel + 1; -+ m->avctx->channel_layout = s->ch_layout; -++ m->dsp.mlp_pack_output = m->dsp.mlp_select_pack_output(s->ch_assign, -++ s->output_shift, -++ s->max_matrix_channel, -++ m->avctx->sample_fmt == AV_SAMPLE_FMT_S32); -+ -+ if (m->avctx->codec_id == AV_CODEC_ID_MLP && m->needs_reordering) { -+ if (m->avctx->channel_layout == (AV_CH_LAYOUT_QUAD|AV_CH_LOW_FREQUENCY) || -+@@ -857,9 +865,15 @@ static int read_decoding_params(MLPDecodeContext *m, GetBitContext *gbp, -+ return ret; -+ -+ if (s->param_presence_flags & PARAM_OUTSHIFT) -+- if (get_bits1(gbp)) -++ if (get_bits1(gbp)) { -+ for (ch = 0; ch <= s->max_matrix_channel; ch++) -+ s->output_shift[ch] = get_sbits(gbp, 4); -++ if (substr == m->max_decoded_substream) -++ m->dsp.mlp_pack_output = m->dsp.mlp_select_pack_output(s->ch_assign, -++ s->output_shift, -++ s->max_matrix_channel, -++ m->avctx->sample_fmt == AV_SAMPLE_FMT_S32); -++ } -+ -+ if (s->param_presence_flags & PARAM_QUANTSTEP) -+ if (get_bits1(gbp)) -+@@ -1058,9 +1072,6 @@ static int output_data(MLPDecodeContext *m, unsigned int substr, -+ { -+ AVCodecContext *avctx = m->avctx; -+ SubStream *s = &m->substream[substr]; -+- unsigned int i, out_ch = 0; -+- int32_t *data_32; -+- int16_t *data_16; -+ int ret; -+ int is32 = (m->avctx->sample_fmt == AV_SAMPLE_FMT_S32); -+ -+@@ -1078,19 +1089,14 @@ static int output_data(MLPDecodeContext *m, unsigned int substr, -+ frame->nb_samples = s->blockpos; -+ if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) -+ return ret; -+- data_32 = (int32_t *)frame->data[0]; -+- data_16 = (int16_t *)frame->data[0]; -+- -+- for (i = 0; i < s->blockpos; i++) { -+- for (out_ch = 0; out_ch <= s->max_matrix_channel; out_ch++) { -+- int mat_ch = s->ch_assign[out_ch]; -+- int32_t sample = m->sample_buffer[i][mat_ch] -+- << s->output_shift[mat_ch]; -+- s->lossless_check_data ^= (sample & 0xffffff) << mat_ch; -+- if (is32) *data_32++ = sample << 8; -+- else *data_16++ = sample >> 8; -+- } -+- } -++ s->lossless_check_data = m->dsp.mlp_pack_output(s->lossless_check_data, -++ s->blockpos, -++ m->sample_buffer, -++ frame->data[0], -++ s->ch_assign, -++ s->output_shift, -++ s->max_matrix_channel, -++ is32); -+ -+ /* Update matrix encoding side data */ -+ if ((ret = ff_side_data_update_matrix_encoding(frame, s->matrix_encoding)) < 0) -+diff --git a/libavcodec/mlpdsp.c b/libavcodec/mlpdsp.c -+index 7a359b0..3ae8c37 100644 -+--- a/libavcodec/mlpdsp.c -++++ b/libavcodec/mlpdsp.c -+@@ -89,10 +89,48 @@ void ff_mlp_rematrix_channel(int32_t *samples, -+ } -+ } -+ -++static int32_t (*mlp_select_pack_output(uint8_t *ch_assign, -++ int8_t *output_shift, -++ uint8_t max_matrix_channel, -++ int is32))(int32_t, uint16_t, int32_t (*)[], void *, uint8_t*, int8_t *, uint8_t, int) -++{ -++ return ff_mlp_pack_output; -++} -++ -++int32_t ff_mlp_pack_output(int32_t lossless_check_data, -++ uint16_t blockpos, -++ int32_t (*sample_buffer)[MAX_CHANNELS], -++ void *data, -++ uint8_t *ch_assign, -++ int8_t *output_shift, -++ uint8_t max_matrix_channel, -++ int is32) -++{ -++ unsigned int i, out_ch = 0; -++ int32_t *data_32 = data; -++ int16_t *data_16 = data; -++ -++ for (i = 0; i < blockpos; i++) { -++ for (out_ch = 0; out_ch <= max_matrix_channel; out_ch++) { -++ int mat_ch = ch_assign[out_ch]; -++ int32_t sample = sample_buffer[i][mat_ch] -++ << output_shift[mat_ch]; -++ lossless_check_data ^= (sample & 0xffffff) << mat_ch; -++ if (is32) -++ *data_32++ = sample << 8; -++ else -++ *data_16++ = sample >> 8; -++ } -++ } -++ return lossless_check_data; -++} -++ -+ av_cold void ff_mlpdsp_init(MLPDSPContext *c) -+ { -+ c->mlp_filter_channel = mlp_filter_channel; -+ c->mlp_rematrix_channel = ff_mlp_rematrix_channel; -++ c->mlp_select_pack_output = mlp_select_pack_output; -++ c->mlp_pack_output = ff_mlp_pack_output; -+ if (ARCH_ARM) -+ ff_mlpdsp_init_arm(c); -+ if (ARCH_X86) -+diff --git a/libavcodec/mlpdsp.h b/libavcodec/mlpdsp.h -+index f98e9be..a0edeb7 100644 -+--- a/libavcodec/mlpdsp.h -++++ b/libavcodec/mlpdsp.h -+@@ -23,6 +23,7 @@ -+ #define AVCODEC_MLPDSP_H -+ -+ #include -++#include "mlp.h" -+ -+ void ff_mlp_rematrix_channel(int32_t *samples, -+ const int32_t *coeffs, -+@@ -36,6 +37,15 @@ void ff_mlp_rematrix_channel(int32_t *samples, -+ int access_unit_size_pow2, -+ int32_t mask); -+ -++int32_t ff_mlp_pack_output(int32_t lossless_check_data, -++ uint16_t blockpos, -++ int32_t (*sample_buffer)[MAX_CHANNELS], -++ void *data, -++ uint8_t *ch_assign, -++ int8_t *output_shift, -++ uint8_t max_matrix_channel, -++ int is32); -++ -+ typedef struct MLPDSPContext { -+ void (*mlp_filter_channel)(int32_t *state, const int32_t *coeff, -+ int firorder, int iirorder, -+@@ -52,6 +62,18 @@ typedef struct MLPDSPContext { -+ int matrix_noise_shift, -+ int access_unit_size_pow2, -+ int32_t mask); -++ int32_t (*(*mlp_select_pack_output)(uint8_t *ch_assign, -++ int8_t *output_shift, -++ uint8_t max_matrix_channel, -++ int is32))(int32_t, uint16_t, int32_t (*)[], void *, uint8_t*, int8_t *, uint8_t, int); -++ int32_t (*mlp_pack_output)(int32_t lossless_check_data, -++ uint16_t blockpos, -++ int32_t (*sample_buffer)[MAX_CHANNELS], -++ void *data, -++ uint8_t *ch_assign, -++ int8_t *output_shift, -++ uint8_t max_matrix_channel, -++ int is32); -+ } MLPDSPContext; -+ -+ void ff_mlpdsp_init(MLPDSPContext *c); -+-- -+1.9.1 -diff --git a/tools/depends/target/ffmpeg/0006-truehd-add-hand-scheduled-ARM-asm-version-of-ff_mlp_.patch b/tools/depends/target/ffmpeg/0006-truehd-add-hand-scheduled-ARM-asm-version-of-ff_mlp_.patch -new file mode 100644 -index 0000000..93add62 ---- /dev/null -+++ b/tools/depends/target/ffmpeg/0006-truehd-add-hand-scheduled-ARM-asm-version-of-ff_mlp_.patch -@@ -0,0 +1,689 @@ -+From c647209386bd811cc1c33b4fc8ec17a00f8c8ded Mon Sep 17 00:00:00 2001 -+From: Ben Avison -+Date: Thu, 13 Mar 2014 00:21:55 +0000 -+Subject: [PATCH 6/6] truehd: add hand-scheduled ARM asm version of -+ ff_mlp_pack_output. -+ -+Profiling results for overall decode and the output_data function in -+particular are as follows: -+ -+ Before After -+ Mean StdDev Mean StdDev Confidence Change -+6:2 total 339.6 15.1 329.3 16.0 95.8% +3.1% (insignificant) -+6:2 function 24.6 6.0 9.9 3.1 100.0% +148.5% -+8:2 total 324.5 15.5 323.6 14.3 15.2% +0.3% (insignificant) -+8:2 function 20.4 3.9 9.9 3.4 100.0% +104.7% -+6:6 total 572.8 20.6 539.9 24.2 100.0% +6.1% -+6:6 function 54.5 5.6 16.0 3.8 100.0% +240.9% -+8:8 total 741.5 21.2 702.5 18.5 100.0% +5.6% -+8:8 function 63.9 7.6 18.4 4.8 100.0% +247.3% -+ -+The assembly version has also been tested with a fuzz tester to ensure that -+any combinations of inputs not exercised by my available test streams still -+generate mathematically identical results to the C version. -+--- -+ libavcodec/arm/Makefile | 1 + -+ libavcodec/arm/mlpdsp_armv6.S | 530 +++++++++++++++++++++++++++++++++++++++ -+ libavcodec/arm/mlpdsp_init_arm.c | 96 +++++++ -+ 3 files changed, 627 insertions(+) -+ create mode 100644 libavcodec/arm/mlpdsp_armv6.S -+ -+diff --git a/libavcodec/arm/Makefile b/libavcodec/arm/Makefile -+index ba673b1..7b2f923 100644 -+--- a/libavcodec/arm/Makefile -++++ b/libavcodec/arm/Makefile -+@@ -52,6 +52,7 @@ ARMV6-OBJS-$(CONFIG_AC3DSP) += arm/ac3dsp_armv6.o -+ ARMV6-OBJS-$(CONFIG_H264DSP) += arm/h264dsp_armv6.o -+ ARMV6-OBJS-$(CONFIG_HPELDSP) += arm/hpeldsp_init_armv6.o \ -+ arm/hpeldsp_armv6.o -++ARMV6-OBJS-$(CONFIG_MLP_DECODER) += arm/mlpdsp_armv6.o -+ ARMV6-OBJS-$(CONFIG_MPEGAUDIODSP) += arm/mpegaudiodsp_fixed_armv6.o -+ ARMV6-OBJS-$(CONFIG_VP8_DECODER) += arm/vp8_armv6.o \ -+ arm/vp8dsp_init_armv6.o \ -+diff --git a/libavcodec/arm/mlpdsp_armv6.S b/libavcodec/arm/mlpdsp_armv6.S -+new file mode 100644 -+index 0000000..05a2c85 -+--- /dev/null -++++ b/libavcodec/arm/mlpdsp_armv6.S -+@@ -0,0 +1,530 @@ -++/* -++ * Copyright (c) 2014 RISC OS Open Ltd -++ * Author: Ben Avison -++ * -++ * This file is part of FFmpeg. -++ * -++ * FFmpeg is free software; you can redistribute it and/or -++ * modify it under the terms of the GNU Lesser General Public -++ * License as published by the Free Software Foundation; either -++ * version 2.1 of the License, or (at your option) any later version. -++ * -++ * FFmpeg 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 -++ * Lesser General Public License for more details. -++ * -++ * You should have received a copy of the GNU Lesser General Public -++ * License along with FFmpeg; if not, write to the Free Software -++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -++ */ -++ -++#include "libavutil/arm/asm.S" -++ -++.macro loadregoffsh2 group, index, base, offgroup, offindex -++ .altmacro -++ loadregoffsh2_ \group, %(\index), \base, \offgroup, %(\offindex) -++ .noaltmacro -++.endm -++ -++.macro loadregoffsh2_ group, index, base, offgroup, offindex -++ ldr \group\index, [\base, \offgroup\offindex, lsl #2] -++.endm -++ -++.macro eorlslreg check, data, group, index -++ .altmacro -++ eorlslreg_ \check, \data, \group, %(\index) -++ .noaltmacro -++.endm -++ -++.macro eorlslreg_ check, data, group, index -++ eor \check, \check, \data, lsl \group\index -++.endm -++ -++.macro decr_modulo var, by, modulus -++ .set \var, \var - \by -++ .if \var == 0 -++ .set \var, \modulus -++ .endif -++.endm -++ -++ .macro load_group1 size, channels, r0, r1, r2, r3, pointer_dead=0 -++ .if \size == 2 -++ ldrd \r0, \r1, [IN], #(\size + 8 - \channels) * 4 -++ .else // size == 4 -++ .if IDX1 > 4 || \channels==8 -++ ldm IN!, {\r0, \r1, \r2, \r3} -++ .else -++ ldm IN, {\r0, \r1, \r2, \r3} -++ .if !\pointer_dead -++ add IN, IN, #(4 + 8 - \channels) * 4 -++ .endif -++ .endif -++ .endif -++ decr_modulo IDX1, \size, \channels -++ .endm -++ -++ .macro load_group2 size, channels, r0, r1, r2, r3, pointer_dead=0 -++ .if \size == 2 -++ .if IDX1 > 2 -++ ldm IN!, {\r2, \r3} -++ .else -++//A .ifc \r2, ip -++//A .if \pointer_dead -++//A ldm IN, {\r2, \r3} -++//A .else -++//A ldr \r2, [IN], #4 -++//A ldr \r3, [IN], #(\size - 1 + 8 - \channels) * 4 -++//A .endif -++//A .else -++ ldrd \r2, \r3, [IN], #(\size + 8 - \channels) * 4 -++//A .endif -++ .endif -++ .endif -++ decr_modulo IDX1, \size, \channels -++ .endm -++ -++.macro implement_pack inorder, channels, shift -++.if \inorder -++.ifc \shift, mixed -++ -++CHECK .req a1 -++COUNT .req a2 -++IN .req a3 -++OUT .req a4 -++DAT0 .req v1 -++DAT1 .req v2 -++DAT2 .req v3 -++DAT3 .req v4 -++SHIFT0 .req v5 -++SHIFT1 .req v6 -++SHIFT2 .req sl -++SHIFT3 .req fp -++SHIFT4 .req ip -++SHIFT5 .req lr -++ -++ .macro output4words -++ .set SIZE_GROUP1, IDX1 -++ .if SIZE_GROUP1 > 4 -++ .set SIZE_GROUP1, 4 -++ .endif -++ .set SIZE_GROUP2, 4 - SIZE_GROUP1 -++ load_group1 SIZE_GROUP1, \channels, DAT0, DAT1, DAT2, DAT3 -++ load_group2 SIZE_GROUP2, \channels, DAT0, DAT1, DAT2, DAT3 -++ .if \channels == 2 -++ lsl DAT0, SHIFT0 -++ lsl DAT1, SHIFT1 -++ lsl DAT2, SHIFT0 -++ lsl DAT3, SHIFT1 -++ .elseif \channels == 6 -++ .if IDX2 == 6 -++ lsl DAT0, SHIFT0 -++ lsl DAT1, SHIFT1 -++ lsl DAT2, SHIFT2 -++ lsl DAT3, SHIFT3 -++ .elseif IDX2 == 2 -++ lsl DAT0, SHIFT4 -++ lsl DAT1, SHIFT5 -++ lsl DAT2, SHIFT0 -++ lsl DAT3, SHIFT1 -++ .else // IDX2 == 4 -++ lsl DAT0, SHIFT2 -++ lsl DAT1, SHIFT3 -++ lsl DAT2, SHIFT4 -++ lsl DAT3, SHIFT5 -++ .endif -++ .elseif \channels == 8 -++ .if IDX2 == 8 -++ uxtb SHIFT0, SHIFT4, ror #0 -++ uxtb SHIFT1, SHIFT4, ror #8 -++ uxtb SHIFT2, SHIFT4, ror #16 -++ uxtb SHIFT3, SHIFT4, ror #24 -++ .else -++ uxtb SHIFT0, SHIFT5, ror #0 -++ uxtb SHIFT1, SHIFT5, ror #8 -++ uxtb SHIFT2, SHIFT5, ror #16 -++ uxtb SHIFT3, SHIFT5, ror #24 -++ .endif -++ lsl DAT0, SHIFT0 -++ lsl DAT1, SHIFT1 -++ lsl DAT2, SHIFT2 -++ lsl DAT3, SHIFT3 -++ .endif -++ eor CHECK, CHECK, DAT0, lsr #8 - (\channels - IDX2) -++ eor CHECK, CHECK, DAT1, lsr #7 - (\channels - IDX2) -++ decr_modulo IDX2, 2, \channels -++ eor CHECK, CHECK, DAT2, lsr #8 - (\channels - IDX2) -++ eor CHECK, CHECK, DAT3, lsr #7 - (\channels - IDX2) -++ decr_modulo IDX2, 2, \channels -++ stm OUT!, {DAT0 - DAT3} -++ .endm -++ -++ .set WORDS_PER_LOOP, \channels // calculate LCM (channels, 4) -++ .if (WORDS_PER_LOOP % 2) == 0 -++ .set WORDS_PER_LOOP, WORDS_PER_LOOP / 2 -++ .endif -++ .if (WORDS_PER_LOOP % 2) == 0 -++ .set WORDS_PER_LOOP, WORDS_PER_LOOP / 2 -++ .endif -++ .set WORDS_PER_LOOP, WORDS_PER_LOOP * 4 -++ .set SAMPLES_PER_LOOP, WORDS_PER_LOOP / \channels -++ -++function ff_mlp_pack_output_inorder_\channels\()ch_mixedshift_armv6, export=1 -++ .if SAMPLES_PER_LOOP > 1 -++ tst COUNT, #SAMPLES_PER_LOOP - 1 // always seems to be in practice -++ bne X(ff_mlp_pack_output) // but just in case, branch to C implementation if not -++ .endif -++ teq COUNT, #0 -++ it eq -++ bxeq lr -++ push {v1-v6,sl,fp,lr} -++ ldr SHIFT0, [sp, #(9+1)*4] // get output_shift from stack -++ ldr SHIFT1, =0x08080808 -++ ldr SHIFT4, [SHIFT0] -++ .if \channels == 2 -++ uadd8 SHIFT4, SHIFT4, SHIFT1 // increase all shifts by 8 -++ uxtb SHIFT0, SHIFT4, ror #0 -++ uxtb SHIFT1, SHIFT4, ror #8 -++ .else -++ ldr SHIFT5, [SHIFT0, #4] -++ uadd8 SHIFT4, SHIFT4, SHIFT1 // increase all shifts by 8 -++ uadd8 SHIFT5, SHIFT5, SHIFT1 -++ .if \channels == 6 -++ uxtb SHIFT0, SHIFT4, ror #0 -++ uxtb SHIFT1, SHIFT4, ror #8 -++ uxtb SHIFT2, SHIFT4, ror #16 -++ uxtb SHIFT3, SHIFT4, ror #24 -++ uxtb SHIFT4, SHIFT5, ror #0 -++ uxtb SHIFT5, SHIFT5, ror #8 -++ .endif -++ .endif -++ .set IDX1, \channels -++ .set IDX2, \channels -++0: -++ .rept WORDS_PER_LOOP / 4 -++ output4words -++ .endr -++ subs COUNT, COUNT, #SAMPLES_PER_LOOP -++ bne 0b -++ pop {v1-v6,sl,fp,pc} -++ .ltorg -++endfunc -++ .purgem output4words -++ -++ .unreq CHECK -++ .unreq COUNT -++ .unreq IN -++ .unreq OUT -++ .unreq DAT0 -++ .unreq DAT1 -++ .unreq DAT2 -++ .unreq DAT3 -++ .unreq SHIFT0 -++ .unreq SHIFT1 -++ .unreq SHIFT2 -++ .unreq SHIFT3 -++ .unreq SHIFT4 -++ .unreq SHIFT5 -++ -++.else // not mixed -++ -++CHECK .req a1 -++COUNT .req a2 -++IN .req a3 -++OUT .req a4 -++DAT0 .req v1 -++DAT1 .req v2 -++DAT2 .req v3 -++DAT3 .req v4 -++DAT4 .req v5 -++DAT5 .req v6 -++DAT6 .req sl // use these rather than the otherwise unused -++DAT7 .req fp // ip and lr so that we can load them usinf LDRD -++ -++ .macro output4words tail, head, r0, r1, r2, r3, r4, r5, r6, r7, pointer_dead=0 -++ .if \head -++ .set SIZE_GROUP1, IDX1 -++ .if SIZE_GROUP1 > 4 -++ .set SIZE_GROUP1, 4 -++ .endif -++ .set SIZE_GROUP2, 4 - SIZE_GROUP1 -++ load_group1 SIZE_GROUP1, \channels, \r0, \r1, \r2, \r3, \pointer_dead -++ .endif -++ .if \tail -++ eor CHECK, CHECK, \r4, lsr #8 - (\channels - IDX2) -++ eor CHECK, CHECK, \r5, lsr #7 - (\channels - IDX2) -++ decr_modulo IDX2, 2, \channels -++ .endif -++ .if \head -++ load_group2 SIZE_GROUP2, \channels, \r0, \r1, \r2, \r3, \pointer_dead -++ .endif -++ .if \tail -++ eor CHECK, CHECK, \r6, lsr #8 - (\channels - IDX2) -++ eor CHECK, CHECK, \r7, lsr #7 - (\channels - IDX2) -++ decr_modulo IDX2, 2, \channels -++ stm OUT!, {\r4, \r5, \r6, \r7} -++ .endif -++ .if \head -++ lsl \r0, #8 + \shift -++ lsl \r1, #8 + \shift -++ lsl \r2, #8 + \shift -++ lsl \r3, #8 + \shift -++ .endif -++ .endm -++ -++ .set WORDS_PER_LOOP, \channels // calculate LCM (channels, 8) -++ .if (WORDS_PER_LOOP % 2) == 0 -++ .set WORDS_PER_LOOP, WORDS_PER_LOOP / 2 -++ .endif -++ .if (WORDS_PER_LOOP % 2) == 0 -++ .set WORDS_PER_LOOP, WORDS_PER_LOOP / 2 -++ .endif -++ .if (WORDS_PER_LOOP % 2) == 0 -++ .set WORDS_PER_LOOP, WORDS_PER_LOOP / 2 -++ .endif -++ .set WORDS_PER_LOOP, WORDS_PER_LOOP * 8 -++ .set SAMPLES_PER_LOOP, WORDS_PER_LOOP / \channels -++ -++function ff_mlp_pack_output_inorder_\channels\()ch_\shift\()shift_armv6, export=1 -++ .if SAMPLES_PER_LOOP > 1 -++ tst COUNT, #SAMPLES_PER_LOOP - 1 // always seems to be in practice -++ bne X(ff_mlp_pack_output) // but just in case, branch to C implementation if not -++ .endif -++ subs COUNT, COUNT, #SAMPLES_PER_LOOP -++ it lo -++ bxlo lr -++ push {v1-v6,sl,fp,lr} -++ .set IDX1, \channels -++ .set IDX2, \channels -++ output4words 0, 1, DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, DAT7 -++0: beq 1f -++ .rept WORDS_PER_LOOP / 8 -++ output4words 1, 1, DAT4, DAT5, DAT6, DAT7, DAT0, DAT1, DAT2, DAT3 -++ output4words 1, 1, DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, DAT7 -++ .endr -++ subs COUNT, COUNT, #SAMPLES_PER_LOOP -++ bne 0b -++1: -++ .rept WORDS_PER_LOOP / 8 - 1 -++ output4words 1, 1, DAT4, DAT5, DAT6, DAT7, DAT0, DAT1, DAT2, DAT3 -++ output4words 1, 1, DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, DAT7 -++ .endr -++ output4words 1, 1, DAT4, DAT5, DAT6, DAT7, DAT0, DAT1, DAT2, DAT3, pointer_dead=1 -++ output4words 1, 0, DAT0, DAT1, DAT2, DAT3, DAT4, DAT5, DAT6, DAT7 -++ pop {v1-v6,sl,fp,pc} -++endfunc -++ .purgem output4words -++ -++ .unreq CHECK -++ .unreq COUNT -++ .unreq IN -++ .unreq OUT -++ .unreq DAT0 -++ .unreq DAT1 -++ .unreq DAT2 -++ .unreq DAT3 -++ .unreq DAT4 -++ .unreq DAT5 -++ .unreq DAT6 -++ .unreq DAT7 -++ -++.endif // mixed -++.else // not inorder -++.ifc \shift, mixed -++ -++// This case not currently handled -++ -++.else // not mixed -++ -++#if !CONFIG_THUMB -++ -++CHECK .req a1 -++COUNT .req a2 -++IN .req a3 -++OUT .req a4 -++DAT0 .req v1 -++DAT1 .req v2 -++DAT2 .req v3 -++DAT3 .req v4 -++CHAN0 .req v5 -++CHAN1 .req v6 -++CHAN2 .req sl -++CHAN3 .req fp -++CHAN4 .req ip -++CHAN5 .req lr -++ -++ .macro output4words -++ .if \channels == 8 -++ .if IDX1 == 8 -++ uxtb CHAN0, CHAN4, ror #0 -++ uxtb CHAN1, CHAN4, ror #8 -++ uxtb CHAN2, CHAN4, ror #16 -++ uxtb CHAN3, CHAN4, ror #24 -++ .else -++ uxtb CHAN0, CHAN5, ror #0 -++ uxtb CHAN1, CHAN5, ror #8 -++ uxtb CHAN2, CHAN5, ror #16 -++ uxtb CHAN3, CHAN5, ror #24 -++ .endif -++ ldr DAT0, [IN, CHAN0, lsl #2] -++ ldr DAT1, [IN, CHAN1, lsl #2] -++ ldr DAT2, [IN, CHAN2, lsl #2] -++ ldr DAT3, [IN, CHAN3, lsl #2] -++ .if IDX1 == 4 -++ add IN, IN, #8*4 -++ .endif -++ decr_modulo IDX1, 4, \channels -++ .else -++ .set SIZE_GROUP1, IDX1 -++ .if SIZE_GROUP1 > 4 -++ .set SIZE_GROUP1, 4 -++ .endif -++ .set SIZE_GROUP2, 4 - SIZE_GROUP1 -++ .if SIZE_GROUP1 == 2 -++ loadregoffsh2 DAT, 0, IN, CHAN, 0 + (\channels - IDX1) -++ loadregoffsh2 DAT, 1, IN, CHAN, 1 + (\channels - IDX1) -++ add IN, IN, #8*4 -++ .else // SIZE_GROUP1 == 4 -++ loadregoffsh2 DAT, 0, IN, CHAN, 0 + (\channels - IDX1) -++ loadregoffsh2 DAT, 1, IN, CHAN, 1 + (\channels - IDX1) -++ loadregoffsh2 DAT, 2, IN, CHAN, 2 + (\channels - IDX1) -++ loadregoffsh2 DAT, 3, IN, CHAN, 3 + (\channels - IDX1) -++ .if IDX1 == 4 -++ add IN, IN, #8*4 -++ .endif -++ .endif -++ decr_modulo IDX1, SIZE_GROUP1, \channels -++ .if SIZE_GROUP2 == 2 -++ loadregoffsh2 DAT, 2, IN, CHAN, 0 + (\channels - IDX1) -++ loadregoffsh2 DAT, 3, IN, CHAN, 1 + (\channels - IDX1) -++ .if IDX1 == 2 -++ add IN, IN, #8*4 -++ .endif -++ .endif -++ decr_modulo IDX1, SIZE_GROUP2, \channels -++ .endif -++ .if \channels == 8 // in this case we can corrupt CHAN0-3 -++ rsb CHAN0, CHAN0, #8 -++ rsb CHAN1, CHAN1, #8 -++ rsb CHAN2, CHAN2, #8 -++ rsb CHAN3, CHAN3, #8 -++ lsl DAT0, #8 + \shift -++ lsl DAT1, #8 + \shift -++ lsl DAT2, #8 + \shift -++ lsl DAT3, #8 + \shift -++ eor CHECK, CHECK, DAT0, lsr CHAN0 -++ eor CHECK, CHECK, DAT1, lsr CHAN1 -++ eor CHECK, CHECK, DAT2, lsr CHAN2 -++ eor CHECK, CHECK, DAT3, lsr CHAN3 -++ .else -++ .if \shift != 0 -++ lsl DAT0, #\shift -++ lsl DAT1, #\shift -++ lsl DAT2, #\shift -++ lsl DAT3, #\shift -++ .endif -++ bic DAT0, DAT0, #0xff000000 -++ bic DAT1, DAT1, #0xff000000 -++ bic DAT2, DAT2, #0xff000000 -++ bic DAT3, DAT3, #0xff000000 -++ eorlslreg CHECK, DAT0, CHAN, 0 + (\channels - IDX2) -++ eorlslreg CHECK, DAT1, CHAN, 1 + (\channels - IDX2) -++ decr_modulo IDX2, 2, \channels -++ eorlslreg CHECK, DAT2, CHAN, 0 + (\channels - IDX2) -++ eorlslreg CHECK, DAT3, CHAN, 1 + (\channels - IDX2) -++ decr_modulo IDX2, 2, \channels -++ lsl DAT0, #8 -++ lsl DAT1, #8 -++ lsl DAT2, #8 -++ lsl DAT3, #8 -++ .endif -++ stm OUT!, {DAT0 - DAT3} -++ .endm -++ -++ .set WORDS_PER_LOOP, \channels // calculate LCM (channels, 4) -++ .if (WORDS_PER_LOOP % 2) == 0 -++ .set WORDS_PER_LOOP, WORDS_PER_LOOP / 2 -++ .endif -++ .if (WORDS_PER_LOOP % 2) == 0 -++ .set WORDS_PER_LOOP, WORDS_PER_LOOP / 2 -++ .endif -++ .set WORDS_PER_LOOP, WORDS_PER_LOOP * 4 -++ .set SAMPLES_PER_LOOP, WORDS_PER_LOOP / \channels -++ -++function ff_mlp_pack_output_outoforder_\channels\()ch_\shift\()shift_armv6, export=1 -++ .if SAMPLES_PER_LOOP > 1 -++ tst COUNT, #SAMPLES_PER_LOOP - 1 // always seems to be in practice -++ bne X(ff_mlp_pack_output) // but just in case, branch to C implementation if not -++ .endif -++ teq COUNT, #0 -++ it eq -++ bxeq lr -++ push {v1-v6,sl,fp,lr} -++ ldr CHAN0, [sp, #(9+0)*4] // get ch_assign from stack -++ ldr CHAN4, [CHAN0] -++ .if \channels == 2 -++ uxtb CHAN0, CHAN4, ror #0 -++ uxtb CHAN1, CHAN4, ror #8 -++ .else -++ ldr CHAN5, [CHAN0, #4] -++ .if \channels == 6 -++ uxtb CHAN0, CHAN4, ror #0 -++ uxtb CHAN1, CHAN4, ror #8 -++ uxtb CHAN2, CHAN4, ror #16 -++ uxtb CHAN3, CHAN4, ror #24 -++ uxtb CHAN4, CHAN5, ror #0 -++ uxtb CHAN5, CHAN5, ror #8 -++ .endif -++ .endif -++ .set IDX1, \channels -++ .set IDX2, \channels -++0: -++ .rept WORDS_PER_LOOP / 4 -++ output4words -++ .endr -++ subs COUNT, COUNT, #SAMPLES_PER_LOOP -++ bne 0b -++ pop {v1-v6,sl,fp,pc} -++ .ltorg -++endfunc -++ .purgem output4words -++ -++ .unreq CHECK -++ .unreq COUNT -++ .unreq IN -++ .unreq OUT -++ .unreq DAT0 -++ .unreq DAT1 -++ .unreq DAT2 -++ .unreq DAT3 -++ .unreq CHAN0 -++ .unreq CHAN1 -++ .unreq CHAN2 -++ .unreq CHAN3 -++ .unreq CHAN4 -++ .unreq CHAN5 -++ -++#endif // !CONFIG_THUMB -++ -++.endif // mixed -++.endif // inorder -++.endm // implement_pack -++ -++.macro pack_channels inorder, channels -++ implement_pack \inorder, \channels, 0 -++ implement_pack \inorder, \channels, 1 -++ implement_pack \inorder, \channels, 2 -++ implement_pack \inorder, \channels, 3 -++ implement_pack \inorder, \channels, 4 -++ implement_pack \inorder, \channels, 5 -++ implement_pack \inorder, \channels, mixed -++.endm -++ -++.macro pack_order inorder -++ pack_channels \inorder, 2 -++ pack_channels \inorder, 6 -++ pack_channels \inorder, 8 -++.endm -++ -++ pack_order 0 -++ pack_order 1 -+diff --git a/libavcodec/arm/mlpdsp_init_arm.c b/libavcodec/arm/mlpdsp_init_arm.c -+index 1bb2276..10ec316 100644 -+--- a/libavcodec/arm/mlpdsp_init_arm.c -++++ b/libavcodec/arm/mlpdsp_init_arm.c -+@@ -41,8 +41,104 @@ void ff_mlp_rematrix_channel_arm(int32_t *samples, -+ int access_unit_size_pow2, -+ int32_t mask); -+ -++#define DECLARE_PACK(order,channels,shift) \ -++ int32_t ff_mlp_pack_output_##order##order_##channels##ch_##shift##shift_armv6(int32_t, uint16_t, int32_t (*)[], void *, uint8_t*, int8_t *, uint8_t, int); -++#define ENUMERATE_PACK(order,channels,shift) \ -++ ff_mlp_pack_output_##order##order_##channels##ch_##shift##shift_armv6, -++#define PACK_CHANNELS(macro,order,channels) \ -++ macro(order,channels,0) \ -++ macro(order,channels,1) \ -++ macro(order,channels,2) \ -++ macro(order,channels,3) \ -++ macro(order,channels,4) \ -++ macro(order,channels,5) \ -++ macro(order,channels,mixed) -++#define PACK_ORDER(macro,order) \ -++ PACK_CHANNELS(macro,order,2) \ -++ PACK_CHANNELS(macro,order,6) \ -++ PACK_CHANNELS(macro,order,8) -++#define PACK_ALL(macro) \ -++ PACK_ORDER(macro,outof) \ -++ PACK_ORDER(macro,in) -++PACK_ALL(DECLARE_PACK) -++ -++#define ff_mlp_pack_output_outoforder_2ch_mixedshift_armv6 0 -++#define ff_mlp_pack_output_outoforder_6ch_mixedshift_armv6 0 -++#define ff_mlp_pack_output_outoforder_8ch_mixedshift_armv6 0 -++#if CONFIG_THUMB -++#define ff_mlp_pack_output_outoforder_2ch_0shift_armv6 0 -++#define ff_mlp_pack_output_outoforder_2ch_1shift_armv6 0 -++#define ff_mlp_pack_output_outoforder_2ch_2shift_armv6 0 -++#define ff_mlp_pack_output_outoforder_2ch_3shift_armv6 0 -++#define ff_mlp_pack_output_outoforder_2ch_4shift_armv6 0 -++#define ff_mlp_pack_output_outoforder_2ch_5shift_armv6 0 -++#define ff_mlp_pack_output_outoforder_6ch_0shift_armv6 0 -++#define ff_mlp_pack_output_outoforder_6ch_1shift_armv6 0 -++#define ff_mlp_pack_output_outoforder_6ch_2shift_armv6 0 -++#define ff_mlp_pack_output_outoforder_6ch_3shift_armv6 0 -++#define ff_mlp_pack_output_outoforder_6ch_4shift_armv6 0 -++#define ff_mlp_pack_output_outoforder_6ch_5shift_armv6 0 -++#define ff_mlp_pack_output_outoforder_8ch_0shift_armv6 0 -++#define ff_mlp_pack_output_outoforder_8ch_1shift_armv6 0 -++#define ff_mlp_pack_output_outoforder_8ch_2shift_armv6 0 -++#define ff_mlp_pack_output_outoforder_8ch_3shift_armv6 0 -++#define ff_mlp_pack_output_outoforder_8ch_4shift_armv6 0 -++#define ff_mlp_pack_output_outoforder_8ch_5shift_armv6 0 -++#endif -++ -++static int32_t (*mlp_select_pack_output_armv6(uint8_t *ch_assign, -++ int8_t *output_shift, -++ uint8_t max_matrix_channel, -++ int is32))(int32_t, uint16_t, int32_t (*)[], void *, uint8_t*, int8_t *, uint8_t, int) -++{ -++ int ch_index; -++ int shift = output_shift[0] < 0 || output_shift[0] > 5 ? 6 : output_shift[0]; -++ int inorder = 1; -++ static int32_t (*const routine[2*3*7])(int32_t, uint16_t, int32_t (*)[], void *, uint8_t*, int8_t *, uint8_t, int) = { -++ PACK_ALL(ENUMERATE_PACK) -++ }; -++ int i; -++ -++ if (!is32) // don't support 16-bit output (it's not used by TrueHD) -++ return ff_mlp_pack_output; -++ -++ switch (max_matrix_channel) { -++ case 1: -++ ch_index = 0; -++ break; -++ case 5: -++ ch_index = 1; -++ break; -++ case 7: -++ ch_index = 2; -++ break; -++ default: -++ return ff_mlp_pack_output; -++ } -++ -++ for (i = 0; i <= max_matrix_channel; i++) { -++ if (shift != 6 && output_shift[i] != shift) -++ shift = 6; // indicate mixed shifts -++ if (ch_assign[i] != i) -++ inorder = 0; -++ } -++#if CONFIG_THUMB -++ if (!inorder) -++ return ff_mlp_pack_output; // can't currently handle an order array except in ARM mode -++#else -++ if (shift == 6 && !inorder) -++ return ff_mlp_pack_output; // can't currently handle both an order array and a shift array -++#endif -++ -++ return routine[(inorder*3+ch_index)*7+shift]; -++} -++ -+ av_cold void ff_mlpdsp_init_arm(MLPDSPContext *c) -+ { -++ int cpu_flags = av_get_cpu_flags(); -++ -+ c->mlp_filter_channel = ff_mlp_filter_channel_arm; -+ c->mlp_rematrix_channel = ff_mlp_rematrix_channel_arm; -++ if (cpu_flags & AV_CPU_FLAG_ARMV6) -++ c->mlp_select_pack_output = mlp_select_pack_output_armv6; -+ } -+-- -+1.9.1 -diff --git a/tools/depends/target/ffmpeg/Makefile b/tools/depends/target/ffmpeg/Makefile -index 863ee41..b56fbdd 100644 ---- a/tools/depends/target/ffmpeg/Makefile -+++ b/tools/depends/target/ffmpeg/Makefile -@@ -2,8 +2,10 @@ include ../../Makefile.include - include FFMPEG-VERSION - DEPS= ../../Makefile.include FFMPEG-VERSION Makefile \ - ffmpeg_Speed_up_wtv_index_creation.patch 0001-h264-Move-search-code-search-functions-into-separate.patch \ -- 0002-vc-1-Add-platform-specific-start-code-search-routine.patch 0003-vc-1-Optimise-parser-with-special-attention-to-ARM.patch -- -+ 0002-vc-1-Add-platform-specific-start-code-search-routine.patch 0003-vc-1-Optimise-parser-with-special-attention-to-ARM.patch \ -+ 0001-truehd-tune-VLC-decoding-for-ARM.patch 0002-truehd-add-hand-scheduled-ARM-asm-version-of-mlp_fil.patch \ -+ 0003-truehd-break-out-part-of-rematrix_channels-into-plat.patch 0004-truehd-add-hand-scheduled-ARM-asm-version-of-ff_mlp_.patch \ -+ 0005-truehd-break-out-part-of-output_data-into-platform-s.patch 0006-truehd-add-hand-scheduled-ARM-asm-version-of-ff_mlp_.patch - - # set to "yes" to enable patching - # we don't apply patches until we move to a vanilla ffmpeg tarball -@@ -70,6 +72,13 @@ $(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS) - cd $(PLATFORM); patch -p1 < ../0001-h264-Move-search-code-search-functions-into-separate.patch - cd $(PLATFORM); patch -p1 < ../0002-vc-1-Add-platform-specific-start-code-search-routine.patch - cd $(PLATFORM); patch -p1 < ../0003-vc-1-Optimise-parser-with-special-attention-to-ARM.patch -+ cd $(PLATFORM); patch -p1 < ../0001-truehd-tune-VLC-decoding-for-ARM.patch -+ cd $(PLATFORM); patch -p1 < ../0002-truehd-add-hand-scheduled-ARM-asm-version-of-mlp_fil.patch -+ cd $(PLATFORM); patch -p1 < ../0003-truehd-break-out-part-of-rematrix_channels-into-plat.patch -+ cd $(PLATFORM); patch -p1 < ../0004-truehd-add-hand-scheduled-ARM-asm-version-of-ff_mlp_.patch -+ cd $(PLATFORM); patch -p1 < ../0005-truehd-break-out-part-of-output_data-into-platform-s.patch -+ cd $(PLATFORM); patch -p1 < ../0006-truehd-add-hand-scheduled-ARM-asm-version-of-ff_mlp_.patch -+ - cd $(PLATFORM);\ - CFLAGS="$(CFLAGS)" CXXFLAGS="$(CXXFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" \ - ./configure $(ffmpg_config) --- -1.9.3 - - -From cdb3f7900819d86cff4baa2dcd3867cb7f4d823e Mon Sep 17 00:00:00 2001 +From ce6b738cc6adcb7c1ad3afdb424e2bb9030c36a4 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 11 May 2014 16:13:45 +0100 -Subject: [PATCH 063/102] [rbp] Add config.txt settings to log file +Subject: [PATCH 57/99] [rbp] Add config.txt settings to log file --- xbmc/linux/RBP.cpp | 8 +++++++- @@ -13192,10 +9171,10 @@ index 49dcbb8..9a5e9cb 100644 1.9.3 -From 21731d0cbe70622a6510bc6feda029d1615db981 Mon Sep 17 00:00:00 2001 +From 7d9bf62df3890f417e124d7c9acb913a47a937b1 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 12 May 2014 23:06:43 +0100 -Subject: [PATCH 064/102] [omxcodec] Updates to work better with dropping and +Subject: [PATCH 58/99] [omxcodec] Updates to work better with dropping and lateness detection --- @@ -13487,10 +9466,10 @@ index f234f6d..adf53b5 100644 1.9.3 -From 089ed035143c22d05c5360d05a18b250b92192a7 Mon Sep 17 00:00:00 2001 +From 89a8ef38736a9bc529fd1bbad6c9bd5919a4992f Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 11 Apr 2014 16:12:27 +0100 -Subject: [PATCH 065/102] [omxplayer] Add ability to log more timestamp info in +Subject: [PATCH 59/99] [omxplayer] Add ability to log more timestamp info in extra debug settings --- @@ -13503,10 +9482,10 @@ Subject: [PATCH 065/102] [omxplayer] Add ability to log more timestamp info in 6 files changed, 44 insertions(+), 34 deletions(-) diff --git a/language/English/strings.po b/language/English/strings.po -index d386f68..a2c7215 100755 +index d56f687..86da213 100755 --- a/language/English/strings.po +++ b/language/English/strings.po -@@ -2871,6 +2871,11 @@ msgctxt "#679" +@@ -2879,6 +2879,11 @@ msgctxt "#679" msgid "Verbose logging for CEC library" msgstr "" @@ -13531,10 +9510,10 @@ index 4bf5d83..3fb7cc3 100644 #ifdef __GNUC__ #define ATTRIB_LOG_FORMAT __attribute__((format(printf,3,4))) diff --git a/xbmc/cores/omxplayer/OMXPlayer.cpp b/xbmc/cores/omxplayer/OMXPlayer.cpp -index ebb59d5..4e0662f 100644 +index 030d7b6..658b0a6 100644 --- a/xbmc/cores/omxplayer/OMXPlayer.cpp +++ b/xbmc/cores/omxplayer/OMXPlayer.cpp -@@ -1546,27 +1546,28 @@ void COMXPlayer::Process() +@@ -1545,27 +1545,28 @@ void COMXPlayer::Process() m_video_fifo = (int)(100.0*(m_omxPlayerVideo.GetDecoderBufferSize()-m_omxPlayerVideo.GetDecoderFreeSpace())/m_omxPlayerVideo.GetDecoderBufferSize()); m_audio_fifo = (int)(100.0*audio_fifo/m_omxPlayerAudio.GetCacheTotal()); @@ -13582,7 +9561,7 @@ index ebb59d5..4e0662f 100644 if (audio_pts != DVD_NOPTS_VALUE) { audio_fifo_low = m_HasAudio && audio_fifo < threshold; -@@ -1582,13 +1583,12 @@ void COMXPlayer::Process() +@@ -1581,13 +1582,12 @@ void COMXPlayer::Process() if (!m_HasVideo && m_HasAudio) video_fifo_high = true; @@ -13603,10 +9582,10 @@ index ebb59d5..4e0662f 100644 if (TP(m_playSpeed)) { diff --git a/xbmc/cores/omxplayer/OMXPlayerAudio.cpp b/xbmc/cores/omxplayer/OMXPlayerAudio.cpp -index d3348ec..02dd9be 100644 +index 4ed8d17..a4a491e 100644 --- a/xbmc/cores/omxplayer/OMXPlayerAudio.cpp +++ b/xbmc/cores/omxplayer/OMXPlayerAudio.cpp -@@ -364,10 +364,10 @@ void OMXPlayerAudio::Process() +@@ -366,10 +366,10 @@ void OMXPlayerAudio::Process() DemuxPacket* pPacket = ((CDVDMsgDemuxerPacket*)pMsg)->GetPacket(); bool bPacketDrop = ((CDVDMsgDemuxerPacket*)pMsg)->GetPacketDrop(); @@ -13622,7 +9601,7 @@ index d3348ec..02dd9be 100644 { // we are not running until something is cached in output device diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -index e6bf2d0..aa5ea43 100644 +index 77dad37..605ea80 100644 --- a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp +++ b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp @@ -42,6 +42,7 @@ @@ -13633,7 +9612,7 @@ index e6bf2d0..aa5ea43 100644 #include "settings/MediaSettings.h" #include "cores/VideoRenderers/RenderFormats.h" #include "cores/VideoRenderers/RenderFlags.h" -@@ -451,10 +452,10 @@ void OMXPlayerVideo::Process() +@@ -452,10 +453,10 @@ void OMXPlayerVideo::Process() DemuxPacket* pPacket = ((CDVDMsgDemuxerPacket*)pMsg)->GetPacket(); bool bPacketDrop = ((CDVDMsgDemuxerPacket*)pMsg)->GetPacketDrop(); @@ -13649,7 +9628,7 @@ index e6bf2d0..aa5ea43 100644 || m_speed < 0) { diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index 59b4d9e..e597a4e 100644 +index e41a935..90222f4 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp @@ -1386,6 +1386,9 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se @@ -13666,10 +9645,10 @@ index 59b4d9e..e597a4e 100644 1.9.3 -From 55725e4e4177382834f003c144aebf50000bf389 Mon Sep 17 00:00:00 2001 +From 456412b4f28b491891c35c4ffee6e8863588a878 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 7 Apr 2014 23:13:55 +0100 -Subject: [PATCH 066/102] [omxplayer] Add ability to dump out audio/video data +Subject: [PATCH 60/99] [omxplayer] Add ability to dump out audio/video data for later debugging --- @@ -13681,10 +9660,10 @@ Subject: [PATCH 066/102] [omxplayer] Add ability to dump out audio/video data 5 files changed, 112 insertions(+) diff --git a/language/English/strings.po b/language/English/strings.po -index a2c7215..9ba9565 100755 +index 86da213..3704baa 100755 --- a/language/English/strings.po +++ b/language/English/strings.po -@@ -2876,6 +2876,16 @@ msgctxt "#697" +@@ -2884,6 +2884,16 @@ msgctxt "#697" msgid "Verbose logging for OMXPLAYER" msgstr "" @@ -13896,7 +9875,7 @@ index 820ea44..6639804 100644 if (omx_err != OMX_ErrorNone) { diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp -index e597a4e..0530467 100644 +index 90222f4..1175eb1 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp @@ -1389,6 +1389,10 @@ void CAdvancedSettings::SettingOptionsLoggingComponentsFiller(const CSetting *se @@ -13914,10 +9893,10 @@ index e597a4e..0530467 100644 1.9.3 -From 0cdbd90db8f90e1f6dd9703b1c7646e7813d7d1f Mon Sep 17 00:00:00 2001 +From 9172ae4fef35d1990b2f8014cd8dd2fcf7434bfa Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 28 May 2014 18:30:51 +0100 -Subject: [PATCH 067/102] [omxcodec] Reduce GPU memory use by 2 video frames +Subject: [PATCH 61/99] [omxcodec] Reduce GPU memory use by 2 video frames --- xbmc/cores/dvdplayer/DVDCodecs/Video/OpenMaxVideo.cpp | 14 ++++++++++++++ @@ -13952,10 +9931,10 @@ index 612ae21..494fdf5 100644 1.9.3 -From 5f1289e7a8f03c67a50e626f87517daf15e35f25 Mon Sep 17 00:00:00 2001 +From 90e783513b7b242155d18eda21b72540338a5986 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 30 May 2014 14:15:10 +0100 -Subject: [PATCH 068/102] [pi] Fix for logged resolutions +Subject: [PATCH 62/99] [pi] Fix for logged resolutions --- xbmc/windowing/egl/EGLNativeTypeRaspberryPI.cpp | 15 +++++---------- @@ -14023,10 +10002,10 @@ index 5b26b20..a3edf0e 100644 1.9.3 -From 22f4be7399f9b9fc57cd735b498699a736cce6a7 Mon Sep 17 00:00:00 2001 +From 2ad66067f303d68a976ec56ed2f5be41a3479f72 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 30 May 2014 14:58:43 +0100 -Subject: [PATCH 069/102] [settings] Experiment: Report DESKTOP resolution in +Subject: [PATCH 63/99] [settings] Experiment: Report DESKTOP resolution in video settings --- @@ -14051,10 +10030,10 @@ index bb31f15..eae549b 100644 1.9.3 -From b8f5d4e406cf9934aa4e8a37880122d78c01f9b9 Mon Sep 17 00:00:00 2001 +From 042314a5a8336b7a4ff6789ce719ba3edb30bfee Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 7 Jun 2014 16:55:41 +0100 -Subject: [PATCH 070/102] [omx] Remove logging for texture jobs +Subject: [PATCH 64/99] [omx] Remove logging for texture jobs This causes a lot of log spam which hasn't proved useful so far. --- @@ -14062,10 +10041,10 @@ This causes a lot of log spam which hasn't proved useful so far. 1 file changed, 5 deletions(-) diff --git a/xbmc/cores/omxplayer/OMXImage.cpp b/xbmc/cores/omxplayer/OMXImage.cpp -index 262a004..d529b20 100644 +index 5889365..d2f6b21 100644 --- a/xbmc/cores/omxplayer/OMXImage.cpp +++ b/xbmc/cores/omxplayer/OMXImage.cpp -@@ -210,13 +210,11 @@ bool COMXImage::SendMessage(bool (*callback)(EGLDisplay egl_display, EGLContext +@@ -213,13 +213,11 @@ bool COMXImage::SendMessage(bool (*callback)(EGLDisplay egl_display, EGLContext mess.sync.Reset(); { CSingleLock lock(m_texqueue_lock); @@ -14079,7 +10058,7 @@ index 262a004..d529b20 100644 // need to ensure texture thread has returned from mess.sync.Set() before we exit and free tex CSingleLock lock(m_texqueue_lock); return mess.result; -@@ -429,15 +427,12 @@ void COMXImage::Process() +@@ -432,15 +430,12 @@ void COMXImage::Process() struct callbackinfo *mess = m_texqueue.front(); m_texqueue.pop(); lock.Leave(); @@ -14099,21 +10078,21 @@ index 262a004..d529b20 100644 1.9.3 -From a0a6be81a50eabf6e4f02df6ce11298c73287b74 Mon Sep 17 00:00:00 2001 +From c5d28ec1360f5507090deb8a01685dbc2e788b1b Mon Sep 17 00:00:00 2001 From: Matthias Kortstiege Date: Sun, 1 Jun 2014 18:47:20 +0200 -Subject: [PATCH 071/102] changed: avoid useless filesytem io while searching - for subtitles +Subject: [PATCH 65/99] changed: avoid useless filesytem io while searching for + subtitles --- xbmc/Util.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xbmc/Util.cpp b/xbmc/Util.cpp -index b33f142..4eabca6 100644 +index 20083fd..0d23820 100644 --- a/xbmc/Util.cpp +++ b/xbmc/Util.cpp -@@ -1988,7 +1988,7 @@ void CUtil::ScanForExternalSubtitles(const std::string& strMovie, std::vector Date: Wed, 4 Jun 2014 19:10:27 +0100 -Subject: [PATCH 072/102] [pisink] Support planar formats +Subject: [PATCH 66/99] [pisink] Support planar formats --- xbmc/cores/AudioEngine/Sinks/AESinkPi.cpp | 35 ++++++++++++++++++++++++++----- @@ -14238,10 +10217,10 @@ index 0a09275..5a45653 100644 1.9.3 -From 67509ae7eddc9143964d7ba5da9ab9632c6ac382 Mon Sep 17 00:00:00 2001 +From 0b99849f497bf1ee698522018347cdce4c656bdd Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 30 Dec 2013 12:02:14 +0000 -Subject: [PATCH 073/102] [rbp] Hardware accelerated resampling +Subject: [PATCH 67/99] [rbp] Hardware accelerated resampling This replaces the format conversion, up/down mixing and resampling code from ActiveAE with a GPU accelerated version. Should significantly reduce CPU when using paplayer or dvdplayer. @@ -15074,10 +11053,10 @@ index 99e407a..8d3c86a 100644 1.9.3 -From e32cc71fee0020cee3013e5ecf2f9b02cb25d45b Mon Sep 17 00:00:00 2001 +From 566bb44404b43245776fa0c97f6d4036dddb3ab4 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 1 Jun 2014 12:15:17 +0100 -Subject: [PATCH 074/102] [resamplepi] Support planar formats +Subject: [PATCH 68/99] [resamplepi] Support planar formats --- .../Engines/ActiveAE/ActiveAEResamplePi.cpp | 101 ++++++++++++--------- @@ -15277,10 +11256,10 @@ index 9a1e549..1604030 100644 1.9.3 -From 0c7fcb56fea44e24064788e2c6910ad961ed17c6 Mon Sep 17 00:00:00 2001 +From 550dc53b57021d6c29c8f0e0dc23789643f375cf Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 15 Jun 2014 13:20:53 +0100 -Subject: [PATCH 075/102] gles: Avoid crash when capturing snapshot when using +Subject: [PATCH 69/99] gles: Avoid crash when capturing snapshot when using dvdplayer Note: snapshot will be blank, but that's better than crashing @@ -15306,10 +11285,10 @@ index 2929a37..53873f6 100644 1.9.3 -From d7bcc5ae49d12b97a9da7c5572d5f555c98859ec Mon Sep 17 00:00:00 2001 +From 6b0003bb9a3c2449376a07aa3d8461f622e39af9 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 16 Jun 2014 19:05:14 +0100 -Subject: [PATCH 076/102] sqlite: Bump to 3080500 +Subject: [PATCH 70/99] sqlite: Bump to 3080500 --- tools/depends/target/sqlite3/Makefile | 4 +++- @@ -15334,10 +11313,10 @@ index 87f7eaa..8fe61e8 100644 1.9.3 -From 2b4f3f978406571d6dfb690ca4e282e3ee0c4b14 Mon Sep 17 00:00:00 2001 +From dcf091e7f5eaf365ef0670fde7a0db8ea1f84ae5 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 16 Jun 2014 19:06:00 +0100 -Subject: [PATCH 077/102] [experimental] Disable quiet-noise generation +Subject: [PATCH 71/99] [experimental] Disable quiet-noise generation --- xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAESink.cpp | 2 ++ @@ -15367,10 +11346,10 @@ index 488a0df..d9f4a43 100644 1.9.3 -From 05d761fea469710297870c52ac2e154cbcda5d9a Mon Sep 17 00:00:00 2001 +From 07cc88baecc7104213d5c83dae193323744b685e Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 16 Jun 2014 19:07:21 +0100 -Subject: [PATCH 078/102] [omxcodec] Adjust asserts +Subject: [PATCH 72/99] [omxcodec] Adjust asserts --- xbmc/cores/dvdplayer/DVDCodecs/Video/OpenMaxVideo.cpp | 11 +++++++---- @@ -15409,10 +11388,10 @@ index 494fdf5..23aaa9f 100644 1.9.3 -From 41df02172c24c4426e2dd755207710de63987623 Mon Sep 17 00:00:00 2001 +From 73a4d2fb59999726c9e906cf046e7dd262cf6eaa Mon Sep 17 00:00:00 2001 From: macrule Date: Thu, 11 Apr 2013 18:24:42 +0200 -Subject: [PATCH 079/102] Added some vc_tv_* functions that were missing in +Subject: [PATCH 73/99] Added some vc_tv_* functions that were missing in DllBCM. --- @@ -15450,10 +11429,10 @@ index b92fdb8..9c7e293 100644 1.9.3 -From 8e14d993da8f0614b70dabdbb59fcb4cc79b6bc5 Mon Sep 17 00:00:00 2001 +From 9760a28ec013598562927aa51cfc6957b1916712 Mon Sep 17 00:00:00 2001 From: macrule Date: Thu, 11 Apr 2013 18:29:03 +0200 -Subject: [PATCH 080/102] Added private utility function to map a float display +Subject: [PATCH 74/99] Added private utility function to map a float display aspect, to the respective SDTV_ASPECT_* enum value. --- @@ -15494,10 +11473,10 @@ index a3edf0e..5ae2b59 100644 1.9.3 -From 73eebd2deb7924d492f9ba2b817dc52edf849a60 Mon Sep 17 00:00:00 2001 +From aed09b5994072e7e0c6e9bacf761f9eb7f82769f Mon Sep 17 00:00:00 2001 From: macrule Date: Thu, 11 Apr 2013 19:50:58 +0200 -Subject: [PATCH 081/102] Changed SDTV resolutions to be treated similarly to +Subject: [PATCH 75/99] Changed SDTV resolutions to be treated similarly to HDMI resolutions in SetNativeResolution. This means that the SDTV interface is powered up and set to the right mode. @@ -15597,10 +11576,10 @@ index 59401f5..a0acb1a 100644 1.9.3 -From 6edef341b2d0207ef9d817c844731c46a25b54f1 Mon Sep 17 00:00:00 2001 +From c7907a1f7ade36d7d6ad7cc0b31bd00aa4af56ca Mon Sep 17 00:00:00 2001 From: macrule Date: Thu, 11 Apr 2013 19:54:59 +0200 -Subject: [PATCH 082/102] Added methods SuspendVideoOutput() and +Subject: [PATCH 76/99] Added methods SuspendVideoOutput() and ResumeVideoOutput() to CRBP class, which can be used to power down the Raspberry PI's video interface, and restore it at a later point. @@ -15667,12 +11646,12 @@ index 712fe9c..40d303e 100644 1.9.3 -From 42be8acb22868ef82db0b30d15dc2c0114656ea3 Mon Sep 17 00:00:00 2001 +From 56fc582a96b00749ecb470e99cb3fe05834fc294 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sun, 11 Aug 2013 15:03:36 +0100 -Subject: [PATCH 083/102] PowerManager (and its IPowerSyscall instance) now - gets called from CApplication::OnKey() and can process and suppress key - presses. This is a requirement to implement a virtual sleep state. +Subject: [PATCH 77/99] PowerManager (and its IPowerSyscall instance) now gets + called from CApplication::OnKey() and can process and suppress key presses. + This is a requirement to implement a virtual sleep state. --- xbmc/Application.cpp | 7 +++++++ @@ -15682,10 +11661,10 @@ Subject: [PATCH 083/102] PowerManager (and its IPowerSyscall instance) now 4 files changed, 23 insertions(+) diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index c9690fc..ce52040 100644 +index 749e3c0..8415123 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp -@@ -2347,6 +2347,13 @@ bool CApplication::OnKey(const CKey& key) +@@ -2369,6 +2369,13 @@ bool CApplication::OnKey(const CKey& key) // special handling if the screensaver is active CAction action = CButtonTranslator::GetInstance().GetAction(iWin, key); @@ -15766,12 +11745,12 @@ index 0b1f10a..e42b143 100644 1.9.3 -From 5e7c6707827476ddf7875f551eb1895de0046986 Mon Sep 17 00:00:00 2001 +From a8dd2b7a35760c9d5c251bf7a1a695d81f14bed2 Mon Sep 17 00:00:00 2001 From: macrule Date: Wed, 17 Apr 2013 13:23:01 +0200 -Subject: [PATCH 084/102] Added CPowerSyscallVirtualSleep class, which acts as - a base class for devices that have no native standby mode, and need to fake - it in some way. +Subject: [PATCH 78/99] Added CPowerSyscallVirtualSleep class, which acts as a + base class for devices that have no native standby mode, and need to fake it + in some way. --- xbmc/powermanagement/Makefile | 1 + @@ -15948,10 +11927,10 @@ index 0000000..ef6e682 1.9.3 -From bd85dcc014d0cfdbebeb1c118af5e33b7ac377a9 Mon Sep 17 00:00:00 2001 +From de43b0c0c8753091d5fad478684f44ce03dc04b6 Mon Sep 17 00:00:00 2001 From: macrule Date: Wed, 17 Apr 2013 13:24:22 +0200 -Subject: [PATCH 085/102] Added power management support for the Raspberry Pi. +Subject: [PATCH 79/99] Added power management support for the Raspberry Pi. Since it doesn't support true standby, we fake it by turning video on or off, and ignoring remote inputs during the standby phase. @@ -16101,10 +12080,10 @@ index 0000000..fd1d67c 1.9.3 -From ab50d8fcfe9c0e0fdb749ce7456a2ddbf58a8b45 Mon Sep 17 00:00:00 2001 +From 6eb17e4018ee5a5f8fb08bbf02d9f3e4f85cb51b Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 3 Mar 2014 16:16:29 +0000 -Subject: [PATCH 086/102] [power] hack - don't kill lirc or cec +Subject: [PATCH 80/99] [power] hack - don't kill lirc or cec --- xbmc/peripherals/devices/PeripheralCecAdapter.cpp | 37 +++++++++++++++++++++++ @@ -16191,10 +12170,10 @@ index 7dd691c..17f118a 100644 1.9.3 -From 18db33d3f1fe0f10f1dec1979f27d08c72a1a5b2 Mon Sep 17 00:00:00 2001 +From dcf386bf37dd9ac82da59f2007243f195e7a54fe Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 3 Mar 2014 16:47:54 +0000 -Subject: [PATCH 087/102] [power] hack - wake on any action +Subject: [PATCH 81/99] [power] hack - wake on any action --- xbmc/powermanagement/PowerSyscallVirtualSleep.cpp | 6 +++--- @@ -16226,10 +12205,10 @@ index 6a1e47b..a717a09 100644 1.9.3 -From 61a6f6564b85012f9c6666b3d9f5ccb2299ae138 Mon Sep 17 00:00:00 2001 +From c96538abd2449886b50ed185d19c6e0e3196aef3 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Mon, 3 Mar 2014 17:30:07 +0000 -Subject: [PATCH 088/102] [power] hack - Make suspend toggle suspend state +Subject: [PATCH 82/99] [power] hack - Make suspend toggle suspend state --- xbmc/powermanagement/PowerSyscallVirtualSleep.cpp | 5 +++++ @@ -16255,10 +12234,10 @@ index a717a09..d39c3ed 100644 1.9.3 -From 9d8ab89dc5dec5b3d2c7a42f0875eda5761b3320 Mon Sep 17 00:00:00 2001 +From d76e483f4d9ba20926fe600dc0336a8a04b0e2a7 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 4 Mar 2014 19:33:44 +0000 -Subject: [PATCH 089/102] [power] Add back in powerdown and reboot +Subject: [PATCH 83/99] [power] Add back in powerdown and reboot --- .../linux/RaspberryPIPowerSyscall.cpp | 34 ++++++++++++++++++++++ @@ -16339,10 +12318,10 @@ index fd1d67c..062132e 100644 1.9.3 -From 251012ede3883268a585bc4d3fe11c4d9e782d67 Mon Sep 17 00:00:00 2001 +From 5a0fe21fd2e50f7a17eeb6f5be38699137807366 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 18 Jun 2014 23:11:28 +0100 -Subject: [PATCH 090/102] [rbp] Reduce GPU memory use when limited +Subject: [PATCH 84/99] [rbp] Reduce GPU memory use when limited Switching from default triple buffered output to double buffered saves 8M with 1080p GUI. This may slightly reduce framerate, but is likely to be minimal. @@ -16370,271 +12349,10 @@ index 87619e9..9f72a36 100644 1.9.3 -From a8bb89d0dba9cac1bd738043355e3364a098f089 Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Thu, 19 Jun 2014 18:44:10 +0100 -Subject: [PATCH 091/102] ActiveAE: Add queries to determine number of channels - output - ---- - xbmc/cores/AudioEngine/AEFactory.cpp | 14 ++++++++++++++ - xbmc/cores/AudioEngine/AEFactory.h | 2 ++ - xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp | 17 +++++++++++++++++ - xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h | 2 ++ - xbmc/cores/AudioEngine/Interfaces/AE.h | 12 ++++++++++++ - 5 files changed, 47 insertions(+) - -diff --git a/xbmc/cores/AudioEngine/AEFactory.cpp b/xbmc/cores/AudioEngine/AEFactory.cpp -index fe8d51c..cccf7f1 100644 ---- a/xbmc/cores/AudioEngine/AEFactory.cpp -+++ b/xbmc/cores/AudioEngine/AEFactory.cpp -@@ -216,6 +216,20 @@ bool CAEFactory::SupportsSilenceTimeout() - return false; - } - -+bool CAEFactory::IsStereoConfig() -+{ -+ if(AE) -+ return AE->IsStereoConfig(); -+ return false; -+} -+ -+bool CAEFactory::IsNotHDAudioConfig() -+{ -+ if(AE) -+ return AE->IsNotHDAudioConfig(); -+ return false; -+} -+ - /** - * Returns true if current AudioEngine supports at lest two basic quality levels - * @return true if quality setting is supported, otherwise false -diff --git a/xbmc/cores/AudioEngine/AEFactory.h b/xbmc/cores/AudioEngine/AEFactory.h -index 1d8bf36..658997b 100644 ---- a/xbmc/cores/AudioEngine/AEFactory.h -+++ b/xbmc/cores/AudioEngine/AEFactory.h -@@ -54,6 +54,8 @@ class CAEFactory - static std::string GetDefaultDevice(bool passthrough); - static bool SupportsRaw(AEDataFormat format, int samplerate); - static bool SupportsSilenceTimeout(); -+ static bool IsStereoConfig(); -+ static bool IsNotHDAudioConfig(); - - /** - * Returns true if current AudioEngine supports at lest two basic quality levels -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -index 3ac182a..5820a5d 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.cpp -@@ -2251,6 +2251,23 @@ bool CActiveAE::SupportsSilenceTimeout() - return true; - } - -+bool CActiveAE::IsStereoConfig() -+{ -+ std:string device = CSettings::Get().GetString("audiooutput.audiodevice"); -+ int numChannels = (m_sink.GetDeviceType(device) == AE_DEVTYPE_IEC958) ? AE_CH_LAYOUT_2_0 : CSettings::Get().GetInt("audiooutput.channels"); -+ bool passthrough = CSettings::Get().GetInt("audiooutput.config") == AE_CONFIG_FIXED ? false : CSettings::Get().GetBool("audiooutput.passthrough"); -+ return numChannels == AE_CH_LAYOUT_2_0 && ! (passthrough && -+ CSettings::Get().GetBool("audiooutput.ac3passthrough") && -+ CSettings::Get().GetBool("audiooutput.ac3transcode")); -+} -+ -+bool CActiveAE::IsNotHDAudioConfig() -+{ -+ std:string device = CSettings::Get().GetString("audiooutput.audiodevice"); -+ int numChannels = (m_sink.GetDeviceType(device) == AE_DEVTYPE_IEC958) ? AE_CH_LAYOUT_2_0 : CSettings::Get().GetInt("audiooutput.channels"); -+ return numChannels <= AE_CH_LAYOUT_5_1; -+} -+ - bool CActiveAE::SupportsQualityLevel(enum AEQuality level) - { - if (level == AE_QUALITY_LOW || level == AE_QUALITY_MID || level == AE_QUALITY_HIGH) -diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h -index bfb65d6..5467aa4 100644 ---- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h -+++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAE.h -@@ -229,6 +229,8 @@ class CActiveAE : public IAE, private CThread - virtual std::string GetDefaultDevice(bool passthrough); - virtual bool SupportsRaw(AEDataFormat format, int samplerate); - virtual bool SupportsSilenceTimeout(); -+ virtual bool IsStereoConfig(); -+ virtual bool IsNotHDAudioConfig(); - virtual bool SupportsQualityLevel(enum AEQuality level); - virtual bool IsSettingVisible(const std::string &settingId); - virtual void KeepConfiguration(unsigned int millis); -diff --git a/xbmc/cores/AudioEngine/Interfaces/AE.h b/xbmc/cores/AudioEngine/Interfaces/AE.h -index 3379bf6..eaa3a19 100644 ---- a/xbmc/cores/AudioEngine/Interfaces/AE.h -+++ b/xbmc/cores/AudioEngine/Interfaces/AE.h -@@ -211,6 +211,18 @@ class IAE - */ - virtual bool SupportsSilenceTimeout() { return false; } - -+ /** -+ * Returns true if the AudioEngine is currently configured for stereo audio -+ * @returns true if the AudioEngine is currently configured for stereo audio -+ */ -+ virtual bool IsStereoConfig() { return false; } -+ -+ /** -+ * Returns true if the AudioEngine is currently configured for 5.1 or less -+ * @returns true if the AudioEngine is currently configured for 5.1 or less -+ */ -+ virtual bool IsNotHDAudioConfig() { return false; } -+ - virtual void RegisterAudioCallback(IAudioCallback* pCallback) {} - - virtual void UnregisterAudioCallback() {} --- -1.9.3 - - -From 9b8f061b96f56dafb0bf4a198ad99556e740a84a Mon Sep 17 00:00:00 2001 -From: popcornmix -Date: Thu, 13 Mar 2014 16:08:46 +0000 -Subject: [PATCH 092/102] [omxplayer] Make use of audio decode fast paths when - downmixing - -The TrueHD codec actually works in 3 stages. -It decodes the downmixed stereo. -It then decodes the differences required to produce 5.1. -It then decodes the differences required to produce 7.1. - -Many users end up downmixing this 7.1 stream back to 2.0. -Much better to tell the codec we only need the 2.0 stream. - -When playing a 94s duration video file on an overclocked Pi, the audio decode took: -7.1 channels: 39.6s -5.1 channels: 36.5s -2.0 channels: 23.0s - -So, it's almost twice as fast to decode TrueHD when only stereo is required. ---- - xbmc/cores/omxplayer/OMXAudioCodecOMX.cpp | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/xbmc/cores/omxplayer/OMXAudioCodecOMX.cpp b/xbmc/cores/omxplayer/OMXAudioCodecOMX.cpp -index bb3bea4..814fe1d 100644 ---- a/xbmc/cores/omxplayer/OMXAudioCodecOMX.cpp -+++ b/xbmc/cores/omxplayer/OMXAudioCodecOMX.cpp -@@ -25,6 +25,7 @@ - #include "utils/log.h" - - #include "cores/AudioEngine/Utils/AEUtil.h" -+#include "cores/AudioEngine/AEFactory.h" - - // the size of the audio_render output port buffers - #define AUDIO_DECODE_OUTPUT_BUFFER (32*1024) -@@ -86,6 +87,15 @@ bool COMXAudioCodecOMX::Open(CDVDStreamInfo &hints) - m_pCodecContext->block_align = hints.blockalign; - m_pCodecContext->bit_rate = hints.bitrate; - m_pCodecContext->bits_per_coded_sample = hints.bitspersample; -+ if (hints.codec == AV_CODEC_ID_TRUEHD) -+ { -+ if (CAEFactory::IsStereoConfig()) -+ m_pCodecContext->request_channel_layout = AV_CH_LAYOUT_STEREO; -+ else if (CAEFactory::IsNotHDAudioConfig()) -+ m_pCodecContext->request_channel_layout = AV_CH_LAYOUT_5POINT1; -+ } -+ if (m_pCodecContext->request_channel_layout) -+ CLog::Log(LOGNOTICE,"COMXAudioCodecOMX::Open() Requesting channel layout of %x", (unsigned)m_pCodecContext->request_channel_layout); - - // vorbis has variable sized planar output, so skip concatenation - if (hints.codec == AV_CODEC_ID_VORBIS) --- -1.9.3 - - -From b4e5c374bfcab5cb3dce973ef84cb5e1d3f3c8d5 Mon Sep 17 00:00:00 2001 -From: Matthias Kortstiege -Date: Sun, 29 Jun 2014 11:10:07 +0200 -Subject: [PATCH 095/102] no need to compute slow hash on changes in case the - fast one already succeeded - ---- - xbmc/video/VideoInfoScanner.cpp | 51 +++++++++++++++++++++-------------------- - 1 file changed, 26 insertions(+), 25 deletions(-) - -diff --git a/xbmc/video/VideoInfoScanner.cpp b/xbmc/video/VideoInfoScanner.cpp -index e0056bd..a0b1a00 100644 ---- a/xbmc/video/VideoInfoScanner.cpp -+++ b/xbmc/video/VideoInfoScanner.cpp -@@ -267,40 +267,41 @@ namespace VIDEO - CStdString fastHash = GetFastHash(strDirectory, regexps); - if (m_database.GetPathHash(strDirectory, dbHash) && !fastHash.empty() && fastHash == dbHash) - { // fast hashes match - no need to process anything -- CLog::Log(LOGDEBUG, "VideoInfoScanner: Skipping dir '%s' due to no change (fasthash)", CURL::GetRedacted(strDirectory).c_str()); - hash = fastHash; -- bSkip = true; - } -- if (!bSkip) -+ else - { // need to fetch the folder - CDirectory::GetDirectory(strDirectory, items, g_advancedSettings.m_videoExtensions); - items.Stack(); -- // compute hash -- GetPathHash(items, hash); -- if (hash != dbHash && !hash.empty()) -+ -+ // check whether to re-use previously computed fast hash -+ if (!CanFastHash(items, regexps) || fastHash.empty()) -+ GetPathHash(items, hash); -+ else -+ hash = fastHash; -+ } -+ -+ if (hash == dbHash || (hash.empty() && !dbHash.empty())) -+ { -+ if (hash.empty() && !dbHash.empty()) - { -- if (dbHash.empty()) -- CLog::Log(LOGDEBUG, "VideoInfoScanner: Scanning dir '%s' as not in the database", CURL::GetRedacted(strDirectory).c_str()); -- else -- CLog::Log(LOGDEBUG, "VideoInfoScanner: Rescanning dir '%s' due to change (%s != %s)", CURL::GetRedacted(strDirectory).c_str(), dbHash.c_str(), hash.c_str()); -+ CLog::Log(LOGDEBUG, "VideoInfoScanner: Skipping dir '%s' as it's empty or doesn't exist - adding to clean list", CURL::GetRedacted(strDirectory).c_str()); -+ if (m_bClean) -+ m_pathsToClean.insert(m_database.GetPathId(strDirectory)); - } - else -- { // they're the same or the hash is empty (dir empty/dir not retrievable) -- if (hash.empty() && !dbHash.empty()) -- { -- CLog::Log(LOGDEBUG, "VideoInfoScanner: Skipping dir '%s' as it's empty or doesn't exist - adding to clean list", CURL::GetRedacted(strDirectory).c_str()); -- if (m_bClean) -- m_pathsToClean.insert(m_database.GetPathId(strDirectory)); -- } -- else -- CLog::Log(LOGDEBUG, "VideoInfoScanner: Skipping dir '%s' due to no change", CURL::GetRedacted(strDirectory).c_str()); -- bSkip = true; -- if (m_handle) -- OnDirectoryScanned(strDirectory); -+ { -+ CLog::Log(LOGDEBUG, "VideoInfoScanner: Skipping dir '%s' due to no change%s", CURL::GetRedacted(strDirectory).c_str(), !fastHash.empty() ? " (fasthash)" : ""); - } -- // update the hash to a fast hash if needed -- if (CanFastHash(items, regexps) && !fastHash.empty()) -- hash = fastHash; -+ -+ bSkip = true; -+ } -+ else -+ { -+ if (dbHash.empty()) -+ CLog::Log(LOGDEBUG, "VideoInfoScanner: Scanning dir '%s' as not in the database", CURL::GetRedacted(strDirectory).c_str()); -+ else -+ CLog::Log(LOGDEBUG, "VideoInfoScanner: Rescanning dir '%s' due to change (%s != %s)", CURL::GetRedacted(strDirectory).c_str(), dbHash.c_str(), hash.c_str()); - } - } - else if (content == CONTENT_TVSHOWS) --- -1.9.3 - - -From cd7b60465faeea8c911e8b779bb4eb861ab97e4f Mon Sep 17 00:00:00 2001 +From 4347a199d6dbdfffd00b64edf80cd905bd5c0fff Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 27 Jun 2014 00:01:05 +0100 -Subject: [PATCH 096/102] [rbp] Resume video output on startup +Subject: [PATCH 87/99] [rbp] Resume video output on startup --- xbmc/linux/RBP.cpp | 3 +++ @@ -16658,11 +12376,11 @@ index 9f72a36..f789bf1 100644 1.9.3 -From cf66a3902ad562b29323f901f05821ccf0dc2209 Mon Sep 17 00:00:00 2001 +From 52d99a15f40cf0ba6ef4c7ac5a66154b2604eb71 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Fri, 27 Jun 2014 00:36:29 +0100 -Subject: [PATCH 097/102] [omxplayer] Experimental support for anaglyph - rendering of 3d videos +Subject: [PATCH 88/99] [omxplayer] Experimental support for anaglyph rendering + of 3d videos Requires updated firmware --- @@ -16674,10 +12392,10 @@ Requires updated firmware 5 files changed, 72 insertions(+), 18 deletions(-) diff --git a/xbmc/cores/omxplayer/OMXPlayer.cpp b/xbmc/cores/omxplayer/OMXPlayer.cpp -index 4e0662f..6cebdc4 100644 +index 658b0a6..b295e91 100644 --- a/xbmc/cores/omxplayer/OMXPlayer.cpp +++ b/xbmc/cores/omxplayer/OMXPlayer.cpp -@@ -1503,6 +1503,8 @@ void COMXPlayer::Process() +@@ -1502,6 +1502,8 @@ void COMXPlayer::Process() SetCaching(CACHESTATE_FLUSH); EDEINTERLACEMODE current_deinterlace = CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode; @@ -16686,7 +12404,7 @@ index 4e0662f..6cebdc4 100644 float current_sharpness = CMediaSettings::Get().GetCurrentVideoSettings().m_Sharpness; SetSharpness(current_sharpness); -@@ -1525,8 +1527,13 @@ void COMXPlayer::Process() +@@ -1524,8 +1526,13 @@ void COMXPlayer::Process() float threshold = 0.1f; bool audio_fifo_low = false, video_fifo_low = false, audio_fifo_high = false, video_fifo_high = false; @@ -16702,7 +12420,7 @@ index 4e0662f..6cebdc4 100644 { int iStream = m_CurrentVideo.id, source = m_CurrentVideo.source; CloseVideoStream(false); -@@ -1534,6 +1541,7 @@ void COMXPlayer::Process() +@@ -1533,6 +1540,7 @@ void COMXPlayer::Process() if (m_State.canseek) m_messenger.Put(new CDVDMsgPlayerSeek(GetTime(), true, true, true, true, true)); current_deinterlace = CMediaSettings::Get().GetCurrentVideoSettings().m_DeinterlaceMode; @@ -16711,10 +12429,10 @@ index 4e0662f..6cebdc4 100644 // if sharpness setting has changed, we should update it diff --git a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -index aa5ea43..4d06f1d 100644 +index 605ea80..b2cb610 100644 --- a/xbmc/cores/omxplayer/OMXPlayerVideo.cpp +++ b/xbmc/cores/omxplayer/OMXPlayerVideo.cpp -@@ -549,7 +549,29 @@ bool OMXPlayerVideo::OpenDecoder() +@@ -550,7 +550,29 @@ bool OMXPlayerVideo::OpenDecoder() else m_fForcedAspectRatio = 0.0; @@ -16745,7 +12463,7 @@ index aa5ea43..4d06f1d 100644 m_omxVideo.RegisterResolutionUpdateCallBack((void *)this, ResolutionUpdateCallBack); if(!bVideoDecoderOpen) -@@ -694,6 +716,10 @@ void OMXPlayerVideo::SetVideoRect(const CRect &InSrcRect, const CRect &InDestRec +@@ -695,6 +717,10 @@ void OMXPlayerVideo::SetVideoRect(const CRect &InSrcRect, const CRect &InDestRec video_stereo_mode = RENDER_STEREO_MODE_OFF; display_stereo_mode = RENDER_STEREO_MODE_OFF; } @@ -16756,7 +12474,7 @@ index aa5ea43..4d06f1d 100644 else if (stereo_invert) { SrcRect.x1 += m_hints.width / 2; -@@ -710,6 +736,10 @@ void OMXPlayerVideo::SetVideoRect(const CRect &InSrcRect, const CRect &InDestRec +@@ -711,6 +737,10 @@ void OMXPlayerVideo::SetVideoRect(const CRect &InSrcRect, const CRect &InDestRec video_stereo_mode = RENDER_STEREO_MODE_OFF; display_stereo_mode = RENDER_STEREO_MODE_OFF; } @@ -16940,17 +12658,18 @@ index e5a98f6..3ee28e0 100644 1.9.3 -From 2ec74d1273d13709bde43877856dfba84cb3e808 Mon Sep 17 00:00:00 2001 +From 6f203e648a17355451f48251837f4d281cfee04b Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 2 Jul 2014 12:24:01 +0100 -Subject: [PATCH 098/102] [settings] Add update flag to omx acceleration +Subject: [PATCH 89/99] [settings] Add update flag to omx acceleration --- system/settings/settings.xml | 3 +++ - 1 file changed, 3 insertions(+) + xbmc/settings/Settings.cpp | 1 + + 2 files changed, 4 insertions(+) diff --git a/system/settings/settings.xml b/system/settings/settings.xml -index 7d1d51f..5b67ee6 100644 +index 3e8118b..9b87290 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -740,6 +740,9 @@ @@ -16963,15 +12682,26 @@ index 7d1d51f..5b67ee6 100644 +diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp +index b5ed60a..84b3225 100644 +--- a/xbmc/settings/Settings.cpp ++++ b/xbmc/settings/Settings.cpp +@@ -720,6 +720,7 @@ void CSettings::InitializeISettingCallbacks() + settingSet.insert("videoscreen.testpattern"); + settingSet.insert("videoplayer.useamcodec"); + settingSet.insert("videoplayer.usemediacodec"); ++ settingSet.insert("videoplayer.useomx"); + m_settingsManager->RegisterCallback(&g_application, settingSet); + + settingSet.clear(); -- 1.9.3 -From 300cf12bc8ebd2e5114581820fe55474b3c39ffc Mon Sep 17 00:00:00 2001 +From f75f4a67faef560be8c1102b0f059e45b6fe0c3c Mon Sep 17 00:00:00 2001 From: popcornmix Date: Tue, 1 Jul 2014 00:38:54 +0100 -Subject: [PATCH 099/102] [omx] Avoid hang following jpegs that failed to - decode +Subject: [PATCH 90/99] [omx] Avoid hang following jpegs that failed to decode There's a few instanced of xbmc hanging following a jpeg that failed to decode on GPU: http://forum.stmlabs.com/showthread.php?tid=14839 @@ -16987,10 +12717,10 @@ when operation did not complete successfully 2 files changed, 56 insertions(+), 26 deletions(-) diff --git a/xbmc/cores/omxplayer/OMXImage.cpp b/xbmc/cores/omxplayer/OMXImage.cpp -index d529b20..f5fe546 100644 +index d2f6b21..085d050 100644 --- a/xbmc/cores/omxplayer/OMXImage.cpp +++ b/xbmc/cores/omxplayer/OMXImage.cpp -@@ -902,6 +902,7 @@ COMXImageDec::COMXImageDec() +@@ -905,6 +905,7 @@ COMXImageDec::COMXImageDec() { m_decoded_buffer = NULL; OMX_INIT_STRUCTURE(m_decoded_format); @@ -16998,7 +12728,7 @@ index d529b20..f5fe546 100644 } COMXImageDec::~COMXImageDec() -@@ -916,15 +917,20 @@ void COMXImageDec::Close() +@@ -919,15 +920,20 @@ void COMXImageDec::Close() { CSingleLock lock(m_OMXSection); @@ -17027,7 +12757,7 @@ index d529b20..f5fe546 100644 } if(m_omx_tunnel_decode.IsInitialized()) m_omx_tunnel_decode.Deestablish(); -@@ -1177,6 +1183,7 @@ bool COMXImageDec::Decode(const uint8_t *demuxer_content, unsigned demuxer_bytes +@@ -1180,6 +1186,7 @@ bool COMXImageDec::Decode(const uint8_t *demuxer_content, unsigned demuxer_bytes memcpy( (char*)pixels, m_decoded_buffer->pBuffer, stride * height); @@ -17035,7 +12765,7 @@ index d529b20..f5fe546 100644 Close(); return true; } -@@ -1191,6 +1198,7 @@ COMXImageEnc::COMXImageEnc() +@@ -1194,6 +1201,7 @@ COMXImageEnc::COMXImageEnc() CSingleLock lock(m_OMXSection); OMX_INIT_STRUCTURE(m_encoded_format); m_encoded_buffer = NULL; @@ -17043,7 +12773,7 @@ index d529b20..f5fe546 100644 } COMXImageEnc::~COMXImageEnc() -@@ -1416,6 +1424,7 @@ COMXImageReEnc::COMXImageReEnc() +@@ -1419,6 +1427,7 @@ COMXImageReEnc::COMXImageReEnc() m_encoded_buffer = NULL; m_pDestBuffer = NULL; m_nDestAllocSize = 0; @@ -17051,7 +12781,7 @@ index d529b20..f5fe546 100644 } COMXImageReEnc::~COMXImageReEnc() -@@ -1431,15 +1440,24 @@ void COMXImageReEnc::Close() +@@ -1434,15 +1443,24 @@ void COMXImageReEnc::Close() { CSingleLock lock(m_OMXSection); @@ -17084,7 +12814,7 @@ index d529b20..f5fe546 100644 } if(m_omx_tunnel_decode.IsInitialized()) m_omx_tunnel_decode.Deestablish(); -@@ -1856,14 +1874,15 @@ bool COMXImageReEnc::ReEncode(COMXImageFile &srcFile, unsigned int maxWidth, uns +@@ -1859,14 +1877,15 @@ bool COMXImageReEnc::ReEncode(COMXImageFile &srcFile, unsigned int maxWidth, uns } } @@ -17102,7 +12832,7 @@ index d529b20..f5fe546 100644 return true; } -@@ -1875,6 +1894,7 @@ bool COMXImageReEnc::ReEncode(COMXImageFile &srcFile, unsigned int maxWidth, uns +@@ -1878,6 +1897,7 @@ bool COMXImageReEnc::ReEncode(COMXImageFile &srcFile, unsigned int maxWidth, uns COMXTexture::COMXTexture() { @@ -17110,7 +12840,7 @@ index d529b20..f5fe546 100644 } COMXTexture::~COMXTexture() -@@ -1886,15 +1906,20 @@ void COMXTexture::Close() +@@ -1889,15 +1909,20 @@ void COMXTexture::Close() { CSingleLock lock(m_OMXSection); @@ -17139,7 +12869,7 @@ index d529b20..f5fe546 100644 } if (m_omx_tunnel_decode.IsInitialized()) m_omx_tunnel_decode.Deestablish(); -@@ -2196,6 +2221,7 @@ bool COMXTexture::Decode(const uint8_t *demuxer_content, unsigned demuxer_bytes, +@@ -2199,6 +2224,7 @@ bool COMXTexture::Decode(const uint8_t *demuxer_content, unsigned demuxer_bytes, eos = true; } } @@ -17148,10 +12878,10 @@ index d529b20..f5fe546 100644 return true; } diff --git a/xbmc/cores/omxplayer/OMXImage.h b/xbmc/cores/omxplayer/OMXImage.h -index ec7a229..62e931a 100644 +index 9518190..90e513a 100644 --- a/xbmc/cores/omxplayer/OMXImage.h +++ b/xbmc/cores/omxplayer/OMXImage.h -@@ -135,6 +135,7 @@ class COMXImageDec +@@ -132,6 +132,7 @@ class COMXImageDec OMX_BUFFERHEADERTYPE *m_decoded_buffer; OMX_PARAM_PORTDEFINITIONTYPE m_decoded_format; CCriticalSection m_OMXSection; @@ -17159,7 +12889,7 @@ index ec7a229..62e931a 100644 }; class COMXImageEnc -@@ -153,6 +154,7 @@ class COMXImageEnc +@@ -150,6 +151,7 @@ class COMXImageEnc OMX_BUFFERHEADERTYPE *m_encoded_buffer; OMX_PARAM_PORTDEFINITIONTYPE m_encoded_format; CCriticalSection m_OMXSection; @@ -17167,7 +12897,7 @@ index ec7a229..62e931a 100644 }; class COMXImageReEnc -@@ -176,6 +178,7 @@ class COMXImageReEnc +@@ -173,6 +175,7 @@ class COMXImageReEnc CCriticalSection m_OMXSection; void *m_pDestBuffer; unsigned int m_nDestAllocSize; @@ -17175,7 +12905,7 @@ index ec7a229..62e931a 100644 }; class COMXTexture -@@ -200,6 +203,7 @@ class COMXTexture +@@ -197,6 +200,7 @@ class COMXTexture OMX_BUFFERHEADERTYPE *m_egl_buffer; CCriticalSection m_OMXSection; @@ -17187,10 +12917,10 @@ index ec7a229..62e931a 100644 1.9.3 -From 1fe4b152bde3a10c2e1499fb038088105f23eb0a Mon Sep 17 00:00:00 2001 +From b51ea932eb3590cb06b9aefaaf001e0eab275dc6 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 2 Jul 2014 20:41:29 +0100 -Subject: [PATCH 100/102] [pi] Reduce time textures are held for when memory is +Subject: [PATCH 91/99] [pi] Reduce time textures are held for when memory is low --- @@ -17200,10 +12930,10 @@ Subject: [PATCH 100/102] [pi] Reduce time textures are held for when memory is 3 files changed, 20 insertions(+) diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp -index ce52040..c6c20e4 100644 +index 8415123..bdd1390 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp -@@ -348,6 +348,10 @@ +@@ -352,6 +352,10 @@ #include "utils/AMLUtils.h" #endif @@ -17214,7 +12944,7 @@ index ce52040..c6c20e4 100644 #include "cores/FFmpeg.h" using namespace std; -@@ -5154,6 +5158,11 @@ void CApplication::ProcessSlow() +@@ -5198,6 +5202,11 @@ void CApplication::ProcessSlow() if (!m_pPlayer->IsPlayingVideo()) g_largeTextureManager.CleanupUnusedImages(); @@ -17263,11 +12993,11 @@ index f06687c..bf6dfdb 100644 1.9.3 -From 845be398a669796dab1867168595e2b14e5f2916 Mon Sep 17 00:00:00 2001 +From 9723e98bf9a3f4387b226e8d7d0313469b4cd0c8 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Wed, 2 Jul 2014 21:03:59 +0100 -Subject: [PATCH 101/102] [omx] Restrict the number of outstanding jpeg calls - to gpu +Subject: [PATCH 92/99] [omx] Restrict the number of outstanding jpeg calls to + gpu Allowing more than one outstanding call to gpu for texture encode/decode can be beneficial as processing can be overlapped with vchiq message transfer. @@ -17280,7 +13010,7 @@ Allowing more that this ties up memory on GPU without any performance benefit, s 1 file changed, 35 insertions(+) diff --git a/xbmc/cores/omxplayer/OMXImage.cpp b/xbmc/cores/omxplayer/OMXImage.cpp -index f5fe546..a3704da 100644 +index 085d050..efd3343 100644 --- a/xbmc/cores/omxplayer/OMXImage.cpp +++ b/xbmc/cores/omxplayer/OMXImage.cpp @@ -49,6 +49,33 @@ @@ -17317,7 +13047,7 @@ index f5fe546..a3704da 100644 #ifdef CLASSNAME #undef CLASSNAME #endif -@@ -900,6 +927,7 @@ bool COMXImageFile::ReadFile(const CStdString& inputFile) +@@ -903,6 +930,7 @@ bool COMXImageFile::ReadFile(const std::string& inputFile) COMXImageDec::COMXImageDec() { @@ -17325,7 +13055,7 @@ index f5fe546..a3704da 100644 m_decoded_buffer = NULL; OMX_INIT_STRUCTURE(m_decoded_format); m_success = false; -@@ -911,6 +939,7 @@ COMXImageDec::~COMXImageDec() +@@ -914,6 +942,7 @@ COMXImageDec::~COMXImageDec() OMX_INIT_STRUCTURE(m_decoded_format); m_decoded_buffer = NULL; @@ -17333,7 +13063,7 @@ index f5fe546..a3704da 100644 } void COMXImageDec::Close() -@@ -1195,6 +1224,7 @@ bool COMXImageDec::Decode(const uint8_t *demuxer_content, unsigned demuxer_bytes +@@ -1198,6 +1227,7 @@ bool COMXImageDec::Decode(const uint8_t *demuxer_content, unsigned demuxer_bytes COMXImageEnc::COMXImageEnc() { @@ -17341,7 +13071,7 @@ index f5fe546..a3704da 100644 CSingleLock lock(m_OMXSection); OMX_INIT_STRUCTURE(m_encoded_format); m_encoded_buffer = NULL; -@@ -1209,6 +1239,7 @@ COMXImageEnc::~COMXImageEnc() +@@ -1212,6 +1242,7 @@ COMXImageEnc::~COMXImageEnc() m_encoded_buffer = NULL; if(m_omx_encoder.IsInitialized()) m_omx_encoder.Deinitialize(); @@ -17349,7 +13079,7 @@ index f5fe546..a3704da 100644 } bool COMXImageEnc::Encode(unsigned char *buffer, int size, unsigned width, unsigned height, unsigned int pitch) -@@ -1421,6 +1452,7 @@ bool COMXImageEnc::CreateThumbnailFromSurface(unsigned char* buffer, unsigned in +@@ -1424,6 +1455,7 @@ bool COMXImageEnc::CreateThumbnailFromSurface(unsigned char* buffer, unsigned in COMXImageReEnc::COMXImageReEnc() { @@ -17357,7 +13087,7 @@ index f5fe546..a3704da 100644 m_encoded_buffer = NULL; m_pDestBuffer = NULL; m_nDestAllocSize = 0; -@@ -1434,6 +1466,7 @@ COMXImageReEnc::~COMXImageReEnc() +@@ -1437,6 +1469,7 @@ COMXImageReEnc::~COMXImageReEnc() free (m_pDestBuffer); m_pDestBuffer = NULL; m_nDestAllocSize = 0; @@ -17365,7 +13095,7 @@ index f5fe546..a3704da 100644 } void COMXImageReEnc::Close() -@@ -1894,12 +1927,14 @@ bool COMXImageReEnc::ReEncode(COMXImageFile &srcFile, unsigned int maxWidth, uns +@@ -1897,12 +1930,14 @@ bool COMXImageReEnc::ReEncode(COMXImageFile &srcFile, unsigned int maxWidth, uns COMXTexture::COMXTexture() { @@ -17384,27 +13114,51 @@ index f5fe546..a3704da 100644 1.9.3 -From edd99869f9079a7f6fb783485eee0a77f461d253 Mon Sep 17 00:00:00 2001 +From b8837ec20d7b68b2441da31bc48ab2ec2b2be2e2 Mon Sep 17 00:00:00 2001 From: popcornmix Date: Sat, 5 Jul 2014 19:26:46 +0100 -Subject: [PATCH 102/102] [omxplayer] Explictly choose deinterlace method for +Subject: [PATCH 93/99] [omxplayer] Explictly choose deinterlace method for 1080i -As the 1080i deinterlace doesn't require the 3 frames of context we can save ~6MB by requesting it explicitly +As the 1080i deinterlace doesn't require the 3 frames of context we can save ~9MB by requesting it explicitly --- - xbmc/cores/omxplayer/OMXVideo.cpp | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) + xbmc/cores/omxplayer/OMXVideo.cpp | 22 +++++++++++++++++++++- + 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/xbmc/cores/omxplayer/OMXVideo.cpp b/xbmc/cores/omxplayer/OMXVideo.cpp -index 07c4643..e2a3d27 100644 +index 07c4643..15b62af 100644 --- a/xbmc/cores/omxplayer/OMXVideo.cpp +++ b/xbmc/cores/omxplayer/OMXVideo.cpp -@@ -313,7 +313,10 @@ bool COMXVideo::PortSettingsChanged() +@@ -299,6 +299,23 @@ bool COMXVideo::PortSettingsChanged() + + if(m_deinterlace || m_anaglyph) + { ++ bool advanced_deinterlace = port_image.format.video.nFrameWidth * port_image.format.video.nFrameHeight <= 576 * 720; ++ ++ if (m_anaglyph != OMX_ImageFilterAnaglyphNone || !advanced_deinterlace) ++ { ++ // Image_fx assumed 3 frames of context. anaglyph and simple deinterlace don't require this ++ OMX_PARAM_U32TYPE extra_buffers; ++ OMX_INIT_STRUCTURE(extra_buffers); ++ extra_buffers.nU32 = -2; ++ ++ omx_err = m_omx_image_fx.SetParameter(OMX_IndexParamBrcmExtraBuffers, &extra_buffers); ++ if(omx_err != OMX_ErrorNone) ++ { ++ CLog::Log(LOGERROR, "%s::%s error OMX_IndexParamBrcmExtraBuffers omx_err(0x%08x)", CLASSNAME, __func__, omx_err); ++ return false; ++ } ++ } ++ + OMX_CONFIG_IMAGEFILTERPARAMSTYPE image_filter; + OMX_INIT_STRUCTURE(image_filter); + +@@ -313,7 +330,10 @@ bool COMXVideo::PortSettingsChanged() { image_filter.nNumParams = 1; image_filter.nParams[0] = 3; - image_filter.eImageFilter = OMX_ImageFilterDeInterlaceAdvanced; -+ if (port_image.format.video.nFrameWidth * port_image.format.video.nFrameHeight > 576 * 720) ++ if (!advanced_deinterlace) + image_filter.eImageFilter = OMX_ImageFilterDeInterlaceFast; + else + image_filter.eImageFilter = OMX_ImageFilterDeInterlaceAdvanced; @@ -17414,3 +13168,1435 @@ index 07c4643..e2a3d27 100644 -- 1.9.3 + +From d8c342416463b82d1bf890a304d5c1c0253e96b3 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Tue, 8 Jul 2014 21:00:44 +0100 +Subject: [PATCH 94/99] [omxcodec] Fix 3D rendering for dvdplayer + +Similar to https://github.com/xbmc/xbmc/pull/3887 +--- + xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp | 31 +++++++++++++++++++++---- + 1 file changed, 27 insertions(+), 4 deletions(-) + +diff --git a/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp b/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp +index 53873f6..84a46ec 100644 +--- a/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp ++++ b/xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp +@@ -1369,10 +1369,11 @@ void CLinuxRendererGLES::RenderOpenMax(int index, int field) + } + + // Set texture coordinates +- tex[0][0] = tex[3][0] = 0; +- tex[0][1] = tex[1][1] = 0; +- tex[1][0] = tex[2][0] = 1; +- tex[2][1] = tex[3][1] = 1; ++ YUVPLANE &plane = m_buffers[index].fields[0][0]; ++ tex[0][0] = tex[3][0] = plane.rect.x1; ++ tex[0][1] = tex[1][1] = plane.rect.y1; ++ tex[1][0] = tex[2][0] = plane.rect.x2; ++ tex[2][1] = tex[3][1] = plane.rect.y2; + + glDrawElements(GL_TRIANGLE_STRIP, 4, GL_UNSIGNED_BYTE, idx); + +@@ -2506,6 +2507,7 @@ void CLinuxRendererGLES::UploadOMXEGLTexture(int index) + { + //buf.openMaxBuffer->Sync(); + } ++ CalculateTextureSourceRects(index, 1); + #endif + } + void CLinuxRendererGLES::DeleteOMXEGLTexture(int index) +@@ -2518,6 +2520,27 @@ void CLinuxRendererGLES::DeleteOMXEGLTexture(int index) + } + bool CLinuxRendererGLES::CreateOMXEGLTexture(int index) + { ++ YV12Image &im = m_buffers[index].image; ++ YUVFIELDS &fields = m_buffers[index].fields; ++ YUVPLANE &plane = fields[0][0]; ++ ++ memset(&im , 0, sizeof(im)); ++ memset(&fields, 0, sizeof(fields)); ++ ++ im.height = m_sourceHeight; ++ im.width = m_sourceWidth; ++ ++ plane.texwidth = im.width; ++ plane.texheight = im.height; ++ plane.pixpertex_x = 1; ++ plane.pixpertex_y = 1; ++ ++ if(m_renderMethod & RENDER_POT) ++ { ++ plane.texwidth = NP2(plane.texwidth); ++ plane.texheight = NP2(plane.texheight); ++ } ++ + DeleteOMXEGLTexture(index); + return true; + } +-- +1.9.3 + + +From 57d075ae9b88cb6d25b04095e3f9c3c3f7a95289 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 9 Jul 2014 22:45:43 +0100 +Subject: [PATCH 95/99] [rbp] Make cachemembuffersize default depend on memory + size + +--- + xbmc/linux/RBP.cpp | 5 +++++ + xbmc/settings/AdvancedSettings.cpp | 5 +++++ + 2 files changed, 10 insertions(+) + +diff --git a/xbmc/linux/RBP.cpp b/xbmc/linux/RBP.cpp +index 65c95a3..bbf7ab5 100644 +--- a/xbmc/linux/RBP.cpp ++++ b/xbmc/linux/RBP.cpp +@@ -21,6 +21,7 @@ + #include "RBP.h" + #if defined(TARGET_RASPBERRY_PI) + ++#include "settings/AdvancedSettings.h" + #include "utils/log.h" + + #include "cores/omxplayer/OMXImage.h" +@@ -75,6 +76,9 @@ bool CRBP::Initialize() + if (m_gpu_mem < 128) + setenv("V3D_DOUBLE_BUFFER", "1", 1); + ++ if (g_advancedSettings.m_cacheMemBufferSize == ~0) ++ g_advancedSettings.m_cacheMemBufferSize = m_arm_mem < 256 ? 1024 * 1024 * 2 : 1024 * 1024 * 20; ++ + // in case xbcm was restarted when suspended + ResumeVideoOutput(); + +@@ -100,6 +104,7 @@ void CRBP::LogFirmwareVerison() + response[sizeof(response) - 1] = '\0'; + CLog::Log(LOGNOTICE, "Raspberry PI firmware version: %s", response); + CLog::Log(LOGNOTICE, "ARM mem: %dMB GPU mem: %dMB MPG2:%d WVC1:%d", m_arm_mem, m_gpu_mem, m_codec_mpg2_enabled, m_codec_wvc1_enabled); ++ CLog::Log(LOGNOTICE, "cacheMemBufferSize: %dMB", g_advancedSettings.m_cacheMemBufferSize >> 20); + m_DllBcmHost->vc_gencmd(response, sizeof response, "get_config int"); + response[sizeof(response) - 1] = '\0'; + CLog::Log(LOGNOTICE, "Config:\n%s", response); +diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp +index 1175eb1..fcf3fa7 100644 +--- a/xbmc/settings/AdvancedSettings.cpp ++++ b/xbmc/settings/AdvancedSettings.cpp +@@ -364,7 +364,12 @@ void CAdvancedSettings::Initialize() + + m_measureRefreshrate = false; + ++#ifdef TARGET_RASPBERRY_PI ++ // want default to be memory dependent, but interface to gpu not available yet, so set in RBP.cpp ++ m_cacheMemBufferSize = ~0; ++#else + m_cacheMemBufferSize = 1024 * 1024 * 20; ++#endif + m_networkBufferMode = 0; // Default (buffer all internet streams/filesystems) + // the following setting determines the readRate of a player data + // as multiply of the default data read rate +-- +1.9.3 + + +From b9b8cd6d8893e12ac3f9bc81d94e04874e3dcf13 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Wed, 9 Jul 2014 23:31:32 +0100 +Subject: [PATCH 96/99] [rbp] Make gui limit default to 720 when memory is + limited + +--- + system/settings/rbp.xml | 4 ++-- + xbmc/linux/RBP.cpp | 4 ++++ + 2 files changed, 6 insertions(+), 2 deletions(-) + +diff --git a/system/settings/rbp.xml b/system/settings/rbp.xml +index 1429256..5d47c28 100644 +--- a/system/settings/rbp.xml ++++ b/system/settings/rbp.xml +@@ -32,9 +32,9 @@ + + + 2 +- 1080 ++ 0 + +- 540 ++ 0 + 16 + 1080 + +diff --git a/xbmc/linux/RBP.cpp b/xbmc/linux/RBP.cpp +index bbf7ab5..85e1f21 100644 +--- a/xbmc/linux/RBP.cpp ++++ b/xbmc/linux/RBP.cpp +@@ -22,6 +22,7 @@ + #if defined(TARGET_RASPBERRY_PI) + + #include "settings/AdvancedSettings.h" ++#include "settings/Settings.h" + #include "utils/log.h" + + #include "cores/omxplayer/OMXImage.h" +@@ -79,6 +80,9 @@ bool CRBP::Initialize() + if (g_advancedSettings.m_cacheMemBufferSize == ~0) + g_advancedSettings.m_cacheMemBufferSize = m_arm_mem < 256 ? 1024 * 1024 * 2 : 1024 * 1024 * 20; + ++ if (!CSettings::Get().GetInt("videoscreen.limitgui")) ++ CSettings::Get().SetInt("videoscreen.limitgui", m_gpu_mem < 128 ? 720:1080); ++ + // in case xbcm was restarted when suspended + ResumeVideoOutput(); + +-- +1.9.3 + + +From 80f2924035713ee6094830548514b6df5d03d7c6 Mon Sep 17 00:00:00 2001 +From: popcornmix +Date: Sun, 13 Jul 2014 11:28:20 +0100 +Subject: [PATCH 97/99] [ResamplePi] Fix xbmc crash with usb audio when music + file switched + +Need to handle the case where AE requests fewer output samples that are produced. + +See: +http://forum.xbmc.org/showthread.php?tid=199244 +http://openelec.tv/forum/124-raspberry-pi/71119-openelec-4-0-1-crashes-after-each-song?start=15#110835 +--- + .../Engines/ActiveAE/ActiveAEResamplePi.cpp | 60 +++++++++++++++++----- + .../Engines/ActiveAE/ActiveAEResamplePi.h | 1 + + 2 files changed, 48 insertions(+), 13 deletions(-) + +diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp +index 1604030..08da688 100644 +--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp ++++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.cpp +@@ -69,6 +69,7 @@ CActiveAEResample::CActiveAEResample() + m_last_dst_fmt = AV_SAMPLE_FMT_NONE; + m_last_src_channels = 0; + m_last_dst_channels = 0; ++ m_encoded_buffer = NULL; + } + + CActiveAEResample::~CActiveAEResample() +@@ -382,6 +383,14 @@ bool CActiveAEResample::Init(uint64_t dst_chan_layout, int dst_channels, int dst + return true; + } + ++ ++static void copy_planes(uint8_t **dst_buffer, int d_pitch, int d_planes, int d_samplesize, int offset, uint8_t *src_buffer, int src_samples) ++{ ++ int planesize = src_samples * d_samplesize / d_planes; ++ for (int i=0; i < d_planes; i++) ++ memcpy(dst_buffer[i] + offset * d_pitch, src_buffer + i * planesize, planesize); ++} ++ + int CActiveAEResample::Resample(uint8_t **dst_buffer, int dst_samples, uint8_t **src_buffer, int src_samples, double ratio) + { + #ifdef DEBUG_VERBOSE +@@ -398,21 +407,35 @@ int CActiveAEResample::Resample(uint8_t **dst_buffer, int dst_samples, uint8_t * + const int s_pitch = s_chans * m_src_bits >> 3; + const int d_pitch = d_chans * m_dst_bits >> 3; + ++ const int s_samplesize = m_src_channels * m_src_bits >> 3; ++ const int d_samplesize = m_dst_channels * m_dst_bits >> 3; ++ const int max_src_samples = BUFFERSIZE / s_samplesize; ++ const int max_dst_samples = (long long)(BUFFERSIZE / d_samplesize) * m_src_rate / (m_dst_rate + m_src_rate-1); ++ + int sent = 0; + int received = 0; ++ ++ if (m_encoded_buffer && m_encoded_buffer->nFilledLen) ++ { ++ int samples_available = m_encoded_buffer->nFilledLen / d_samplesize - m_encoded_buffer->nOffset; ++ int samples = std::min(samples_available, dst_samples - received); ++ copy_planes(dst_buffer, d_pitch, d_planes, d_samplesize, received, (uint8_t *)m_encoded_buffer->pBuffer + m_encoded_buffer->nOffset * d_pitch, samples); ++ received += samples; ++ samples_available -= samples; ++ if (samples_available > 0) ++ m_encoded_buffer->nOffset += samples; ++ else ++ m_encoded_buffer = NULL; ++ } ++ assert(!m_encoded_buffer); + while (sent < src_samples) + { + OMX_BUFFERHEADERTYPE *omx_buffer = NULL; +- OMX_BUFFERHEADERTYPE *m_encoded_buffer = NULL; + + omx_buffer = m_omx_mixer.GetInputBuffer(1000); + if (omx_buffer == NULL) + return false; + +- const int s_samplesize = m_src_channels * m_src_bits >> 3; +- const int d_samplesize = m_dst_channels * m_dst_bits >> 3; +- const int max_src_samples = BUFFERSIZE / s_samplesize; +- const int max_dst_samples = (long long)(BUFFERSIZE / d_samplesize) * m_src_rate / (m_dst_rate + m_src_rate-1); + int send = std::min(std::min(max_dst_samples, max_src_samples), src_samples - sent); + + omx_buffer->nOffset = 0; +@@ -464,22 +487,28 @@ int CActiveAEResample::Resample(uint8_t **dst_buffer, int dst_samples, uint8_t * + + if (m_encoded_buffer->nFilledLen) + { +- int planesize = m_encoded_buffer->nFilledLen / d_planes; +- for (int i=0; i < d_planes; i++) +- memcpy(dst_buffer[i] + received * d_pitch, (uint8_t *)m_encoded_buffer->pBuffer + i * planesize, planesize); +- received += m_encoded_buffer->nFilledLen / d_samplesize; ++ int samples_available = m_encoded_buffer->nFilledLen / d_samplesize; ++ int samples = std::min(samples_available, dst_samples - received); ++ copy_planes(dst_buffer, d_pitch, d_planes, d_samplesize, received, (uint8_t *)m_encoded_buffer->pBuffer, samples); ++ received += samples; ++ samples_available -= samples; ++ if (samples_available > 0) ++ m_encoded_buffer->nOffset += samples; ++ else ++ m_encoded_buffer = NULL; + } + } + #ifdef DEBUG_VERBOSE + CLog::Log(LOGINFO, "%s::%s format:%d->%d rate:%d->%d chan:%d->%d samples %d->%d (%f) %d =%d", CLASSNAME, __func__, + (int)m_src_fmt, (int)m_dst_fmt, m_src_rate, m_dst_rate, m_src_channels, m_dst_channels, src_samples, dst_samples, ratio, m_Initialized, received); + #endif ++ assert(received <= dst_samples); + return received; + } + + int64_t CActiveAEResample::GetDelay(int64_t base) + { +- int ret = 0; ++ int ret = m_dst_rate ? 1000 * GetBufferedSamples() / m_dst_rate : 0; + #ifdef DEBUG_VERBOSE + CLog::Log(LOGINFO, "%s::%s = %d", CLASSNAME, __func__, ret); + #endif +@@ -488,11 +517,16 @@ int64_t CActiveAEResample::GetDelay(int64_t base) + + int CActiveAEResample::GetBufferedSamples() + { +- int ret = 0; ++ int samples = 0; ++ if (m_encoded_buffer) ++ { ++ const int d_samplesize = m_dst_channels * m_dst_bits >> 3; ++ samples = m_encoded_buffer->nFilledLen / d_samplesize - m_encoded_buffer->nOffset; ++ } + #ifdef DEBUG_VERBOSE +- CLog::Log(LOGINFO, "%s::%s = %d", CLASSNAME, __func__, ret); ++ CLog::Log(LOGINFO, "%s::%s = %d", CLASSNAME, __func__, samples); + #endif +- return ret; ++ return samples; + } + + int CActiveAEResample::CalcDstSampleCount(int src_samples, int dst_rate, int src_rate) +diff --git a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.h b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.h +index 47a9e08..b88a90b 100644 +--- a/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.h ++++ b/xbmc/cores/AudioEngine/Engines/ActiveAE/ActiveAEResamplePi.h +@@ -57,6 +57,7 @@ class CActiveAEResample + bool m_Initialized; + AVSampleFormat m_last_src_fmt, m_last_dst_fmt; + int m_last_src_channels, m_last_dst_channels; ++ OMX_BUFFERHEADERTYPE *m_encoded_buffer; + }; + + } +-- +1.9.3 + + +From 10a26b5fd921c328f0c4c152caa8a348baffa4c2 Mon Sep 17 00:00:00 2001 +From: Rainer Hochecker +Date: Thu, 17 Jul 2014 08:40:22 +0200 +Subject: [PATCH 98/99] ffmpeg: bump to 2.3 + +--- + tools/depends/target/ffmpeg/FFMPEG-VERSION | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/tools/depends/target/ffmpeg/FFMPEG-VERSION b/tools/depends/target/ffmpeg/FFMPEG-VERSION +index 33f458e..d394b94 100644 +--- a/tools/depends/target/ffmpeg/FFMPEG-VERSION ++++ b/tools/depends/target/ffmpeg/FFMPEG-VERSION +@@ -1,5 +1,5 @@ + LIBNAME=ffmpeg + BASE_URL=https://github.com/xbmc/FFmpeg/archive +-VERSION=2.2-Helix-alpha2 ++VERSION=2.3-Helix-alpha2 + ARCHIVE=$(LIBNAME)-$(VERSION).tar.gz + +-- +1.9.3 + + +From dc0901d679e407e66274a6acbe3a1356434c7c3b Mon Sep 17 00:00:00 2001 +From: Memphiz +Date: Thu, 17 Jul 2014 09:14:45 +0200 +Subject: [PATCH 99/99] - bump gas to + https://git.libav.org/?p=gas-preprocessor.git;a=commit;h=03e23216b7e657fdf202befc129ca94cd582c253 + - needed for ffmpeg2.3 compilation on ios + +--- + .../gas-preprocessor-native/gas-preprocessor.pl | 847 ++++++++++++++++----- + 1 file changed, 654 insertions(+), 193 deletions(-) + +diff --git a/tools/depends/native/gas-preprocessor-native/gas-preprocessor.pl b/tools/depends/native/gas-preprocessor-native/gas-preprocessor.pl +index f932c60..9cc3610 100755 +--- a/tools/depends/native/gas-preprocessor-native/gas-preprocessor.pl ++++ b/tools/depends/native/gas-preprocessor-native/gas-preprocessor.pl +@@ -10,17 +10,74 @@ + # implements the subset of the gas preprocessor used by x264 and ffmpeg + # that isn't supported by Apple's gas. + +-my @gcc_cmd = @ARGV; ++my %canonical_arch = ("aarch64" => "aarch64", "arm64" => "aarch64", ++ "arm" => "arm", ++ "powerpc" => "powerpc", "ppc" => "powerpc"); ++ ++my %comments = ("aarch64" => '//', ++ "arm" => '@', ++ "powerpc" => '#'); ++ ++my @gcc_cmd; + my @preprocess_c_cmd; + ++my $comm; ++my $arch; ++my $as_type = "apple-gas"; ++ + my $fix_unreq = $^O eq "darwin"; ++my $force_thumb = 0; ++ ++my $arm_cond_codes = "eq|ne|cs|cc|mi|pl|vs|vc|hi|ls|ge|lt|gt|le|al|hs|lo"; ++ ++my $usage_str = " ++$0\n ++Gas-preprocessor.pl converts assembler files using modern GNU as syntax for ++Apple's ancient gas version or clang's incompatible integrated assembler. The ++conversion is regularly tested for Libav, x264 and vlc. Other projects might ++use different features which are not correctly handled. ++ ++Options for this program needs to be separated with ' -- ' from the assembler ++command. Following options are currently supported: ++ ++ -help - this usage text ++ -arch - target architecture ++ -as-type - one value out of {{,apple-}{gas,clang},armasm} ++ -fix-unreq ++ -no-fix-unreq ++ -force-thumb - assemble as thumb regardless of the input source ++ (note, this is incomplete and only works for sources ++ it explicitly was tested with) ++"; ++ ++sub usage() { ++ print $usage_str; ++} + +-if ($gcc_cmd[0] eq "-fix-unreq") { +- $fix_unreq = 1; +- shift @gcc_cmd; +-} elsif ($gcc_cmd[0] eq "-no-fix-unreq") { +- $fix_unreq = 0; +- shift @gcc_cmd; ++while (@ARGV) { ++ my $opt = shift; ++ ++ if ($opt =~ /^-(no-)?fix-unreq$/) { ++ $fix_unreq = $1 ne "no-"; ++ } elsif ($opt eq "-force-thumb") { ++ $force_thumb = 1; ++ } elsif ($opt eq "-arch") { ++ $arch = shift; ++ die "unknown arch: '$arch'\n" if not exists $comments{$arch}; ++ } elsif ($opt eq "-as-type") { ++ $as_type = shift; ++ die "unknown as type: '$as_type'\n" if $as_type !~ /^((apple-)?(gas|clang)|armasm)$/; ++ } elsif ($opt eq "-help") { ++ usage(); ++ exit 0; ++ } elsif ($opt eq "--" ) { ++ @gcc_cmd = @ARGV; ++ } elsif ($opt =~ /^-/) { ++ die "option '$opt' is not known. See '$0 -help' for usage information\n"; ++ } else { ++ push @gcc_cmd, $opt, @ARGV; ++ } ++ last if (@gcc_cmd); + } + + if (grep /\.c$/, @gcc_cmd) { +@@ -29,9 +86,33 @@ + } elsif (grep /\.[sS]$/, @gcc_cmd) { + # asm file, just do C preprocessor + @preprocess_c_cmd = (@gcc_cmd, "-E"); ++} elsif (grep /-(v|-version|dumpversion)/, @gcc_cmd) { ++ # pass -v/--version along, used during probing. Matching '-v' might have ++ # uninteded results but it doesn't matter much if gas-preprocessor or ++ # the compiler fails. ++ exec(@gcc_cmd); + } else { + die "Unrecognized input filetype"; + } ++if ($as_type eq "armasm") { ++ ++ $preprocess_c_cmd[0] = "cpp"; ++ ++ @preprocess_c_cmd = grep ! /^-nologo$/, @preprocess_c_cmd; ++ # Remove -ignore XX parameter pairs from preprocess_c_cmd ++ my $index = 1; ++ while ($index < $#preprocess_c_cmd) { ++ if ($preprocess_c_cmd[$index] eq "-ignore" and $index + 1 < $#preprocess_c_cmd) { ++ splice(@preprocess_c_cmd, $index, 2); ++ next; ++ } ++ $index++; ++ } ++ if (grep /^-MM$/, @preprocess_c_cmd) { ++ system(@preprocess_c_cmd) == 0 or die "Error running preprocessor"; ++ exit 0; ++ } ++} + + # if compiling, avoid creating an output file named '-.o' + if ((grep /^-c$/, @gcc_cmd) && !(grep /^-o/, @gcc_cmd)) { +@@ -45,50 +126,95 @@ + } + } + } +-@gcc_cmd = map { /\.[csS]$/ ? qw(-x assembler -) : $_ } @gcc_cmd; +-@preprocess_c_cmd = map { /\.o$/ ? "-" : $_ } @preprocess_c_cmd; +- +-my $comm; ++# replace only the '-o' argument with '-', avoids rewriting the make dependency ++# target specified with -MT to '-' ++my $index = 1; ++while ($index < $#preprocess_c_cmd) { ++ if ($preprocess_c_cmd[$index] eq "-o") { ++ $index++; ++ $preprocess_c_cmd[$index] = "-"; ++ } ++ $index++; ++} + +-# detect architecture from gcc binary name +-if ($gcc_cmd[0] =~ /arm/) { +- $comm = '@'; +-} elsif ($gcc_cmd[0] =~ /powerpc|ppc/) { +- $comm = '#'; ++my $tempfile; ++if ($as_type ne "armasm") { ++ @gcc_cmd = map { /\.[csS]$/ ? qw(-x assembler -) : $_ } @gcc_cmd; ++} else { ++ @preprocess_c_cmd = grep ! /^-c$/, @preprocess_c_cmd; ++ @preprocess_c_cmd = grep ! /^-m/, @preprocess_c_cmd; ++ ++ @preprocess_c_cmd = grep ! /^-G/, @preprocess_c_cmd; ++ @preprocess_c_cmd = grep ! /^-W/, @preprocess_c_cmd; ++ @preprocess_c_cmd = grep ! /^-Z/, @preprocess_c_cmd; ++ @preprocess_c_cmd = grep ! /^-fp/, @preprocess_c_cmd; ++ @preprocess_c_cmd = grep ! /^-EHsc$/, @preprocess_c_cmd; ++ @preprocess_c_cmd = grep ! /^-O/, @preprocess_c_cmd; ++ ++ @gcc_cmd = grep ! /^-G/, @gcc_cmd; ++ @gcc_cmd = grep ! /^-W/, @gcc_cmd; ++ @gcc_cmd = grep ! /^-Z/, @gcc_cmd; ++ @gcc_cmd = grep ! /^-fp/, @gcc_cmd; ++ @gcc_cmd = grep ! /^-EHsc$/, @gcc_cmd; ++ @gcc_cmd = grep ! /^-O/, @gcc_cmd; ++ ++ my @outfiles = grep /\.(o|obj)$/, @gcc_cmd; ++ $tempfile = $outfiles[0].".asm"; ++ ++ # Remove most parameters from gcc_cmd, which actually is the armasm command, ++ # which doesn't support any of the common compiler/preprocessor options. ++ @gcc_cmd = grep ! /^-D/, @gcc_cmd; ++ @gcc_cmd = grep ! /^-U/, @gcc_cmd; ++ @gcc_cmd = grep ! /^-m/, @gcc_cmd; ++ @gcc_cmd = grep ! /^-M/, @gcc_cmd; ++ @gcc_cmd = grep ! /^-c$/, @gcc_cmd; ++ @gcc_cmd = grep ! /^-I/, @gcc_cmd; ++ @gcc_cmd = map { /\.S$/ ? $tempfile : $_ } @gcc_cmd; + } + +-# look for -arch flag +-foreach my $i (1 .. $#gcc_cmd-1) { +- if ($gcc_cmd[$i] eq "-arch") { +- if ($gcc_cmd[$i+1] =~ /arm/) { +- $comm = '@'; +- } elsif ($gcc_cmd[$i+1] =~ /powerpc|ppc/) { +- $comm = '#'; ++# detect architecture from gcc binary name ++if (!$arch) { ++ if ($gcc_cmd[0] =~ /(arm64|aarch64|arm|powerpc|ppc)/) { ++ $arch = $1; ++ } else { ++ # look for -arch flag ++ foreach my $i (1 .. $#gcc_cmd-1) { ++ if ($gcc_cmd[$i] eq "-arch" and ++ $gcc_cmd[$i+1] =~ /(arm64|aarch64|arm|powerpc|ppc)/) { ++ $arch = $1; ++ } + } + } + } + + # assume we're not cross-compiling if no -arch or the binary doesn't have the arch name +-if (!$comm) { +- my $native_arch = qx/arch/; +- if ($native_arch =~ /arm/) { +- $comm = '@'; +- } elsif ($native_arch =~ /powerpc|ppc/) { +- $comm = '#'; +- } +-} ++$arch = qx/arch/ if (!$arch); + +-if (!$comm) { +- die "Unable to identify target architecture"; +-} ++die "Unknown target architecture '$arch'" if not exists $canonical_arch{$arch}; ++ ++$arch = $canonical_arch{$arch}; ++$comm = $comments{$arch}; ++my $inputcomm = $comm; ++$comm = ";" if $as_type =~ /armasm/; + + my %ppc_spr = (ctr => 9, + vrsave => 256); + +-open(ASMFILE, "-|", @preprocess_c_cmd) || die "Error running preprocessor"; ++open(INPUT, "-|", @preprocess_c_cmd) || die "Error running preprocessor"; ++ ++if ($ENV{GASPP_DEBUG}) { ++ open(ASMFILE, ">&STDOUT"); ++} else { ++ if ($as_type ne "armasm") { ++ open(ASMFILE, "|-", @gcc_cmd) or die "Error running assembler"; ++ } else { ++ open(ASMFILE, ">", $tempfile); ++ } ++} + + my $current_macro = ''; + my $macro_level = 0; ++my $rept_level = 0; + my %macro_lines; + my %macro_args; + my %macro_args_default; +@@ -96,39 +222,55 @@ + my $altmacro = 0; + my $in_irp = 0; + +-my @pass1_lines; ++my $num_repts; ++my @rept_lines; ++ ++my @irp_args; ++my $irp_param; ++ + my @ifstack; + + my %symbols; + ++my @sections; ++ ++my %literal_labels; # for ldr , = ++my $literal_num = 0; ++my $literal_expr = ".word"; ++$literal_expr = ".quad" if $arch eq "aarch64"; ++ ++my $thumb = 0; ++ ++my %thumb_labels; ++my %call_targets; ++my %mov32_targets; ++ ++my %neon_alias_reg; ++my %neon_alias_type; ++ ++my $temp_label_next = 0; ++my %last_temp_labels; ++my %next_temp_labels; ++ ++my %labels_seen; ++ ++my %aarch64_req_alias; ++ ++if ($force_thumb) { ++ parse_line(".thumb\n"); ++} ++ + # pass 1: parse .macro + # note that the handling of arguments is probably overly permissive vs. gas + # but it should be the same for valid cases +-while () { ++while () { + # remove all comments (to avoid interfering with evaluating directives) +- s/(? 0) { +- $ifstack[-1] = -$ifstack[-1]; ++ # Don't evaluate any new if statements if we're within ++ # a repetition or macro - they will be evaluated once ++ # the repetition is unrolled or the macro is expanded. ++ if (scalar(@rept_lines) == 0 and $macro_level == 0) { ++ if ($line =~ /\.endif/) { ++ pop(@ifstack); ++ return 1; ++ } elsif ($line =~ /\.elseif\s+(.*)/) { ++ if ($ifstack[-1] == 0) { ++ $ifstack[-1] = !!eval_expr($1); ++ } elsif ($ifstack[-1] > 0) { ++ $ifstack[-1] = -$ifstack[-1]; ++ } ++ return 1; ++ } elsif ($line =~ /\.else/) { ++ $ifstack[-1] = !$ifstack[-1]; ++ return 1; ++ } elsif (handle_if($line)) { ++ return 1; + } +- return 1; +- } elsif ($line =~ /\.else/) { +- $ifstack[-1] = !$ifstack[-1]; +- return 1; +- } elsif (handle_if($line)) { +- return 1; + } + + # discard lines in false .if blocks +@@ -210,31 +357,39 @@ sub parse_if_line { + } + + sub parse_line { +- my $line = @_[0]; ++ my $line = $_[0]; + + return if (parse_if_line($line)); + +- if (/\.macro/) { +- $macro_level++; +- if ($macro_level > 1 && !$current_macro) { +- die "nested macros but we don't have master macro"; +- } +- } elsif (/\.endm/) { +- $macro_level--; +- if ($macro_level < 0) { +- die "unmatched .endm"; +- } elsif ($macro_level == 0) { +- $current_macro = ''; +- return; ++ if (scalar(@rept_lines) == 0) { ++ if (/\.macro/) { ++ $macro_level++; ++ if ($macro_level > 1 && !$current_macro) { ++ die "nested macros but we don't have master macro"; ++ } ++ } elsif (/\.endm/) { ++ $macro_level--; ++ if ($macro_level < 0) { ++ die "unmatched .endm"; ++ } elsif ($macro_level == 0) { ++ $current_macro = ''; ++ return; ++ } ++ } ++ } ++ ++ if ($macro_level == 0) { ++ if ($line =~ /\.(rept|irp)/) { ++ $rept_level++; ++ } elsif ($line =~ /.endr/) { ++ $rept_level--; + } +- } elsif (/\.irp/ or /\.rept/) { +- $in_irp = 1; +- } elsif (/.endr/) { +- $in_irp = 0; + } + + if ($macro_level > 1) { + push(@{$macro_lines{$current_macro}}, $line); ++ } elsif (scalar(@rept_lines) and $rept_level >= 1) { ++ push(@rept_lines, $line); + } elsif ($macro_level == 0) { + expand_macros($line); + } else { +@@ -267,15 +422,17 @@ sub handle_set { + my $line = $_[0]; + if ($line =~ /\.set\s+(.*),\s*(.*)/) { + $symbols{$1} = eval_expr($2); ++ return 1; + } ++ return 0; + } + + sub expand_macros { +- my $line = @_[0]; ++ my $line = $_[0]; + + # handle .if directives; apple's assembler doesn't support important non-basic ones + # evaluating them is also needed to handle recursive macros +- if (!$in_irp && handle_if($line)) { ++ if (handle_if($line)) { + return; + } + +@@ -298,10 +455,69 @@ sub expand_macros { + + $line =~ s/\%([^,]*)/eval_expr($1)/eg if $altmacro; + +- handle_set($line); ++ # Strip out the .set lines from the armasm output ++ return if (handle_set($line) and $as_type eq "armasm"); ++ ++ if ($line =~ /\.rept\s+(.*)/) { ++ $num_repts = $1; ++ @rept_lines = ("\n"); ++ ++ # handle the possibility of repeating another directive on the same line ++ # .endr on the same line is not valid, I don't know if a non-directive is ++ if ($num_repts =~ s/(\.\w+.*)//) { ++ push(@rept_lines, "$1\n"); ++ } ++ $num_repts = eval_expr($num_repts); ++ } elsif ($line =~ /\.irp\s+([\d\w\.]+)\s*(.*)/) { ++ $in_irp = 1; ++ $num_repts = 1; ++ @rept_lines = ("\n"); ++ $irp_param = $1; ++ ++ # only use whitespace as the separator ++ my $irp_arglist = $2; ++ $irp_arglist =~ s/,/ /g; ++ $irp_arglist =~ s/^\s+//; ++ @irp_args = split(/\s+/, $irp_arglist); ++ } elsif ($line =~ /\.irpc\s+([\d\w\.]+)\s*(.*)/) { ++ $in_irp = 1; ++ $num_repts = 1; ++ @rept_lines = ("\n"); ++ $irp_param = $1; ++ ++ my $irp_arglist = $2; ++ $irp_arglist =~ s/,/ /g; ++ $irp_arglist =~ s/^\s+//; ++ @irp_args = split(//, $irp_arglist); ++ } elsif ($line =~ /\.endr/) { ++ my @prev_rept_lines = @rept_lines; ++ my $prev_in_irp = $in_irp; ++ my @prev_irp_args = @irp_args; ++ my $prev_irp_param = $irp_param; ++ my $prev_num_repts = $num_repts; ++ @rept_lines = (); ++ $in_irp = 0; ++ @irp_args = ''; + +- if ($line =~ /(\S+:|)\s*([\w\d\.]+)\s*(.*)/ && exists $macro_lines{$2}) { +- push(@pass1_lines, $1); ++ if ($prev_in_irp != 0) { ++ foreach my $i (@prev_irp_args) { ++ foreach my $origline (@prev_rept_lines) { ++ my $line = $origline; ++ $line =~ s/\\$prev_irp_param/$i/g; ++ $line =~ s/\\\(\)//g; # remove \() ++ parse_line($line); ++ } ++ } ++ } else { ++ for (1 .. $prev_num_repts) { ++ foreach my $origline (@prev_rept_lines) { ++ my $line = $origline; ++ parse_line($line); ++ } ++ } ++ } ++ } elsif ($line =~ /(\S+:|)\s*([\w\d\.]+)\s*(.*)/ && exists $macro_lines{$2}) { ++ handle_serialized_line($1); + my $macro = $2; + + # commas are optional here too, but are syntactically important because +@@ -313,7 +529,7 @@ sub expand_macros { + my $comma_sep_required = 0; + foreach (@arglist) { + # allow arithmetic/shift operators in macro arguments +- $_ =~ s/\s*(\+|-|\*|\/|<<|>>)\s*/$1/g; ++ $_ =~ s/\s*(\+|-|\*|\/|<<|>>|<|>)\s*/$1/g; + + my @whitespace_split = split(/\s+/, $_); + if (!@whitespace_split) { +@@ -377,39 +593,49 @@ sub expand_macros { + foreach (reverse sort {length $a <=> length $b} keys %replacements) { + $macro_line =~ s/\\$_/$replacements{$_}/g; + } ++ if ($altmacro) { ++ foreach (reverse sort {length $a <=> length $b} keys %replacements) { ++ $macro_line =~ s/\b$_\b/$replacements{$_}/g; ++ } ++ } + $macro_line =~ s/\\\@/$count/g; + $macro_line =~ s/\\\(\)//g; # remove \() + parse_line($macro_line); + } + } else { +- push(@pass1_lines, $line); ++ handle_serialized_line($line); + } + } + +-close(ASMFILE) or exit 1; +-if ($ENV{GASPP_DEBUG}) { +- open(ASMFILE, ">&STDOUT"); +-} else { +- open(ASMFILE, "|-", @gcc_cmd) or die "Error running assembler"; ++sub is_arm_register { ++ my $name = $_[0]; ++ if ($name eq "lr" or ++ $name eq "ip" or ++ $name =~ /^[rav]\d+$/) { ++ return 1; ++ } ++ return 0; + } + +-my @sections; +-my $num_repts; +-my @rept_lines; +- +-my %literal_labels; # for ldr , = +-my $literal_num = 0; +- +-my $thumb = 0; +- +-my %thumb_labels; +-my %call_targets; ++sub handle_local_label { ++ my $line = $_[0]; ++ my $num = $_[1]; ++ my $dir = $_[2]; ++ my $target = "$num$dir"; ++ if ($dir eq "b") { ++ $line =~ s/$target/$last_temp_labels{$num}/g; ++ } else { ++ my $name = "temp_label_$temp_label_next"; ++ $temp_label_next++; ++ push(@{$next_temp_labels{$num}}, $name); ++ $line =~ s/$target/$name/g; ++ } ++ return $line; ++} + +-my @irp_args; +-my $irp_param; ++sub handle_serialized_line { ++ my $line = $_[0]; + +-# pass 2: parse .rept and .if variants +-foreach my $line (@pass1_lines) { + # handle .previous (only with regard to .section not .subsection) + if ($line =~ /\.(section|text|const_data)/) { + push(@sections, $line); +@@ -425,7 +651,7 @@ sub expand_macros { + $thumb = 0 if $line =~ /\.code\s+32|\.arm/; + + # handle ldr , = +- if ($line =~ /(.*)\s*ldr([\w\s\d]+)\s*,\s*=(.*)/) { ++ if ($line =~ /(.*)\s*ldr([\w\s\d]+)\s*,\s*=(.*)/ and $as_type ne "armasm") { + my $label = $literal_labels{$3}; + if (!$label) { + $label = "Literal_$literal_num"; +@@ -433,14 +659,21 @@ sub expand_macros { + $literal_labels{$3} = $label; + } + $line = "$1 ldr$2, $label\n"; +- } elsif ($line =~ /\.ltorg/) { ++ } elsif ($line =~ /\.ltorg/ and $as_type ne "armasm") { + $line .= ".align 2\n"; + foreach my $literal (keys %literal_labels) { +- $line .= "$literal_labels{$literal}:\n .word $literal\n"; ++ $line .= "$literal_labels{$literal}:\n $literal_expr $literal\n"; + } + %literal_labels = (); + } + ++ # handle GNU as pc-relative relocations for adrp/add ++ if ($line =~ /(.*)\s*adrp([\w\s\d]+)\s*,\s*#?:pg_hi21:([^\s]+)/) { ++ $line = "$1 adrp$2, ${3}\@PAGE\n"; ++ } elsif ($line =~ /(.*)\s*add([\w\s\d]+)\s*,([\w\s\d]+)\s*,\s*#?:lo12:([^\s]+)/) { ++ $line = "$1 add$2, $3, ${4}\@PAGEOFF\n"; ++ } ++ + # thumb add with large immediate needs explicit add.w + if ($thumb and $line =~ /add\s+.*#([^@]+)/) { + $line =~ s/add/add.w/ if eval_expr($1) > 255; +@@ -449,15 +682,26 @@ sub expand_macros { + # mach-o local symbol names start with L (no dot) + $line =~ s/(? with ic as conditional code ++ if ($cond =~ /|$arm_cond_codes/) { ++ if (exists $thumb_labels{$label}) { ++ print ASMFILE ".thumb_func $label\n"; ++ } else { ++ $call_targets{$label}++; ++ } + } + } + +@@ -474,6 +718,16 @@ sub expand_macros { + } + } + ++ if ($line =~ /\.unreq\s+(.*)/) { ++ if (defined $neon_alias_reg{$1}) { ++ delete $neon_alias_reg{$1}; ++ delete $neon_alias_type{$1}; ++ return; ++ } elsif (defined $aarch64_req_alias{$1}) { ++ delete $aarch64_req_alias{$1}; ++ return; ++ } ++ } + # old gas versions store upper and lower case names on .req, + # but they remove only one on .unreq + if ($fix_unreq) { +@@ -483,81 +737,288 @@ sub expand_macros { + } + } + +- if ($line =~ /\.rept\s+(.*)/) { +- $num_repts = $1; +- @rept_lines = ("\n"); ++ if ($line =~ /(\w+)\s+\.(dn|qn)\s+(\w+)(?:\.(\w+))?(\[\d+\])?/) { ++ $neon_alias_reg{$1} = "$3$5"; ++ $neon_alias_type{$1} = $4; ++ return; ++ } ++ if (scalar keys %neon_alias_reg > 0 && $line =~ /^\s+v\w+/) { ++ # This line seems to possibly have a neon instruction ++ foreach (keys %neon_alias_reg) { ++ my $alias = $_; ++ # Require the register alias to match as an invididual word, not as a substring ++ # of a larger word-token. ++ if ($line =~ /\b$alias\b/) { ++ $line =~ s/\b$alias\b/$neon_alias_reg{$alias}/g; ++ # Add the type suffix. If multiple aliases match on the same line, ++ # only do this replacement the first time (a vfoo.bar string won't match v\w+). ++ $line =~ s/^(\s+)(v\w+)(\s+)/$1$2.$neon_alias_type{$alias}$3/; ++ } ++ } ++ } + +- # handle the possibility of repeating another directive on the same line +- # .endr on the same line is not valid, I don't know if a non-directive is +- if ($num_repts =~ s/(\.\w+.*)//) { +- push(@rept_lines, "$1\n"); ++ if ($arch eq "aarch64" or $as_type eq "armasm") { ++ # clang's integrated aarch64 assembler in Xcode 5 does not support .req/.unreq ++ if ($line =~ /\b(\w+)\s+\.req\s+(\w+)\b/) { ++ $aarch64_req_alias{$1} = $2; ++ return; + } +- $num_repts = eval_expr($num_repts); +- } elsif ($line =~ /\.irp\s+([\d\w\.]+)\s*(.*)/) { +- $in_irp = 1; +- $num_repts = 1; +- @rept_lines = ("\n"); +- $irp_param = $1; ++ foreach (keys %aarch64_req_alias) { ++ my $alias = $_; ++ # recursively resolve aliases ++ my $resolved = $aarch64_req_alias{$alias}; ++ while (defined $aarch64_req_alias{$resolved}) { ++ $resolved = $aarch64_req_alias{$resolved}; ++ } ++ $line =~ s/\b$alias\b/$resolved/g; ++ } ++ } ++ if ($arch eq "aarch64") { ++ # fix missing aarch64 instructions in Xcode 5.1 (beta3) ++ # mov with vector arguments is not supported, use alias orr instead ++ if ($line =~ /^\s*mov\s+(v\d[\.{}\[\]\w]+),\s*(v\d[\.{}\[\]\w]+)\b\s*$/) { ++ $line = " orr $1, $2, $2\n"; ++ } ++ # movi 16, 32 bit shifted variant, shift is optional ++ if ($line =~ /^\s*movi\s+(v[0-3]?\d\.(?:2|4|8)[hsHS])\s*,\s*(#\w+)\b\s*$/) { ++ $line = " movi $1, $2, lsl #0\n"; ++ } ++ # Xcode 5 misses the alias uxtl. Replace it with the more general ushll. ++ # Clang 3.4 misses the alias sxtl too. Replace it with the more general sshll. ++ if ($line =~ /^\s*(s|u)xtl(2)?\s+(v[0-3]?\d\.[248][hsdHSD])\s*,\s*(v[0-3]?\d\.(?:2|4|8|16)[bhsBHS])\b\s*$/) { ++ $line = " $1shll$2 $3, $4, #0\n"; ++ } ++ # clang 3.4 does not automatically use shifted immediates in add/sub ++ if ($as_type eq "clang" and ++ $line =~ /^(\s*(?:add|sub)s?) ([^#l]+)#([\d\+\-\*\/ <>]+)\s*$/) { ++ my $imm = eval $3; ++ if ($imm > 4095 and not ($imm & 4095)) { ++ $line = "$1 $2#" . ($imm >> 12) . ", lsl #12\n"; ++ } ++ } ++ if ($ENV{GASPP_FIX_XCODE5}) { ++ if ($line =~ /^\s*bsl\b/) { ++ $line =~ s/\b(bsl)(\s+v[0-3]?\d\.(\w+))\b/$1.$3$2/; ++ $line =~ s/\b(v[0-3]?\d)\.$3\b/$1/g; ++ } ++ if ($line =~ /^\s*saddl2?\b/) { ++ $line =~ s/\b(saddl2?)(\s+v[0-3]?\d\.(\w+))\b/$1.$3$2/; ++ $line =~ s/\b(v[0-3]?\d)\.\w+\b/$1/g; ++ } ++ if ($line =~ /^\s*dup\b.*\]$/) { ++ $line =~ s/\bdup(\s+v[0-3]?\d)\.(\w+)\b/dup.$2$1/g; ++ $line =~ s/\b(v[0-3]?\d)\.[bhsdBHSD](\[\d\])$/$1$2/g; ++ } ++ } ++ } + +- # only use whitespace as the separator +- my $irp_arglist = $2; +- $irp_arglist =~ s/,/ /g; +- $irp_arglist =~ s/^\s+//; +- @irp_args = split(/\s+/, $irp_arglist); +- } elsif ($line =~ /\.irpc\s+([\d\w\.]+)\s*(.*)/) { +- $in_irp = 1; +- $num_repts = 1; +- @rept_lines = ("\n"); +- $irp_param = $1; ++ if ($as_type eq "armasm") { ++ # Also replace variables set by .set ++ foreach (keys %symbols) { ++ my $sym = $_; ++ $line =~ s/\b$sym\b/$symbols{$sym}/g; ++ } + +- my $irp_arglist = $2; +- $irp_arglist =~ s/,/ /g; +- $irp_arglist =~ s/^\s+//; +- @irp_args = split(//, $irp_arglist); +- } elsif ($line =~ /\.endr/) { +- if ($in_irp != 0) { +- foreach my $i (@irp_args) { +- foreach my $origline (@rept_lines) { +- my $line = $origline; +- $line =~ s/\\$irp_param/$i/g; +- $line =~ s/\\\(\)//g; # remove \() +- if (!parse_if_line($line) && !handle_if($line)) { +- handle_set($line); +- print ASMFILE $line; +- } +- } ++ # Handle function declarations and keep track of the declared labels ++ if ($line =~ s/^\s*\.func\s+(\w+)/$1 PROC/) { ++ $labels_seen{$1} = 1; ++ } ++ ++ if ($line =~ s/^(\d+)://) { ++ # Convert local labels into unique labels. armasm (at least in ++ # RVCT) has something similar, but still different enough. ++ # By converting to unique labels we avoid any possible ++ # incompatibilities. ++ ++ my $num = $1; ++ foreach (@{$next_temp_labels{$num}}) { ++ $line = "$_\n" . $line; + } +- } else { +- for (1 .. $num_repts) { +- foreach my $line (@rept_lines) { +- if (!parse_if_line($line) && !handle_if($line)) { +- handle_set($line); +- print ASMFILE $line; +- } +- } ++ @next_temp_labels{$num} = (); ++ my $name = "temp_label_$temp_label_next"; ++ $temp_label_next++; ++ # The matching regexp above removes the label from the start of ++ # the line (which might contain an instruction as well), readd ++ # it on a separate line above it. ++ $line = "$name:\n" . $line; ++ $last_temp_labels{$num} = $name; ++ } ++ ++ if ($line =~ s/^(\w+):/$1/) { ++ # Skip labels that have already been declared with a PROC, ++ # labels must not be declared multiple times. ++ return if (defined $labels_seen{$1}); ++ $labels_seen{$1} = 1; ++ } elsif ($line !~ /(\w+) PROC/) { ++ # If not a label, make sure the line starts with whitespace, ++ # otherwise ms armasm interprets it incorrectly. ++ $line =~ s/^[\.\w]/\t$&/; ++ } ++ ++ ++ # Check branch instructions ++ if ($line =~ /(?:^|\n)\s*(\w+\s*:\s*)?(bl?x?(..)?(\.w)?)\s+(\w+)/) { ++ my $instr = $2; ++ my $cond = $3; ++ my $width = $4; ++ my $target = $5; ++ # Don't interpret e.g. bic as b with ic as conditional code ++ if ($cond !~ /|$arm_cond_codes/) { ++ # Not actually a branch ++ } elsif ($target =~ /(\d+)([bf])/) { ++ # The target is a local label ++ $line = handle_local_label($line, $1, $2); ++ $line =~ s/\b$instr\b/$&.w/ if $width eq ""; ++ } elsif (!is_arm_register($target)) { ++ $call_targets{$target}++; ++ } ++ } elsif ($line =~ /^\s*.h?word.*\b\d+[bf]\b/) { ++ while ($line =~ /\b(\d+)([bf])\b/g) { ++ $line = handle_local_label($line, $1, $2); + } + } +- @rept_lines = (); +- $in_irp = 0; +- @irp_args = ''; +- } elsif (scalar(@rept_lines)) { +- push(@rept_lines, $line); +- } else { +- handle_set($line); +- print ASMFILE $line; ++ ++ # ALIGN in armasm syntax is the actual number of bytes ++ if ($line =~ /\.align\s+(\d+)/) { ++ my $align = 1 << $1; ++ $line =~ s/\.align\s(\d+)/ALIGN $align/; ++ } ++ # Convert gas style [r0, :128] into armasm [r0@128] alignment specification ++ $line =~ s/\[([^\[]+),\s*:(\d+)\]/[$1\@$2]/g; ++ ++ # armasm treats logical values {TRUE} and {FALSE} separately from ++ # numeric values - logical operators and values can't be intermixed ++ # with numerical values. Evaluate ! and (a <> b) into numbers, ++ # let the assembler evaluate the rest of the expressions. This current ++ # only works for cases when ! and <> are used with actual constant numbers, ++ # we don't evaluate subexpressions here. ++ ++ # Evaluate ! ++ while ($line =~ /!\s*(\d+)/g) { ++ my $val = ($1 != 0) ? 0 : 1; ++ $line =~ s/!(\d+)/$val/; ++ } ++ # Evaluate (a > b) ++ while ($line =~ /\(\s*(\d+)\s*([<>])\s*(\d+)\s*\)/) { ++ my $val; ++ if ($2 eq "<") { ++ $val = ($1 < $3) ? 1 : 0; ++ } else { ++ $val = ($1 > $3) ? 1 : 0; ++ } ++ $line =~ s/\(\s*(\d+)\s*([<>])\s*(\d+)\s*\)/$val/; ++ } ++ ++ # Change a movw... #:lower16: into a mov32 pseudoinstruction ++ $line =~ s/^(\s*)movw(\s+\w+\s*,\s*)\#:lower16:(.*)$/$1mov32$2$3/; ++ # and remove the following, matching movt completely ++ $line =~ s/^\s*movt\s+\w+\s*,\s*\#:upper16:.*$//; ++ ++ if ($line =~ /^\s*mov32\s+\w+,\s*([a-zA-Z]\w*)/) { ++ $mov32_targets{$1}++; ++ } ++ ++ # Misc bugs/deficiencies: ++ # armasm seems unable to parse e.g. "vmov s0, s1" without a type ++ # qualifier, thus add .f32. ++ $line =~ s/^(\s+(?:vmov|vadd))(\s+s)/$1.f32$2/; ++ # armasm is unable to parse &0x - add spacing ++ $line =~ s/&0x/& 0x/g; ++ } ++ ++ if ($force_thumb) { ++ # Convert register post indexing to a separate add instruction. ++ # This converts e.g. "ldr r0, [r1], r2" into "ldr r0, [r1]", ++ # "add r1, r1, r2". ++ $line =~ s/(ldr|str)\s+(\w+),\s*\[(\w+)\],\s*(\w+)/$1 $2, [$3]\n\tadd $3, $3, $4/g; ++ ++ # Convert "mov pc, lr" into "bx lr", since the former only works ++ # for switching from arm to thumb (and only in armv7), but not ++ # from thumb to arm. ++ s/mov\s*pc\s*,\s*lr/bx lr/g; ++ ++ # Convert stmdb/ldmia with only one register into a plain str/ldr with post-increment/decrement ++ $line =~ s/stmdb\s+sp!\s*,\s*\{([^,-]+)\}/str $1, [sp, #-4]!/g; ++ $line =~ s/ldmia\s+sp!\s*,\s*\{([^,-]+)\}/ldr $1, [sp], #4/g; ++ ++ $line =~ s/\.arm/.thumb/x; + } +-} + +-print ASMFILE ".text\n"; +-print ASMFILE ".align 2\n"; +-foreach my $literal (keys %literal_labels) { +- my $label = $literal_labels{$literal}; +- print ASMFILE ".set Lval_$label, $literal\n"; +- print ASMFILE "$label: .word Lval_$label\n"; ++ # comment out unsupported directives ++ $line =~ s/\.type/$comm$&/x if $as_type =~ /^(apple-|armasm)/; ++ $line =~ s/\.func/$comm$&/x if $as_type =~ /^(apple-|clang)/; ++ $line =~ s/\.endfunc/$comm$&/x if $as_type =~ /^(apple-|clang)/; ++ $line =~ s/\.endfunc/ENDP/x if $as_type =~ /armasm/; ++ $line =~ s/\.ltorg/$comm$&/x if $as_type =~ /^(apple-|clang)/; ++ $line =~ s/\.ltorg/LTORG/x if $as_type eq "armasm"; ++ $line =~ s/\.size/$comm$&/x if $as_type =~ /^(apple-|armasm)/; ++ $line =~ s/\.fpu/$comm$&/x if $as_type =~ /^(apple-|armasm)/; ++ $line =~ s/\.arch/$comm$&/x if $as_type =~ /^(apple-|clang|armasm)/; ++ $line =~ s/\.object_arch/$comm$&/x if $as_type =~ /^(apple-|armasm)/; ++ $line =~ s/.section\s+.note.GNU-stack.*/$comm$&/x if $as_type =~ /^(apple-|armasm)/; ++ ++ $line =~ s/\.syntax/$comm$&/x if $as_type =~ /armasm/; ++ ++ $line =~ s/\.hword/.short/x; ++ ++ if ($as_type =~ /^apple-/) { ++ # the syntax for these is a little different ++ $line =~ s/\.global/.globl/x; ++ # also catch .section .rodata since the equivalent to .const_data is .section __DATA,__const ++ $line =~ s/(.*)\.rodata/.const_data/x; ++ $line =~ s/\.int/.long/x; ++ $line =~ s/\.float/.single/x; ++ } ++ if ($as_type eq "armasm") { ++ $line =~ s/\.global/EXPORT/x; ++ $line =~ s/\.int/dcd/x; ++ $line =~ s/\.long/dcd/x; ++ $line =~ s/\.float/dcfs/x; ++ $line =~ s/\.word/dcd/x; ++ $line =~ s/\.short/dcw/x; ++ $line =~ s/\.byte/dcb/x; ++ $line =~ s/\.thumb/THUMB/x; ++ $line =~ s/\.arm/ARM/x; ++ # The alignment in AREA is the power of two, just as .align in gas ++ $line =~ s/\.text/AREA |.text|, CODE, READONLY, ALIGN=2, CODEALIGN/; ++ $line =~ s/(\s*)(.*)\.rodata/$1AREA |.rodata|, DATA, READONLY, ALIGN=5/; ++ ++ $line =~ s/fmxr/vmsr/; ++ $line =~ s/fmrx/vmrs/; ++ $line =~ s/fadds/vadd/; ++ } ++ ++ # catch unknown section names that aren't mach-o style (with a comma) ++ if ($as_type =~ /apple-/ and $line =~ /.section ([^,]*)$/) { ++ die ".section $1 unsupported; figure out the mach-o section name and add it"; ++ } ++ ++ print ASMFILE $line; + } + +-map print(ASMFILE ".thumb_func $_\n"), +- grep exists $thumb_labels{$_}, keys %call_targets; ++if ($as_type ne "armasm") { ++ print ASMFILE ".text\n"; ++ print ASMFILE ".align 2\n"; ++ foreach my $literal (keys %literal_labels) { ++ print ASMFILE "$literal_labels{$literal}:\n $literal_expr $literal\n"; ++ } ++ ++ map print(ASMFILE ".thumb_func $_\n"), ++ grep exists $thumb_labels{$_}, keys %call_targets; ++} else { ++ map print(ASMFILE "\tIMPORT $_\n"), ++ grep ! exists $labels_seen{$_}, (keys %call_targets, keys %mov32_targets); ++ ++ print ASMFILE "\tEND\n"; ++} + ++close(INPUT) or exit 1; + close(ASMFILE) or exit 1; ++if ($as_type eq "armasm" and ! defined $ENV{GASPP_DEBUG}) { ++ system(@gcc_cmd) == 0 or die "Error running assembler"; ++} ++ ++END { ++ unlink($tempfile) if defined $tempfile; ++} + #exit 1 +-- +1.9.3 +