mpeg5 / xeve

eXtra-fast Essential Video Encoder, MPEG-5 EVC (Essential Video Coding)
Other
164 stars 39 forks source link

Undefined behaviour in xeve_mc.c #130

Open dariusz-f opened 1 month ago

dariusz-f commented 1 month ago

When building a project using the clang compiler, the following warnings appear: This may provide to undefined behavior under different compilers.

/xeve/src_base/xeve_mc.c:324:37: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
    min_clip[MV_X] = (-MAX_CU_SIZE) << 2;
                     ~~~~~~~~~~~~~~ ^
/xeve/src_base/xeve_mc.c:325:37: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
    min_clip[MV_Y] = (-MAX_CU_SIZE) << 2;
                     ~~~~~~~~~~~~~~ ^
src_main/CMakeFiles/xeve_dynamic.dir/__/src_base/xeve_mc.c.o
/xeve/src_base/xeve_mc.c:324:37: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
    min_clip[MV_X] = (-MAX_CU_SIZE) << 2;
                     ~~~~~~~~~~~~~~ ^
/xeve/src_base/xeve_mc.c:325:37: warning: shifting a negative signed value is undefined [-Wshift-negative-value]
    min_clip[MV_Y] = (-MAX_CU_SIZE) << 2;
                     ~~~~~~~~~~~~~~ ^
kpchoi commented 1 month ago

@dariusz-f I guess that the above errors seem to be bug. It should be " -(MAX_CU_SIZE << 2)". Could you kindly push PR simply?

dariusz-f commented 1 month ago

Fixed in #139

dariusz-f commented 1 month ago

Fixed also in xevd https://github.com/mpeg5/xevd/pull/74