[EGIT] [legacy-imlib2] 02/02: test_load_2: Add full range color y4m image

2024-04-11 Thread Enlightenment Git

This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository legacy-imlib2.


View the commit online.
commit a2e6beb37c92697a2dd06ad4e4e93bdc3e6b196b
Author: Kim Woelders 
AuthorDate: Thu Apr 11 20:35:33 2024 +0200

test_load_2: Add full range color y4m image

Renamed the image as it isn't the usual 64x64 one.
---
 .../{icon-64.full_range.y4m => img-17x14.full_range.y4m}| Bin
 test/test_load_2.cpp|   1 +
 2 files changed, 1 insertion(+)

diff --git a/test/images/icon-64.full_range.y4m b/test/images/img-17x14.full_range.y4m
similarity index 100%
rename from test/images/icon-64.full_range.y4m
rename to test/images/img-17x14.full_range.y4m
diff --git a/test/test_load_2.cpp b/test/test_load_2.cpp
index 5a73a76..7a65e9d 100644
--- a/test/test_load_2.cpp
+++ b/test/test_load_2.cpp
@@ -106,6 +106,7 @@ static tii_ttii[] = {
{ "icon-64.yuv420paldv.y4m", 3810593176 },
{ "icon-64.aspect_unsupported.y4m",  2400380696 },
{ "icon-64.framerate_1_1.y4m",   2400380696 },
+   { "img-17x14.full_range.y4m", 839224907 },
 #endif
 
{ "icon-128.ico", 218415319 },


-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.





[EGIT] [legacy-imlib2] 01/02: Y4M loader: add support for full range color

2024-04-11 Thread Enlightenment Git

This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository legacy-imlib2.


View the commit online.
commit 98339a570865857ef31c7ec2c193491768e6bfb4
Author: Chema Gonzalez 
AuthorDate: Thu Apr 11 09:32:51 2024 -0700

Y4M loader: add support for full range color
---
 src/modules/loaders/loader_y4m.c   |  43 +++--
 test/images/icon-64.full_range.y4m | Bin 0 -> 775 bytes
 2 files changed, 37 insertions(+), 6 deletions(-)

diff --git a/src/modules/loaders/loader_y4m.c b/src/modules/loaders/loader_y4m.c
index 3ec517c..89040cd 100644
--- a/src/modules/loaders/loader_y4m.c
+++ b/src/modules/loaders/loader_y4m.c
@@ -62,6 +62,11 @@ typedef struct {
 Y4M_PARSE_ASPECT_32_27,
 Y4M_PARSE_ASPECT_OTHER,
 } aspect;
+enum {
+Y4M_PARSE_RANGE_UNSPECIFIED,
+Y4M_PARSE_RANGE_LIMITED,
+Y4M_PARSE_RANGE_FULL,
+} range;
 
 const void *frame_data;
 ptrdiff_t   frame_data_len;
@@ -224,9 +229,26 @@ y4m__parse_params(Y4mParse *res, const uint8_t **start, const uint8_t *end)
 ;
 }
 break;
-case 'X':  /* comments ignored */
-for (; p < end && *p != ' ' && *p != '\n'; ++p)
-;
+case 'X':
+if (y4m__match("COLORRANGE=LIMITED", 18, , end))
+res->range = Y4M_PARSE_RANGE_LIMITED;
+else if (y4m__match("COLORRANGE=FULL", 15, , end))
+res->range = Y4M_PARSE_RANGE_FULL;
+else if (y4m__match("COLORRANGE=", 11, , end))
+{
+#if IMLIB2_DEBUG
+charstr[1024];
+sscanf(pp, "%s", str);
+D("%s: unknown color range: '%s'\n", __func__, str);
+#endif
+return Y4M_PARSE_UNSUPPORTED;
+}
+else
+{
+/* other comments ignored */
+for (; p < end && *p != ' ' && *p != '\n'; ++p)
+;
+}
 break;
 default:
 return Y4M_PARSE_CORRUPTED;
@@ -402,16 +424,25 @@ _load(ImlibImage *im, int load_data)
 conv = conv_mono;
 break;
 case Y4M_PARSE_CS_422:
-conv = I422ToARGB;
+if (y4m.range == Y4M_PARSE_RANGE_FULL)
+conv = J422ToARGB;
+else
+conv = I422ToARGB;
 break;
 case Y4M_PARSE_CS_444:
-conv = I444ToARGB;
+if (y4m.range == Y4M_PARSE_RANGE_FULL)
+conv = J444ToARGB;
+else
+conv = I444ToARGB;
 break;
 case Y4M_PARSE_CS_420JPEG:
 case Y4M_PARSE_CS_420MPEG2:
 case Y4M_PARSE_CS_420PALDV:
 case Y4M_PARSE_CS_420:
-conv = I420ToARGB;
+if (y4m.range == Y4M_PARSE_RANGE_FULL)
+conv = J420ToARGB;
+else
+conv = I420ToARGB;
 break;
 default:
 DL("colour_space: %d\n", y4m.colour_space);
diff --git a/test/images/icon-64.full_range.y4m b/test/images/icon-64.full_range.y4m
new file mode 100644
index 000..5f548bf
Binary files /dev/null and b/test/images/icon-64.full_range.y4m differ


-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.





[EGIT] [efm2] 01/01: more work on mv - file count scan, status infra etc

2024-04-11 Thread Enlightenment Git

This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository efm2.


View the commit online.
commit de7f9a21a3bb96f61ec0787f919d3b24a59e668f
Author: Carsten Haitzler (Rasterman) 
AuthorDate: Thu Apr 11 10:01:45 2024 +0100

more work on mv - file count scan, status infra etc

also clean up some #includes we dont need... get this into git so it
isnt lost
---
 src/backends/default/meta.c   |   1 -
 src/backends/default/mv.c | 183 ++---
 src/backends/default/open.c   |   1 -
 src/backends/default/status.c | 266 ++
 src/backends/default/status.h |  32 +
 src/efm/efm_graph.c   |   1 -
 6 files changed, 440 insertions(+), 44 deletions(-)

diff --git a/src/backends/default/meta.c b/src/backends/default/meta.c
index 6ac8ce8..46fddb9 100644
--- a/src/backends/default/meta.c
+++ b/src/backends/default/meta.c
@@ -4,7 +4,6 @@
 #include 
 #include 
 #include 
-#include "eina_types.h"
 #include "sha.h"
 #include "meta.h"
 
diff --git a/src/backends/default/mv.c b/src/backends/default/mv.c
index abc9873..bda92dd 100644
--- a/src/backends/default/mv.c
+++ b/src/backends/default/mv.c
@@ -5,35 +5,163 @@
 #include 
 #include 
 
-#include 
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
 
-#include "cmd.h"
 #include "eina_strbuf.h"
+#include "eina_thread.h"
 #include "eina_types.h"
-#include "sha.h"
 #include "meta.h"
 #include "status.h"
 
 static const char *config_dir = NULL;
 
+// this scans a tree to build a potential operation progress count. it may
+// not be 100% right as the fs can change while the scan happens and after
+// so any move that devolves into a cp + rm isn't going to be atomic and
+// handle a changing fs while it works anyway
+static Eina_Bool
+fs_scan(const char *src)
+{
+  Eina_Iterator *it;
+  const char *s;
+
+  if (strlen(src) < 1) return EINA_FALSE;
+  struct stat st;
+
+  if (lstat(src, ) != 0)
+{
+  switch (errno)
+{
+case EACCES:
+  status_error(src, NULL, "Move - Permission denied for source");
+  return EINA_FALSE;
+  break;
+case EFAULT:
+  status_error(src, NULL, "Move - Memory Fault");
+  return EINA_FALSE;
+  break;
+case ELOOP:
+  status_error(src, NULL, "Move - Too many symlinks");
+  return EINA_FALSE;
+  break;
+case ENAMETOOLONG:
+  status_error(src, NULL, "Move - Name too long");
+  return EINA_FALSE;
+  break;
+case ENOENT: // ignore this error - file removed during scan ?
+  return EINA_TRUE;
+  break;
+case ENOMEM:
+  status_error(src, NULL, "Move - Out of memory");
+  return EINA_FALSE;
+  break;
+case ENOTDIR:
+  status_error(src, NULL, "Move - Source path component is not a directory");
+  return EINA_FALSE;
+  break;
+case EOVERFLOW:
+  status_error(src, NULL, "Move - Overflow");
+  return EINA_FALSE;
+  break;
+default:
+  break;
+}
+}
+  if (S_ISDIR(st.st_mode))
+{ // it's a dir - scan this recursively
+  it = eina_file_ls(src);
+  if (it)
+{
+  Eina_Strbuf *buf;
+
+  buf = eina_strbuf_new();
+  EINA_ITERATOR_FOREACH(it, s)
+  {
+// build new path "src/s"
+eina_strbuf_reset(buf);
+eina_strbuf_append(buf, src);
+// add / if src doesn't end in /
+if (src[strlen(src) - 1] != '/') eina_strbuf_append(buf, "/");
+eina_strbuf_append(buf, s);
+eina_stringshare_del(s);
+// fs_scan this file (or dir)
+// yes - this returns. we make leak our eina_file_ls data, strbuf etc.
+// dont care - we're going to exit the whole process in a bit
+if (!fs_scan(eina_strbuf_string_get(buf))) return EINA_FALSE;
+  }
+  eina_strbuf_free(buf);
+}
+}
+  else
+{
+  // the file itself count as 1 progress item - useful if it's a symlink
+  // or a char or block device etc.
+  status_count(1, ecore_file_file_get(src));
+  // in addition each byte in the file count as a progress item too
+  if (st.st_size > 0)
+status_count(st.st_size, ecore_file_file_get(src));
+}
+  return EINA_TRUE;  
+}
+
+static Eina_Bool
+fs_cp_rm(const char *src, const char *dst, Eina_Bool report_err)
+{
+  Eina_Bool res = EINA_TRUE;
+
+  if (!fs_scan(src)) return EINA_FALSE;
+
+  // if src is dir
+  //   fs_mkdir(dst)
+  //   for all files in src
+  // fs_cp_rm(src/file, dst/file, report_err)
+  // fs_utimes(src, dst)
+  // fs_chmod(src, dst)
+  // fs_chown(src, dst)
+  //   fs_utimes(src, dst)
+  //   fs_chmod(src, dst)
+  //   fs_chown(src, dst)
+  //   fs_rmdir(src)
+  // else
+  //   if (src is file)
+  //