int compress_mode = EET_COMPRESSION_HI;
int threads = 0;
int anotate = 0;
-int allow_etc1 = 0;
+int no_etc1 = 0;
static void
_edje_cc_log_cb(const Eina_Log_Domain *d,
"-no-lossy Do NOT allow images to be lossy\n"
"-no-comp Do NOT allow images to be stored with lossless compression\n"
"-no-raw Do NOT allow images to be stored with zero compression (raw)\n"
- "-etc1 Allow images to be stored as ETC1 in the EDJ file (incompatible with -no-lossy, default: no)\n"
+ "-no-etc1 Do NOT allow images to be stored as ETC1 (LOSSY_ETC1 will be then stored as JPEG)\n"
"-no-save Do NOT store the input EDC file in the EDJ file\n"
"-min-quality VAL Do NOT allow lossy images with quality < VAL (0-100)\n"
"-max-quality VAL Do NOT allow lossy images with quality > VAL (0-100)\n"
{
no_raw = 1;
}
- else if (!strcmp(argv[i], "-etc1") || !strcmp(argv[i], "--allow-etc1"))
+ else if (!strcmp(argv[i], "-no-etc1"))
{
- allow_etc1 = 1;
+ no_etc1 = 1;
}
else if (!strcmp(argv[i], "-no-save"))
{
exit(-1);
}
- if (allow_etc1 && no_lossy)
- {
- WRN("-etc1 and -no-lossy are not compatible, discarded -etc1");
- allow_etc1 = 0;
- }
-
pfx = eina_prefix_new(argv[0], /* argv[0] value (optional) */
main, /* an optional symbol to check path of */
"EDJE", /* env var prefix to use (XXX_PREFIX, XXX_BIN_DIR etc. */
extern int no_lossy;
extern int no_comp;
extern int no_raw;
-extern int allow_etc1;
+extern int no_etc1;
extern int no_save;
extern int min_quality;
extern int max_quality;
images {
image: "filename1.ext" COMP;
image: "filename2.ext" LOSSY 99;
+ image: "filename2.ext" LOSSY_ETC1 50;
set {
name: "image_name_used";
image {
Compression methods:
@li RAW: Uncompressed.
@li COMP: Lossless compression.
- @li LOSSY [0-100]: Lossy compression with quality from 0 to 100.
+ @li LOSSY [0-100]: JPEG lossy compression with quality from 0 to 100.
+ @li LOSSY_ETC1 [0-100]: ETC1 lossy texture compression with quality from 0 to 100.
@li USER: Do not embed the file, refer to the external file instead.
@endproperty
*/
img->entry = tmp;
img->id = edje_file->image_dir->entries_count - 1;
v = parse_enum(1,
- "RAW", 0,
- "COMP", 1,
- "LOSSY", 2,
- "USER", 3,
- NULL);
+ "RAW", 0,
+ "COMP", 1,
+ "LOSSY", 2,
+ "LOSSY_ETC1", 3,
+ "USER", 4,
+ NULL);
if (v == 0)
{
img->source_type = EDJE_IMAGE_SOURCE_TYPE_INLINE_PERFECT;
}
else if (v == 2)
{
- img->source_type = EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY;
- img->source_param = 0;
+ img->source_type = EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY;
+ img->source_param = 0;
}
else if (v == 3)
{
+ img->source_type = EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY_ETC1;
+ img->source_param = 0;
+ }
+ else if (v == 4)
+ {
img->source_type = EDJE_IMAGE_SOURCE_TYPE_EXTERNAL;
img->source_param = 0;
}
- if (img->source_type != EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY)
+ if ((img->source_type != EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY)
+ && (img->source_type != EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY_ETC1))
check_arg_count(2);
else
{
Compression methods:
@li RAW: Uncompressed.
@li COMP: Lossless compression.
- @li LOSSY [0-100]: Lossy compression with quality from 0 to 100.
+ @li LOSSY [0-100]: JPEG lossy compression with quality from 0 to 100.
+ @li LOSSY_ETC1 [0-100]: ETC1 lossy texture compression with quality from 0 to 100.
@li USER: Do not embed the file, refer to the external file instead.
@endproperty
**/
else if ((iw->img->source_type == EDJE_IMAGE_SOURCE_TYPE_INLINE_PERFECT) &&
(iw->img->source_param == 1))
mode = 1; /* COMPRESS */
+ else if (iw->img->source_type == EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY_ETC1)
+ mode = 3; /* LOSSY_ETC1 */
else
mode = 2; /* LOSSY */
if ((mode == 0) && (no_raw))
mode = 1; /* promote compression */
iw->img->source_param = 95;
}
+ if ((mode == 3) && (no_etc1)) mode = 2; /* demote etc1 to jpeg */
if ((mode == 2) && (no_lossy)) mode = 1; /* demote compression */
if ((mode == 1) && (no_comp))
{
qual = iw->img->source_param;
if (qual < min_quality) qual = min_quality;
if (qual > max_quality) qual = max_quality;
- if (!allow_etc1 || (iw->alpha)) lossy = EET_IMAGE_JPEG;
- else
- {
- lossy = EET_IMAGE_ETC1;
- comp = !no_comp;
- }
+ lossy = EET_IMAGE_JPEG;
+ }
+ if (mode == 3)
+ {
+ qual = iw->img->source_param;
+ if (qual < min_quality) qual = min_quality;
+ if (qual > max_quality) qual = max_quality;
+ // Enable TGV with LZ4. A bit redundant with EET compression.
+ comp = !no_comp;
+ lossy = EET_IMAGE_ETC1;
}
if (iw->alpha)
{
iw->alpha,
compress_mode,
0, 0);
- else if (mode == 2)
+ else
bytes = eet_data_image_write(iw->ef, buf,
iw->data, iw->w, iw->h,
iw->alpha,
rate = edje_edit_image_compression_rate_get(ed, img);
snprintf(buf, sizeof(buf), "LOSSY %d", rate);
return buf;
+ case EDJE_EDIT_IMAGE_COMP_LOSSY_ETC1:
+ rate = edje_edit_image_compression_rate_get(ed, img);
+ snprintf(buf, sizeof(buf), "LOSSY_ETC1 %d", rate);
+ return buf;
default:
ERR("Unknown compression type %d", type);
return "???";
EDJE_EDIT_IMAGE_COMP_RAW,
EDJE_EDIT_IMAGE_COMP_USER,
EDJE_EDIT_IMAGE_COMP_COMP,
- EDJE_EDIT_IMAGE_COMP_LOSSY
+ EDJE_EDIT_IMAGE_COMP_LOSSY,
+ EDJE_EDIT_IMAGE_COMP_LOSSY_ETC1
} Edje_Edit_Image_Comp;
struct _Edje_Edit_Script_Error
* @param image The name of the image.
*
* @return One of Image Compression types.
- * (EDJE_EDIT_IMAGE_COMP_RAW, EDJE_EDIT_IMAGE_COMP_USER, EDJE_EDIT_IMAGE_COMP_COMP, EDJE_EDIT_IMAGE_COMP_LOSSY).
+ * (EDJE_EDIT_IMAGE_COMP_RAW, EDJE_EDIT_IMAGE_COMP_USER, EDJE_EDIT_IMAGE_COMP_COMP, EDJE_EDIT_IMAGE_COMP_LOSSY[_ETC1]).
*/
EAPI Edje_Edit_Image_Comp edje_edit_image_compression_type_get(Evas_Object *obj, const char *image);
* @param image The name of the image.
*
* @return The compression rate (if the imnage is @c
- * EDJE_EDIT_IMAGE_COMP_LOSSY) or < 0, on errors.
+ * EDJE_EDIT_IMAGE_COMP_LOSSY[_ETC1]) or < 0, on errors.
*/
EAPI int edje_edit_image_compression_rate_get(Evas_Object *obj, const char *image);
switch(de->source_type)
{
- case EDJE_IMAGE_SOURCE_TYPE_INLINE_PERFECT:
- if (de->source_param == 0) // RAW
- return EDJE_EDIT_IMAGE_COMP_RAW;
- else // COMP
- return EDJE_EDIT_IMAGE_COMP_COMP;
- break;
- case EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY: // LOSSY
- return EDJE_EDIT_IMAGE_COMP_LOSSY;
- break;
- case EDJE_IMAGE_SOURCE_TYPE_EXTERNAL: // USER
- return EDJE_EDIT_IMAGE_COMP_USER;
- break;
+ case EDJE_IMAGE_SOURCE_TYPE_INLINE_PERFECT:
+ if (de->source_param == 0) // RAW
+ return EDJE_EDIT_IMAGE_COMP_RAW;
+ else // COMP
+ return EDJE_EDIT_IMAGE_COMP_COMP;
+ case EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY: // LOSSY
+ return EDJE_EDIT_IMAGE_COMP_LOSSY;
+ case EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY_ETC1: // LOSSY_ETC1
+ return EDJE_EDIT_IMAGE_COMP_LOSSY_ETC1;
+ case EDJE_IMAGE_SOURCE_TYPE_EXTERNAL: // USER
+ return EDJE_EDIT_IMAGE_COMP_USER;
}
return -1;
}
if (i == ed->file->image_dir->entries_count) return -1;
- if (de->source_type != EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY) return -2;
+ if ((de->source_type != EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY)
+ && (de->source_type != EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY_ETC1))
+ return -2;
return de->source_param;
}
if (comp == EDJE_EDIT_IMAGE_COMP_LOSSY)
BUF_APPENDF("LOSSY %d;\n",
edje_edit_image_compression_rate_get(obj, entry));
+ else if (comp == EDJE_EDIT_IMAGE_COMP_LOSSY_ETC1)
+ BUF_APPENDF("LOSSY_ETC1 %d;\n",
+ edje_edit_image_compression_rate_get(obj, entry));
else if (comp == EDJE_EDIT_IMAGE_COMP_RAW)
BUF_APPEND("RAW;\n");
else if (comp == EDJE_EDIT_IMAGE_COMP_USER)
#define EDJE_INF_MAX_W 100000
#define EDJE_INF_MAX_H 100000
-#define EDJE_IMAGE_SOURCE_TYPE_NONE 0
-#define EDJE_IMAGE_SOURCE_TYPE_INLINE_PERFECT 1
-#define EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY 2
-#define EDJE_IMAGE_SOURCE_TYPE_EXTERNAL 3
-#define EDJE_IMAGE_SOURCE_TYPE_LAST 4
+#define EDJE_IMAGE_SOURCE_TYPE_NONE 0
+#define EDJE_IMAGE_SOURCE_TYPE_INLINE_PERFECT 1
+#define EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY 2
+#define EDJE_IMAGE_SOURCE_TYPE_INLINE_LOSSY_ETC1 3
+#define EDJE_IMAGE_SOURCE_TYPE_EXTERNAL 4
+#define EDJE_IMAGE_SOURCE_TYPE_LAST 5
#define EDJE_SOUND_SOURCE_TYPE_NONE 0
#define EDJE_SOUND_SOURCE_TYPE_INLINE_RAW 1