History

swscale/swscale: remove useless code

Ruiling Song committed 6 years ago

Commit 4700f7d1 parent 9f567c43 files · +3 −21Browse files

Unified · Split

3 files
  1. libswscale/swscale.c +1 −15
  2. libswscale/swscale_internal.h +1 −4
  3. libswscale/x86/swscale.c +1 −2
libswscale/swscale.c+1−15
@@ -266,8 +266,6 @@ static int swscale(SwsContext *c, const uint8_t *src[], · 265 unmodified lines
266 266
267 /* vars which will change and which we need to store back in the context */267 /* vars which will change and which we need to store back in the context */
268 int dstY = c->dstY;268 int dstY = c->dstY;
269 int lumBufIndex = c->lumBufIndex;
270 int chrBufIndex = c->chrBufIndex;
271 int lastInLumBuf = c->lastInLumBuf;269 int lastInLumBuf = c->lastInLumBuf;
272 int lastInChrBuf = c->lastInChrBuf;270 int lastInChrBuf = c->lastInChrBuf;
273 271
@@ -336,8 +334,6 @@ static int swscale(SwsContext *c, const uint8_t *src[], · 62 unmodified lines
336 * will not get executed. This is not really intended but works334 * will not get executed. This is not really intended but works
337 * currently, so people might do it. */335 * currently, so people might do it. */
338 if (srcSliceY == 0) {336 if (srcSliceY == 0) {
339 lumBufIndex = -1;
340 chrBufIndex = -1;
341 dstY = 0;337 dstY = 0;
342 lastInLumBuf = -1;338 lastInLumBuf = -1;
343 lastInChrBuf = -1;339 lastInChrBuf = -1;
@@ -461,7 +457,6 @@ static int swscale(SwsContext *c, const uint8_t *src[], · 117 unmodified lines
461 desc[i].process(c, &desc[i], firstPosY, lastPosY - firstPosY + 1);457 desc[i].process(c, &desc[i], firstPosY, lastPosY - firstPosY + 1);
462 }458 }
463 459
464 lumBufIndex += lastLumSrcY - lastInLumBuf;
465 lastInLumBuf = lastLumSrcY;460 lastInLumBuf = lastLumSrcY;
466 461
467 if (cPosY < lastChrSrcY + 1) {462 if (cPosY < lastChrSrcY + 1) {
@@ -469,20 +464,13 @@ static int swscale(SwsContext *c, const uint8_t *src[], · 1 unmodified line
469 desc[i].process(c, &desc[i], firstCPosY, lastCPosY - firstCPosY + 1);464 desc[i].process(c, &desc[i], firstCPosY, lastCPosY - firstCPosY + 1);
470 }465 }
471 466
472 chrBufIndex += lastChrSrcY - lastInChrBuf;
473 lastInChrBuf = lastChrSrcY;467 lastInChrBuf = lastChrSrcY;
474 468
475 // wrap buf index around to stay inside the ring buffer
476 if (lumBufIndex >= vLumFilterSize)
477 lumBufIndex -= vLumFilterSize;
478 if (chrBufIndex >= vChrFilterSize)
479 chrBufIndex -= vChrFilterSize;
480 if (!enough_lines)469 if (!enough_lines)
481 break; // we can't output a dstY line so let's try with the next slice470 break; // we can't output a dstY line so let's try with the next slice
482 471
483#if HAVE_MMX_INLINE472#if HAVE_MMX_INLINE
484 ff_updateMMXDitherTables(c, dstY, lumBufIndex, chrBufIndex,473 ff_updateMMXDitherTables(c, dstY);
485 lastInLumBuf, lastInChrBuf);
486#endif474#endif
487 if (should_dither) {475 if (should_dither) {
488 c->chrDither8 = ff_dither_8x8_128[chrDstY & 7];476 c->chrDither8 = ff_dither_8x8_128[chrDstY & 7];
@@ -524,8 +512,6 @@ static int swscale(SwsContext *c, const uint8_t *src[], · 35 unmodified lines
524 512
525 /* store changed local vars back in the context */513 /* store changed local vars back in the context */
526 c->dstY = dstY;514 c->dstY = dstY;
527 c->lumBufIndex = lumBufIndex;
528 c->chrBufIndex = chrBufIndex;
529 c->lastInLumBuf = lastInLumBuf;515 c->lastInLumBuf = lastInLumBuf;
530 c->lastInChrBuf = lastInChrBuf;516 c->lastInChrBuf = lastInChrBuf;
531 517
libswscale/swscale_internal.h+1−4
@@ -350,8 +350,6 @@ typedef struct SwsContext { · 349 unmodified lines
350 //@{350 //@{
351 int lastInLumBuf; ///< Last scaled horizontal luma/alpha line from source in the ring buffer.351 int lastInLumBuf; ///< Last scaled horizontal luma/alpha line from source in the ring buffer.
352 int lastInChrBuf; ///< Last scaled horizontal chroma line from source in the ring buffer.352 int lastInChrBuf; ///< Last scaled horizontal chroma line from source in the ring buffer.
353 int lumBufIndex; ///< Index in ring buffer of the last scaled horizontal luma/alpha line from source.
354 int chrBufIndex; ///< Index in ring buffer of the last scaled horizontal chroma line from source.
355 //@}353 //@}
356 354
357 uint8_t *formatConvBuffer;355 uint8_t *formatConvBuffer;
@@ -635,8 +633,7 @@ int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4], · 277 unmodified lines
635void ff_yuv2rgb_init_tables_ppc(SwsContext *c, const int inv_table[4],633void ff_yuv2rgb_init_tables_ppc(SwsContext *c, const int inv_table[4],
636 int brightness, int contrast, int saturation);634 int brightness, int contrast, int saturation);
637 635
638void ff_updateMMXDitherTables(SwsContext *c, int dstY, int lumBufIndex, int chrBufIndex,636void ff_updateMMXDitherTables(SwsContext *c, int dstY);
639 int lastInLumBuf, int lastInChrBuf);
640 637
641av_cold void ff_sws_init_range_convert(SwsContext *c);638av_cold void ff_sws_init_range_convert(SwsContext *c);
642 639
libswscale/x86/swscale.c+1−2
@@ -79,8 +79,7 @@ DECLARE_ASM_ALIGNED(8, const uint64_t, ff_w1111) = 0x0001000100010001ULL; · 78 unmodified lines
79#include "swscale_template.c"79#include "swscale_template.c"
80#endif80#endif
81 81
82void ff_updateMMXDitherTables(SwsContext *c, int dstY, int lumBufIndex, int chrBufIndex,82void ff_updateMMXDitherTables(SwsContext *c, int dstY)
83 int lastInLumBuf, int lastInChrBuf)
84{83{
85 const int dstH= c->dstH;84 const int dstH= c->dstH;
86 const int flags= c->flags;85 const int flags= c->flags;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t