19 Commits

Author SHA1 Message Date
ec7953dcff Release 0.2.0
### Changed

- Updated Pybind11 to version 3.10, adding Python 3.11 support
- Updated install instructions in readme to reflect availability on PyPI
- Encode now skips .dds files in its input to prevent needless re-encoding

### Added

- Added the `-n` option for bc3 encoding to perform a BC3nm swizzle
2023-06-21 15:46:13 -07:00
3280fc74be Merge branch 'dev' 2023-06-21 15:45:35 -07:00
cbec93ed55 Skip any dds files when encoding 2023-06-21 15:41:08 -07:00
8509384bff Add -n option to encode bc3 which performs a BC3nm swizzle 2023-06-21 15:32:24 -07:00
1c86b09ca0 Fix docs link 2023-06-21 15:31:47 -07:00
d4eada16f9 Update readme with easier install directions 2023-06-21 15:11:17 -07:00
aed575edc6 Release 0.1.4
### Changed

- Updated Pybind11 to version 3.10, adding Python 3.11 support
2022-10-29 23:32:05 -07:00
4cdcb65f3a Merge branch 'dev' 2022-10-29 23:31:45 -07:00
0a66fcca20 Merge pull request #35 from drewcassidy/dependabot/github_actions/dev/pypa/cibuildwheel-2.11.2
Bump pypa/cibuildwheel from 2.5.0 to 2.11.2
2022-10-29 22:13:20 -07:00
37f0673e95 Merge pull request #33 from drewcassidy/dependabot/github_actions/dev/actions/setup-python-4.3.0
Bump actions/setup-python from 4.0.0 to 4.3.0
2022-10-29 22:12:59 -07:00
b81df96990 track python dependencies 2022-10-29 21:55:53 -07:00
38beffef05 Bump pypa/cibuildwheel from 2.5.0 to 2.11.2
Bumps [pypa/cibuildwheel](https://github.com/pypa/cibuildwheel) from 2.5.0 to 2.11.2.
- [Release notes](https://github.com/pypa/cibuildwheel/releases)
- [Changelog](https://github.com/pypa/cibuildwheel/blob/main/docs/changelog.md)
- [Commits](https://github.com/pypa/cibuildwheel/compare/2.5.0...v2.11.2)

---
updated-dependencies:
- dependency-name: pypa/cibuildwheel
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-29 21:05:59 -07:00
0dccd1cd07 Update pybind to 3.10 to allow Python 3.11 support 2022-10-29 21:03:12 -07:00
7ea104f712 Bump actions/setup-python from 4.0.0 to 4.3.0
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 4.0.0 to 4.3.0.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v4.0.0...v4.3.0)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-10 12:46:28 +00:00
9cb60f0ce2 Merge pull request #21 from drewcassidy/dependabot/github_actions/dev/actions/setup-python-4.0.0
Bump actions/setup-python from 3.1.2 to 4.0.0
2022-06-12 18:02:11 -07:00
15e0c68df6 Merge branch 'dev' into dependabot/github_actions/dev/actions/setup-python-4.0.0 2022-06-12 17:18:18 -07:00
9f54349556 Specify python versions 2022-06-12 17:16:18 -07:00
71c069d30c Bump actions/setup-python from 3.1.2 to 4.0.0
Bumps [actions/setup-python](https://github.com/actions/setup-python) from 3.1.2 to 4.0.0.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v3.1.2...v4.0.0)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-06-09 11:32:38 +00:00
661536e6f6 use scoped lock 2022-05-22 20:59:37 -07:00
8 changed files with 70 additions and 18 deletions

View File

@ -7,4 +7,10 @@ updates:
target-branch: "dev"
schedule:
# Check for updates to GitHub Actions every weekday
interval: "daily"
interval: "daily"
# Maintain dependencies for pip
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"

View File

@ -16,7 +16,9 @@ jobs:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v3.1.2
uses: actions/setup-python@v4.3.0
with:
python-version: '3.x'
- name: Install dependencies
run: |
@ -76,7 +78,7 @@ jobs:
platforms: arm64
- name: Build wheels
uses: pypa/cibuildwheel@2.5.0
uses: pypa/cibuildwheel@v2.11.2
env:
MACOSX_DEPLOYMENT_TARGET: "10.15"
CIBW_ARCHS_LINUX: ${{ matrix.arch[3] }}
@ -96,7 +98,9 @@ jobs:
- uses: actions/checkout@v3 # just need the changelog
- name: Set up Python
uses: actions/setup-python@v3.1.2
uses: actions/setup-python@v4.3.0
with:
python-version: '3.x'
- name: Install dependencies
run: |

View File

@ -2,6 +2,19 @@
All notable changes to this project will be documented in this file
## 0.2.0 - 2023-06-21
### Changed
- Updated Pybind11 to version 3.10, adding Python 3.11 support
- Updated install instructions in readme to reflect availability on PyPI
- Encode now skips .dds files in its input to prevent needless re-encoding
### Added
- Added the `-n` option for bc3 encoding to perform a BC3nm swizzle
## 0.1.3 - 2022-04-13
### Fixed

View File

@ -9,15 +9,32 @@ comparable to the original library.
## Installation
To install, first clone this repo and cd into it, then run:
### From Wheel (Easiest)
To install, run
```shell
pip install quicktex
```
If you are on macOS, You need to install openMP from homebrew:
```shell
brew install libomp
```
### From Source
To build from source, first clone this repo and cd into it, then run:
```shell
git submodule update --init
pip install .
```
and setuptools will take care of any dependencies for you.
If you are on macOS, it is recommended to first install openMP from homebrew to enable
If you are on macOS, it is recommended to first install openMP from homebrew to enable
multithreading, since it is not included in the default Apple Clang install:
```shell
@ -31,8 +48,6 @@ required dependencies for them, install with options like so:
pip install .[tests,stubs,docs]
```
Quicktex will be available on Pypi once it is out of alpha.
## Usage
```

View File

@ -4,7 +4,7 @@ requires = [
"setuptools_scm>=6.2",
"wheel",
"cmake>=3.18",
"pybind11~=2.6.1",
"pybind11~=2.10",
"ninja; sys_platform != 'win32'",
]
build-backend = "setuptools.build_meta"
@ -46,7 +46,7 @@ docs = [
stubs = ["pybind11-stubgen"]
[project.urls]
Docs = "https://quicktex.readthedocs.io/en/"
Docs = "https://quicktex.readthedocs.io/en/latest/"
Source = "https://github.com/drewcassidy/quicktex"
Changelog = "https://github.com/drewcassidy/quicktex/blob/main/CHANGELOG.md"
@ -81,5 +81,5 @@ manylinux-aarch64-image = "manylinux2014"
[tool.black]
line-length = 120 # 80-column is stupid
target-version = ['py37', 'py38', 'py39', 'py310']
target-version = ['py37', 'py38', 'py39', 'py310', 'py310']
skip-string-normalization = true

View File

@ -40,7 +40,7 @@ def path_pairs(inputs, output, suffix, extension):
"""
if len(inputs) < 1:
raise click.BadArgumentUsage('No input files were provided.')
raise click.BadArgumentUsage('No valid input files were provided.')
inpaths = [pathlib.Path(i) for i in inputs]

View File

@ -36,7 +36,8 @@ def encode():
help="Output file or directory. If outputting to a file, input filenames must be only a single item. By default, files are decoded in place.",
)
@click.argument('filenames', nargs=-1, type=click.Path(exists=True, readable=True, dir_okay=False))
def encode_format(encoder, four_cc, flip, remove, suffix, output, filenames):
def encode_format(encoder, four_cc, flip, remove, suffix, output, filenames, swizzle=False):
filenames = [f for f in filenames if not f.endswith('.dds')]
path_pairs = common.path_pairs(filenames, output, suffix, '.dds')
with click.progressbar(
@ -48,6 +49,11 @@ def encode_format(encoder, four_cc, flip, remove, suffix, output, filenames):
if flip:
image = image.transpose(Image.FLIP_TOP_BOTTOM)
if swizzle:
bands = image.split()
one = Image.new('L', image.size, 0xFF)
image = Image.merge('RGBA', (one, bands[1], bands[1], bands[0]))
dds.encode(image, encoder, four_cc).save(outpath)
if remove:
@ -107,8 +113,11 @@ def encode_auto(level, black, threecolor, flip, remove, suffix, output, filename
bc1_encoder = quicktex.s3tc.bc1.BC1Encoder(level, mode)
bc3_encoder = quicktex.s3tc.bc3.BC3Encoder(level)
filenames = [f for f in filenames if not f.endswith('.dds')]
path_pairs = common.path_pairs(filenames, output, suffix, '.dds')
assert len(filenames) > 0
with click.progressbar(
path_pairs, show_eta=False, show_pos=True, item_show_func=lambda x: str(x[0]) if x else ''
) as bar:
@ -175,9 +184,16 @@ def encode_bc1(level, black, threecolor, **kwargs):
default=18,
help='Quality level to use. Higher values = higher quality, but slower.',
)
def encode_bc3(level, **kwargs):
@click.option(
'-n/-N',
'--normal/--no-normal',
type=bool,
default=False,
help='Perform a BC3nm swizzle, copying the red channel into the alpha [default: no-normal]',
)
def encode_bc3(level, normal, **kwargs):
"""Encode images to BC4 (RGBA, 8-bit interpolated alpha)."""
encode_format.callback(quicktex.s3tc.bc3.BC3Encoder(level), 'DXT5', **kwargs)
encode_format.callback(quicktex.s3tc.bc3.BC3Encoder(level), 'DXT5', swizzle=normal, **kwargs)
@click.command('bc4')

View File

@ -58,7 +58,7 @@ template <size_t N> class OrderTable {
static bool Generate() {
static_assert(N == 4 || N == 3);
table_mutex.lock();
std::scoped_lock{table_mutex};
if (!generated) {
hashes = new std::array<Hash, HashCount>();
factors = new std::array<Vector4, OrderCount>();
@ -85,8 +85,6 @@ template <size_t N> class OrderTable {
generated = true;
}
table_mutex.unlock();
assert(generated);
return true;
}