Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

remove redundant calls to sws_rgb2rgb_init

The function is already called internally by swscale when creating a swscale context.
The calls would be necessary only if xbmc called the rgb conversion functions directly, which is not the case.
  • Loading branch information...
commit 3d6af41c22c7375c47e4b05fedcdbacc32305463 1 parent 4b398fe
CrystalP CrystalP authored
18 lib/DllSwScale.h
@@ -50,14 +50,8 @@ extern "C" {
50 50 #elif (defined HAVE_FFMPEG_SWSCALE_H)
51 51 #include <ffmpeg/swscale.h>
52 52 #endif
53   - #if (defined HAVE_LIBSWSCALE_RGB2RGB_H)
54   - #include <libswscale/rgb2rgb.h>
55   - #elif (defined HAVE_FFMPEG_RGB2RGB_H)
56   - #include <ffmpeg/rgb2rgb.h>
57   - #endif
58 53 #else
59 54 #include "libswscale/swscale.h"
60   - #include "libswscale/rgb2rgb.h"
61 55 #endif
62 56 }
63 57
@@ -94,11 +88,6 @@ class DllSwScaleInterface
94 88
95 89 virtual int sws_scale(struct SwsContext *context, uint8_t* src[], int srcStride[], int srcSliceY,
96 90 int srcSliceH, uint8_t* dst[], int dstStride[])=0;
97   - #if (! defined USE_EXTERNAL_FFMPEG)
98   - virtual void sws_rgb2rgb_init(int flags)=0;
99   - #elif (defined HAVE_LIBSWSCALE_RGB2RGB_H) || (defined HAVE_FFMPEG_RGB2RGB_H)
100   - virtual void sws_rgb2rgb_init(int flags)=0;
101   - #endif
102 91
103 92 virtual void sws_freeContext(struct SwsContext *context)=0;
104 93 };
@@ -122,11 +111,6 @@ class DllSwScale : public DllDynamic, public DllSwScaleInterface
122 111 virtual int sws_scale(struct SwsContext *context, uint8_t* src[], int srcStride[], int srcSliceY,
123 112 int srcSliceH, uint8_t* dst[], int dstStride[])
124 113 { return ::sws_scale(context, src, srcStride, srcSliceY, srcSliceH, dst, dstStride); }
125   - #if (! defined USE_EXTERNAL_FFMPEG)
126   - virtual void sws_rgb2rgb_init(int flags) { ::sws_rgb2rgb_init(flags); }
127   - #elif (defined HAVE_LIBSWSCALE_RGB2RGB_H) || (defined HAVE_FFMPEG_RGB2RGB_H)
128   - virtual void sws_rgb2rgb_init(int flags) { ::sws_rgb2rgb_init(flags); }
129   - #endif
130 114 virtual void sws_freeContext(struct SwsContext *context) { ::sws_freeContext(context); }
131 115
132 116 // DLL faking.
@@ -148,14 +132,12 @@ class DllSwScale : public DllDynamic, public DllSwScaleInterface
148 132 DEFINE_METHOD10(struct SwsContext *, sws_getContext, ( int p1, int p2, int p3, int p4, int p5, int p6, int p7,
149 133 SwsFilter * p8, SwsFilter * p9, double * p10))
150 134 DEFINE_METHOD7(int, sws_scale, (struct SwsContext *p1, uint8_t** p2, int *p3, int p4, int p5, uint8_t **p6, int *p7))
151   - DEFINE_METHOD1(void, sws_rgb2rgb_init, (int p1))
152 135 DEFINE_METHOD1(void, sws_freeContext, (struct SwsContext *p1))
153 136
154 137 BEGIN_METHOD_RESOLVE()
155 138 RESOLVE_METHOD(sws_getCachedContext)
156 139 RESOLVE_METHOD(sws_getContext)
157 140 RESOLVE_METHOD(sws_scale)
158   - RESOLVE_METHOD(sws_rgb2rgb_init)
159 141 RESOLVE_METHOD(sws_freeContext)
160 142 END_METHOD_RESOLVE()
161 143
6 xbmc/cores/VideoRenderers/LinuxRenderer.cpp
@@ -586,12 +586,6 @@ unsigned int CLinuxRenderer::PreInit()
586 586 if (!m_dllSwScale->Load())
587 587 CLog::Log(LOGERROR,"CLinuxRendererGL::PreInit - failed to load rescale libraries!");
588 588
589   - #if (! defined USE_EXTERNAL_FFMPEG)
590   - m_dllSwScale->sws_rgb2rgb_init(SWS_CPU_CAPS_MMX2);
591   - #elif (defined HAVE_LIBSWSCALE_RGB2RGB_H) || (defined HAVE_FFMPEG_RGB2RGB_H)
592   - m_dllSwScale->sws_rgb2rgb_init(SWS_CPU_CAPS_MMX2);
593   - #endif
594   -
595 589 return 0;
596 590 }
597 591
5 xbmc/cores/VideoRenderers/LinuxRendererATI.cpp
@@ -257,11 +257,6 @@ unsigned int CLinuxRendererATI::PreInit()
257 257 CLog::Log(LOGERROR,"CLinuxRendererATI::PreInit - failed to load rescale libraries!");
258 258 #endif
259 259
260   - #if (! defined USE_EXTERNAL_FFMPEG) && (defined HAS_DVD_SWSCALE)
261   - m_dllSwScale.sws_rgb2rgb_init(SWS_CPU_CAPS_MMX2);
262   - #elif ((defined HAVE_LIBSWSCALE_RGB2RGB_H) || (defined HAVE_FFMPEG_RGB2RGB_H)) && (defined HAS_DVD_SWSCALE)
263   - m_dllSwScale.sws_rgb2rgb_init(SWS_CPU_CAPS_MMX2);
264   - #endif
265 260 return true;
266 261 }
267 262
6 xbmc/cores/VideoRenderers/LinuxRendererGL.cpp
@@ -753,12 +753,6 @@ unsigned int CLinuxRendererGL::PreInit()
753 753 if (!m_dllSwScale->Load())
754 754 CLog::Log(LOGERROR,"CLinuxRendererGL::PreInit - failed to load rescale libraries!");
755 755
756   - #if (! defined USE_EXTERNAL_FFMPEG)
757   - m_dllSwScale->sws_rgb2rgb_init(SWS_CPU_CAPS_MMX2);
758   - #elif (defined HAVE_LIBSWSCALE_RGB2RGB_H) || (defined HAVE_FFMPEG_RGB2RGB_H)
759   - m_dllSwScale->sws_rgb2rgb_init(SWS_CPU_CAPS_MMX2);
760   - #endif
761   -
762 756 return true;
763 757 }
764 758
6 xbmc/cores/VideoRenderers/LinuxRendererGLES.cpp
@@ -650,12 +650,6 @@ unsigned int CLinuxRendererGLES::PreInit()
650 650 if (!m_dllSwScale->Load())
651 651 CLog::Log(LOGERROR,"CLinuxRendererGL::PreInit - failed to load rescale libraries!");
652 652
653   - #if (! defined USE_EXTERNAL_FFMPEG)
654   - m_dllSwScale->sws_rgb2rgb_init(SWS_CPU_CAPS_MMX2);
655   - #elif (defined HAVE_LIBSWSCALE_RGB2RGB_H) || (defined HAVE_FFMPEG_RGB2RGB_H)
656   - m_dllSwScale->sws_rgb2rgb_init(SWS_CPU_CAPS_MMX2);
657   - #endif
658   -
659 653 return true;
660 654 }
661 655
2  xbmc/cores/VideoRenderers/WinRenderer.cpp
@@ -187,8 +187,6 @@ bool CWinRenderer::UpdateRenderMethod()
187 187 if (!m_dllSwScale->Load())
188 188 CLog::Log(LOGERROR,"CDVDDemuxFFmpeg::Open - failed to load ffmpeg libraries");
189 189
190   - m_dllSwScale->sws_rgb2rgb_init(SWS_CPU_CAPS_MMX2);
191   -
192 190 if(!m_SWTarget.Create(m_sourceWidth, m_sourceHeight, 1, D3DUSAGE_DYNAMIC, D3DFMT_X8R8G8B8, D3DPOOL_DEFAULT))
193 191 {
194 192 CLog::Log(LOGNOTICE, __FUNCTION__": Failed to create sw render target.");
17 xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecFFmpeg.cpp
@@ -163,12 +163,6 @@ bool CDVDVideoCodecFFmpeg::Open(CDVDStreamInfo &hints, CDVDCodecOptions &options
163 163
164 164 m_dllAvCodec.avcodec_register_all();
165 165
166   - #if (! defined USE_EXTERNAL_FFMPEG)
167   - m_dllSwScale.sws_rgb2rgb_init(SWS_CPU_CAPS_MMX2);
168   - #elif (defined HAVE_LIBSWSCALE_RGB2RGB_H) || (defined HAVE_FFMPEG_RGB2RGB_H)
169   - m_dllSwScale.sws_rgb2rgb_init(SWS_CPU_CAPS_MMX2);
170   - #endif
171   -
172 166 m_bSoftware = hints.software;
173 167 m_pCodecContext = m_dllAvCodec.avcodec_alloc_context();
174 168
@@ -427,18 +421,9 @@ int CDVDVideoCodecFFmpeg::Decode(BYTE* pData, int iSize, double dts, double pts)
427 421 && m_pCodecContext->pix_fmt != PIX_FMT_YUVJ420P
428 422 && m_pHardware == NULL)
429 423 {
430   - if (!m_dllSwScale.IsLoaded())
431   - {
432   - if(!m_dllSwScale.Load())
  424 + if (!m_dllSwScale.IsLoaded() && !m_dllSwScale.Load())
433 425 return VC_ERROR;
434 426
435   - #if (! defined USE_EXTERNAL_FFMPEG)
436   - m_dllSwScale.sws_rgb2rgb_init(SWS_CPU_CAPS_MMX2);
437   - #elif (defined HAVE_LIBSWSCALE_RGB2RGB_H) || (defined HAVE_FFMPEG_RGB2RGB_H)
438   - m_dllSwScale.sws_rgb2rgb_init(SWS_CPU_CAPS_MMX2);
439   - #endif
440   - }
441   -
442 427 if (!m_pConvertFrame)
443 428 {
444 429 // Allocate an AVFrame structure

0 comments on commit 3d6af41

Please sign in to comment.
Something went wrong with that request. Please try again.