Unified · Split
| @@ -639,6 +639,22 @@ static inline int reflecty(int y, int h) · 638 unmodified lines | ||
| 639 | 639 | return y; |
| 640 | 640 | } |
| 641 | 641 | |
| 642 | +/** | |
| 643 | + * Reflect x operation for equirect. | |
| 644 | + * | |
| 645 | + * @param x input horizontal position | |
| 646 | + * @param y input vertical position | |
| 647 | + * @param w input width | |
| 648 | + * @param h input height | |
| 649 | + */ | |
| 650 | +static inline int ereflectx(int x, int y, int w, int h) | |
| 651 | +{ | |
| 652 | + if (y < 0 || y >= h) | |
| 653 | + x += w / 2; | |
| 654 | + | |
| 655 | + return mod(x, w); | |
| 656 | +} | |
| 657 | + | |
| 642 | 658 | /** |
| 643 | 659 | * Reflect x operation. |
| 644 | 660 | * |
| @@ -1745,8 +1761,8 @@ static int xyz_to_equirect(const V360Context *s, · 1100 unmodified lines | ||
| 1745 | 1761 | |
| 1746 | 1762 | for (int i = 0; i < 4; i++) { |
| 1747 | 1763 | for (int j = 0; j < 4; j++) { |
| 1748 | − us[i][j] = mod(ui + j - 1, width); | |
| 1749 | − vs[i][j] = av_clip(vi + i - 1, 0, height - 1); | |
| 1764 | + us[i][j] = ereflectx(ui + j - 1, vi + i - 1, width, height); | |
| 1765 | + vs[i][j] = reflecty(vi + i - 1, height); | |
| 1750 | 1766 | } |
| 1751 | 1767 | } |
| 1752 | 1768 | |