History

swscale/utils: move handling of unscaled case to the end of init function

This way all context fields get initialized and can be used without needing to reinit the context

Michael Niedermayer committed 12 years ago

Commit fa988851 parent a2f088c1 file · +14 −14Browse files

Unified · Split

libswscale/utils.c+14−14
@@ -1334,20 +1334,6 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter, · 1333 unmodified lines
1334 1334
1335 FF_ALLOC_OR_GOTO(c, c->formatConvBuffer, FFALIGN(srcW*2+78, 16) * 2, fail);1335 FF_ALLOC_OR_GOTO(c, c->formatConvBuffer, FFALIGN(srcW*2+78, 16) * 2, fail);
1336 1336
1337 /* unscaled special cases */
1338 if (unscaled && !usesHFilter && !usesVFilter &&
1339 (c->srcRange == c->dstRange || isAnyRGB(dstFormat))) {
1340 ff_get_unscaled_swscale(c);
1341
1342 if (c->swscale) {
1343 if (flags & SWS_PRINT_INFO)
1344 av_log(c, AV_LOG_INFO,
1345 "using unscaled %s -> %s special converter\n",
1346 av_get_pix_fmt_name(srcFormat), av_get_pix_fmt_name(dstFormat));
1347 return 0;
1348 }
1349 }
1350
1351 c->srcBpc = 1 + desc_src->comp[0].depth_minus1;1337 c->srcBpc = 1 + desc_src->comp[0].depth_minus1;
1352 if (c->srcBpc < 8)1338 if (c->srcBpc < 8)
1353 c->srcBpc = 8;1339 c->srcBpc = 8;
@@ -1643,6 +1629,20 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter, · 289 unmodified lines
1643 c->chrXInc, c->chrYInc);1629 c->chrXInc, c->chrYInc);
1644 }1630 }
1645 1631
1632 /* unscaled special cases */
1633 if (unscaled && !usesHFilter && !usesVFilter &&
1634 (c->srcRange == c->dstRange || isAnyRGB(dstFormat))) {
1635 ff_get_unscaled_swscale(c);
1636
1637 if (c->swscale) {
1638 if (flags & SWS_PRINT_INFO)
1639 av_log(c, AV_LOG_INFO,
1640 "using unscaled %s -> %s special converter\n",
1641 av_get_pix_fmt_name(srcFormat), av_get_pix_fmt_name(dstFormat));
1642 return 0;
1643 }
1644 }
1645
1646 c->swscale = ff_getSwsFunc(c);1646 c->swscale = ff_getSwsFunc(c);
1647 return 0;1647 return 0;
1648fail: // FIXME replace things by appropriate error codes1648fail: // FIXME replace things by appropriate error codes

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