Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
This repository was archived by the owner on Jun 1, 2022. It is now read-only.
/etc2compPublic archive

License

NotificationsYou must be signed in to change notification settings

google/etc2comp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

This repo is no longer maintained.

Etc2Comp is a command line tool that converts textures (e.g. bitmaps)into theETC2format. The tool is built with a focus on encoding performanceto reduce the amount of time required to compile asset heavy applications aswell as reduce overall application size.

This repo provides source code that can be compiled into a binary. Thebinary can then be used to convert textures to the ETC2 format.

Important: This is not an official Google product. It is an experimentallibrary published as-is. Please see the CONTRIBUTORS.md file for informationabout questions or issues.

Setup

This project usesCMake to generate platform-specificbuild files:

  • Linux: make files
  • OS X: Xcode workspace files
  • Microsoft Windows: Visual Studio solution files
  • Note: CMake supports other formats, but this doc only provides steps forone of each platform for brevity.

Refer to each platform's setup section to setup your environment and buildan Etc2Comp binary. Then skip to the usage section of this page for examplesof how to use the library.

Setup for OS X

build tested on this config:OS X 10.9.5 i7 16GB RAMXcode 5.1.1cmake 3.2.3

Start by downloading and installing the following components if they are notalready installed on your development machine.

  • Xcode version 5.1.1, or greater
  • CMake version 3.2.3, or greater

To build the Etc2Comp binary:

  1. Open aTerminal window and navigate to the project directory.
  2. Runmkdir build_xcode
  3. Runcd build_xcode
  4. Runcmake -G Xcode ../
  5. OpenXcode and import thebuild_xcode/EtcTest.xcodeproj file.
  6. Open the Product menu and choose Build For -> Running.
  7. Once the build succeeds the binary located atbuild_xcode/EtcTool/Debug/EtcToolcan be executed.

OptionalXcode EtcTool ‘Run’ preferencesnote: if the build_xcode/EtcTest.xcodeproj is manually deleted then some Xcode preferenceswill need to be set by hand after cmake is run (these prefs are retained acrosscmake updates if the .xcodeproj is not deleted/removed)

  1. Set the active scheme to ‘EtcTool’
  2. Edit the scheme
  3. Select option ‘Run EtcTool’, then tab ‘Arguments’.Add this launch argument: ‘-argfile ../../EtcTool/args.txt’
  4. Select tab ‘Options’ and set a custom working directory to: ‘$(SRCROOT)/Build_Xcode/EtcTool’

SetUp for Windows

  1. Open aTerminal window and navigate to the project directory.
  2. Runmkdir build_vs
  3. Runcd build_vs
  4. Run CMAKE, noting what build version you need, and pointing to the parent directory as the source root;For VS 2013 :cmake -G "Visual Studio 12 2013 Win64" ../For VS 2015 :cmake -G "Visual Studio 14 2015 Win64" ../NOTE: To see what supported Visual Studio outputs there are, runcmake -G
  5. open the 'EtcTest' solution
  6. make the 'EtcTool' project the start up project
  7. (optional) in the project properties, under 'Debugging ->command arguments'add the argfile textfile thats included in the EtcTool directory.example: -argfile C:\etc2\EtcTool\Args.txt

Setup For Linux

The Linux build was tested on this config:Ubuntu desktop 14.04gcc/g++ 4.8cmake 2.8.12.2

  1. Verify linux has cmake and C++-11 capable g++ installed
  2. Open shell
  3. Runmkdir build_linux
  4. Runcd build_linux
  5. Runcmake ../
  6. Runmake
  7. navigate to the newly created EtcTool directorycd EtcTool
  8. run the executable:./EtcTool -argfile ../../EtcTool/args.txt

Skip to theUsage section for more information about using thetool.

Usage

Command Line Usage

EtcTool can be run from the command line with the following usage:etctool.exe source_image [options ...] -output encoded_image

The encoder will use an array of RGBA floats read from the source_image to createan ETC1 or ETC2 encoded image in encoded_image. The RGBA floats should be in therange [0:1].

Options:

-analyze <analysis_folder>-argfile <arg_file>           additional command line arguments read from a file-blockAtHV <H V>              encodes a single block that contains the                              pixel specified by the H V coordinates-compare <comparison_image>   compares source_image to comparison_image-effort <amount>              number between 0 and 100 to specify the encoding quality                               (100 is the highest quality)-errormetric <error_metric>   specify the error metric, the options are                              rgba, rgbx, rec709, numeric and normalxyz-format <etc_format>          ETC1, RGB8, SRGB8, RGBA8, SRGB8, RGB8A1,                              SRGB8A1 or R11-help                         prints this message-jobs or -j <thread_count>    specifies the number of threads (default=1)-normalizexyz                 normalize RGB to have a length of 1-verbose or -v                shows status information during the encoding                              process-mipmaps or -m <mip_count>    sets the maximum number of mipaps to generate (default=1)-mipwrap or -w <x|y|xy>       sets the mipmap filter wrap mode (default=clamp)
  • -analyze will run an analysis of the encoding and place it in folder"analysis_folder" (e.g. ../analysis/kodim05). within the analysis_folder, a folderwill be created with a name of the current date/time (e.g. 20151204_153306). thisdate/time folder is used to compare encodings of the same texture over time.
    within the date/time folder is a text file with several encoding stats and a 2x pngimage showing the encoding mode for each 4x4 block.

  • -argfile allows additional command line arguments to be placed in a text file

  • -blockAtHV selects the 4x4 pixel subset of the source image at position (H,V).
    This is mainly used for debugging

  • -compare compares the source image to the created encoded image. The encodingwill dictate what error analysis is used in the comparison.

  • -effort uses an "amount" between 0 and 100 to determine how much additional effortto apply during the encoding.

  • -errormetric selects the fitting algorithm used by the encoder. "rgba" calculatesRMS error using RGB components that are weighted by A. "rgbx" calculates RMS errorusing RGBA components, where A is treated as an additional data channel, instead ofas alpha. "rec709" is similar to "rgba", except the RGB components are also weightedaccording to Rec709. "numeric" calculates RMS error using unweighted RGBA components.
    "normalize" calculates error based on dot product and vector length for RGB and RMSerror for A.

  • -help prints out the usage message

  • -jobs enables multi-threading to speed up image encoding

  • -normalizexyz normalizes the source RGB to have a length of 1.

  • -verbose shows information on the current encoding process. It will then display thePSNR and time time it took to encode the image.

  • -mipmaps takes an argument that specifies how many mipmaps to generate from thesource image. The mipmaps are generated with a lanczos3 filter using edge clamping.If the mipmaps option is not specified no mipmaps are created.

  • -mipwrap takes an argument that specifies the mipmap filter wrap mode. The optionsare "x", "y" and "xy" which specify wrapping in x only, y only or x and y respectively.The default options are clamping in both x and y.

Note: Path names can use slashes or backslashes. The tool will convert theslashes to the appropriate polarity for the current platform.

API

The library supports two different APIs - a C-like API that is not heavilyclass-based and a class-based API.

main() in EtcTool.cpp contains an example of both APIs.

The Encode() method now returns an EncodingStatus that contains bit flags forreporting various warnings and flags encountered when encoding.

Copyright

Copyright 2015 Etc2Comp Authors.

Licensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp