[FFmpeg-devel] [PATCH v4] examples/extract_mvs.c: dont disply motionless vectors

2020-03-20 Thread numberwolf
Reviewed-by: Paul B Mahol 
Signed-off-by: numberwolf 
---


Here, don't need show motionless vectors,because they're useless.
And remove comments.
 doc/examples/extract_mvs.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/doc/examples/extract_mvs.c b/doc/examples/extract_mvs.c
index de31ccd..af62e02 100644
--- a/doc/examples/extract_mvs.c
+++ b/doc/examples/extract_mvs.c
@@ -60,6 +60,9 @@ static int decode_packet(const AVPacket *pkt)
 const AVMotionVector *mvs = (const AVMotionVector *)sd->data;
 for (i = 0; i < sd->size / sizeof(*mvs); i++) {
 const AVMotionVector *mv = [i];
+if (mv->src_x == mv->dst_x && mv->src_y == mv->dst_y) {
+continue;
+}
 printf("%d,%2d,%2d,%2d,%4d,%4d,%4d,%4d,0x%"PRIx64"\n",
 video_frame_count, mv->source,
 mv->w, mv->h, mv->src_x, mv->src_y,
-- 
2.17.2 (Apple Git-113)

Thanks
Numberwolf

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v3] examples/extract_mvs.c: don't disply motionless vectors

2020-03-17 Thread numberwolf
Signed-off-by: numberwolf 
---



Here, don't need show motionless vectors,because they're useless.
 doc/examples/extract_mvs.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/doc/examples/extract_mvs.c b/doc/examples/extract_mvs.c
index de31ccd..f6d19b7 100644
--- a/doc/examples/extract_mvs.c
+++ b/doc/examples/extract_mvs.c
@@ -60,6 +60,13 @@ static int decode_packet(const AVPacket *pkt)
 const AVMotionVector *mvs = (const AVMotionVector *)sd->data;
 for (i = 0; i < sd->size / sizeof(*mvs); i++) {
 const AVMotionVector *mv = [i];
+
+// dont need show motionless vectors
+// because they're useless
+if (mv->src_x == mv->dst_x && mv->src_y == mv->dst_y) {
+continue;
+}
+
 printf("%d,%2d,%2d,%2d,%4d,%4d,%4d,%4d,0x%"PRIx64"\n",
 video_frame_count, mv->source,
 mv->w, mv->h, mv->src_x, mv->src_y,
-- 
2.17.2 (Apple Git-113)

Thanks
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v2] not display motionless vectors in examples/extract_mvs.c

2020-03-16 Thread numberwolf
Here, dont need show motionless vectors,because they're useless.
(Sorry about I forget to remove the 'printf' on previous version.)

Signed-off-by: numberwolf 
---
 doc/examples/extract_mvs.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/doc/examples/extract_mvs.c b/doc/examples/extract_mvs.c
index de31ccd..eaf7816 100644
--- a/doc/examples/extract_mvs.c
+++ b/doc/examples/extract_mvs.c
@@ -60,6 +60,14 @@ static int decode_packet(const AVPacket *pkt)
 const AVMotionVector *mvs = (const AVMotionVector *)sd->data;
 for (i = 0; i < sd->size / sizeof(*mvs); i++) {
 const AVMotionVector *mv = [i];
+
+// dont need show motionless vectors
+// because they're useless
+if (mv->src_x == mv->dst_x && mv->src_y == mv->dst_y) {
+printf("extract_mvs skip\n");
+continue;
+}
+
 printf("%d,%2d,%2d,%2d,%4d,%4d,%4d,%4d,0x%"PRIx64"\n",
 video_frame_count, mv->source,
 mv->w, mv->h, mv->src_x, mv->src_y,
-- 
2.17.2 (Apple Git-113)

Thanks
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v1] not display motionless vectors in examples/extract_mvs.c

2020-03-16 Thread numberwolf
dont need show motionless vectors
because they're useless

Signed-off-by: numberwolf 
---
 doc/examples/extract_mvs.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/doc/examples/extract_mvs.c b/doc/examples/extract_mvs.c
index de31ccd..eaf7816 100644
--- a/doc/examples/extract_mvs.c
+++ b/doc/examples/extract_mvs.c
@@ -60,6 +60,14 @@ static int decode_packet(const AVPacket *pkt)
 const AVMotionVector *mvs = (const AVMotionVector *)sd->data;
 for (i = 0; i < sd->size / sizeof(*mvs); i++) {
 const AVMotionVector *mv = [i];
+
+// dont need show motionless vectors
+// because they're useless
+if (mv->src_x == mv->dst_x && mv->src_y == mv->dst_y) {
+printf("extract_mvs skip\n");
+continue;
+}
+
 printf("%d,%2d,%2d,%2d,%4d,%4d,%4d,%4d,0x%"PRIx64"\n",
 video_frame_count, mv->source,
 mv->w, mv->h, mv->src_x, mv->src_y,
-- 
2.17.2 (Apple Git-113)

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH v2] Encapsulation macro to get width and height of macroblock

2020-03-16 Thread numberwolf
modify: using the IS_* macros
most of mb's checked oper are defined in mpegutils' marcos, so mb's checked 
oper about width/height should be put it together with others

Signed-off-by: numberwolf 
---
 libavcodec/mpegutils.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mpegutils.h b/libavcodec/mpegutils.h
index ed59716..bcf604f 100644
--- a/libavcodec/mpegutils.h
+++ b/libavcodec/mpegutils.h
@@ -95,8 +95,8 @@
 #define IS_QUANT(a)  ((a) & MB_TYPE_QUANT)
 #define IS_DIR(a, part, list) ((a) & (MB_TYPE_P0L0 << ((part) + 2 * (list
 
-#define MB_SIZE_WIDTH(a)  (((a) & MB_TYPE_8x8) || ((a) & MB_TYPE_8x16)) ? 
8 : 16
-#define MB_SIZE_HEIGHT(a) (((a) & MB_TYPE_8x8) || ((a) & MB_TYPE_16x8)) ? 
8 : 16
+#define MB_SIZE_WIDTH(a)  (IS_8X8(a) || IS_8X16(a)) ? 8 : 16
+#define MB_SIZE_HEIGHT(a) (IS_8X8(a) || IS_16X8(a)) ? 8 : 16
 
 // does this mb use listX, note does not work if subMBs
 #define USES_LIST(a, list) ((a) & ((MB_TYPE_P0L0 | MB_TYPE_P1L0) << (2 * 
(list
-- 
2.17.2 (Apple Git-113)

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] Encapsulation func to get width and height most of mb's checked oper are defined in mpegutils' marcos, so mb's checked oper about width/height should be put it together with oth

2020-03-14 Thread numberwolf
Reviewed-by: Carl Eugen Hoyos 
Signed-off-by: numberwolf 
---
 libavcodec/mpegutils.c | 4 ++--
 libavcodec/mpegutils.h | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mpegutils.c b/libavcodec/mpegutils.c
index c0ee3aa..819293c 100644
--- a/libavcodec/mpegutils.c
+++ b/libavcodec/mpegutils.c
@@ -34,8 +34,8 @@ static int add_mb(AVMotionVector *mb, uint32_t mb_type,
   int motion_x, int motion_y, int motion_scale,
   int direction)
 {
-mb->w = IS_8X8(mb_type) || IS_8X16(mb_type) ? 8 : 16;
-mb->h = IS_8X8(mb_type) || IS_16X8(mb_type) ? 8 : 16;
+mb->w = MB_SIZE_WIDTH(mb_type);
+mb->h = MB_SIZE_HEIGHT(mb_type);
 mb->motion_x = motion_x;
 mb->motion_y = motion_y;
 mb->motion_scale = motion_scale;
diff --git a/libavcodec/mpegutils.h b/libavcodec/mpegutils.h
index 1ed21c1..ed59716 100644
--- a/libavcodec/mpegutils.h
+++ b/libavcodec/mpegutils.h
@@ -95,6 +95,9 @@
 #define IS_QUANT(a)  ((a) & MB_TYPE_QUANT)
 #define IS_DIR(a, part, list) ((a) & (MB_TYPE_P0L0 << ((part) + 2 * (list
 
+#define MB_SIZE_WIDTH(a)  (((a) & MB_TYPE_8x8) || ((a) & MB_TYPE_8x16)) ? 
8 : 16
+#define MB_SIZE_HEIGHT(a) (((a) & MB_TYPE_8x8) || ((a) & MB_TYPE_16x8)) ? 
8 : 16
+
 // does this mb use listX, note does not work if subMBs
 #define USES_LIST(a, list) ((a) & ((MB_TYPE_P0L0 | MB_TYPE_P1L0) << (2 * 
(list
 
-- 
2.17.2 (Apple Git-113)

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] remove useless mv The function which add motion info, but do not need motionless vectors, its useless. And, when u export mvs , loop oper will spend many times for useless vecto

2020-03-14 Thread numberwolf
Signed-off-by: numberwolf 
---
 libavcodec/mpegutils.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mpegutils.c b/libavcodec/mpegutils.c
index c0ee3aa..148d3e7 100644
--- a/libavcodec/mpegutils.c
+++ b/libavcodec/mpegutils.c
@@ -34,6 +34,12 @@ static int add_mb(AVMotionVector *mb, uint32_t mb_type,
   int motion_x, int motion_y, int motion_scale,
   int direction)
 {
+int src_x = dst_x + motion_x / motion_scale;
+int src_y = dst_y + motion_y / motion_scale;
+
+if (src_x == dst_x && src_y == dst_y) {
+return 0;
+}
 mb->w = IS_8X8(mb_type) || IS_8X16(mb_type) ? 8 : 16;
 mb->h = IS_8X8(mb_type) || IS_16X8(mb_type) ? 8 : 16;
 mb->motion_x = motion_x;
@@ -41,8 +47,8 @@ static int add_mb(AVMotionVector *mb, uint32_t mb_type,
 mb->motion_scale = motion_scale;
 mb->dst_x = dst_x;
 mb->dst_y = dst_y;
-mb->src_x = dst_x + motion_x / motion_scale;
-mb->src_y = dst_y + motion_y / motion_scale;
+mb->src_x = src_x;
+mb->src_y = src_y;
 mb->source = direction ? 1 : -1;
 mb->flags = 0; // XXX: does mb_type contain extra information that could 
be exported here?
 return 1;
-- 
2.17.2 (Apple Git-113)

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [ffmpeg-devel][PATCH] Encapsulation func to get width and height

2020-03-14 Thread numberwolf
---
 libavcodec/mpegutils.c | 4 ++--
 libavcodec/mpegutils.h | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mpegutils.c b/libavcodec/mpegutils.c
index c0ee3aa..819293c 100644
--- a/libavcodec/mpegutils.c
+++ b/libavcodec/mpegutils.c
@@ -34,8 +34,8 @@ static int add_mb(AVMotionVector *mb, uint32_t mb_type,
   int motion_x, int motion_y, int motion_scale,
   int direction)
 {
-mb->w = IS_8X8(mb_type) || IS_8X16(mb_type) ? 8 : 16;
-mb->h = IS_8X8(mb_type) || IS_16X8(mb_type) ? 8 : 16;
+mb->w = MB_SIZE_WIDTH(mb_type);
+mb->h = MB_SIZE_HEIGHT(mb_type);
 mb->motion_x = motion_x;
 mb->motion_y = motion_y;
 mb->motion_scale = motion_scale;
diff --git a/libavcodec/mpegutils.h b/libavcodec/mpegutils.h
index 1ed21c1..ed59716 100644
--- a/libavcodec/mpegutils.h
+++ b/libavcodec/mpegutils.h
@@ -95,6 +95,9 @@
 #define IS_QUANT(a)  ((a) & MB_TYPE_QUANT)
 #define IS_DIR(a, part, list) ((a) & (MB_TYPE_P0L0 << ((part) + 2 * (list
 
+#define MB_SIZE_WIDTH(a)  (((a) & MB_TYPE_8x8) || ((a) & MB_TYPE_8x16)) ? 
8 : 16
+#define MB_SIZE_HEIGHT(a) (((a) & MB_TYPE_8x8) || ((a) & MB_TYPE_16x8)) ? 
8 : 16
+
 // does this mb use listX, note does not work if subMBs
 #define USES_LIST(a, list) ((a) & ((MB_TYPE_P0L0 | MB_TYPE_P1L0) << (2 * 
(list
 
-- 
2.17.2 (Apple Git-113)

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH]libavcodec/mpegutils: remove useless mv The function which add motion info, but do not need motionless vectors, its useless. And, when u export mvs , loop oper will spend many ti

2020-03-13 Thread numberwolf
Signed-off-by: numberwolf 
---
 libavcodec/mpegutils.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mpegutils.c b/libavcodec/mpegutils.c
index c0ee3aa..148d3e7 100644
--- a/libavcodec/mpegutils.c
+++ b/libavcodec/mpegutils.c
@@ -34,6 +34,12 @@ static int add_mb(AVMotionVector *mb, uint32_t mb_type,
   int motion_x, int motion_y, int motion_scale,
   int direction)
 {
+int src_x = dst_x + motion_x / motion_scale;
+int src_y = dst_y + motion_y / motion_scale;
+
+if (src_x == dst_x && src_y == dst_y) {
+return 0;
+}
 mb->w = IS_8X8(mb_type) || IS_8X16(mb_type) ? 8 : 16;
 mb->h = IS_8X8(mb_type) || IS_16X8(mb_type) ? 8 : 16;
 mb->motion_x = motion_x;
@@ -41,8 +47,8 @@ static int add_mb(AVMotionVector *mb, uint32_t mb_type,
 mb->motion_scale = motion_scale;
 mb->dst_x = dst_x;
 mb->dst_y = dst_y;
-mb->src_x = dst_x + motion_x / motion_scale;
-mb->src_y = dst_y + motion_y / motion_scale;
+mb->src_x = src_x;
+mb->src_y = src_y;
 mb->source = direction ? 1 : -1;
 mb->flags = 0; // XXX: does mb_type contain extra information that could 
be exported here?
 return 1;
-- 
2.17.2 (Apple Git-113)

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] remove useless mv The function which add motion info, but do not need motionless vectors, its useless. And, when u export mvs , loop oper will spend many times for useless vecto

2020-03-13 Thread numberwolf
Signed-off-by: numberwolf 
---
 libavcodec/mpegutils.c | 10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mpegutils.c b/libavcodec/mpegutils.c
index c0ee3aa..148d3e7 100644
--- a/libavcodec/mpegutils.c
+++ b/libavcodec/mpegutils.c
@@ -34,6 +34,12 @@ static int add_mb(AVMotionVector *mb, uint32_t mb_type,
   int motion_x, int motion_y, int motion_scale,
   int direction)
 {
+int src_x = dst_x + motion_x / motion_scale;
+int src_y = dst_y + motion_y / motion_scale;
+
+if (src_x == dst_x && src_y == dst_y) {
+return 0;
+}
 mb->w = IS_8X8(mb_type) || IS_8X16(mb_type) ? 8 : 16;
 mb->h = IS_8X8(mb_type) || IS_16X8(mb_type) ? 8 : 16;
 mb->motion_x = motion_x;
@@ -41,8 +47,8 @@ static int add_mb(AVMotionVector *mb, uint32_t mb_type,
 mb->motion_scale = motion_scale;
 mb->dst_x = dst_x;
 mb->dst_y = dst_y;
-mb->src_x = dst_x + motion_x / motion_scale;
-mb->src_y = dst_y + motion_y / motion_scale;
+mb->src_x = src_x;
+mb->src_y = src_y;
 mb->source = direction ? 1 : -1;
 mb->flags = 0; // XXX: does mb_type contain extra information that could 
be exported here?
 return 1;
-- 
2.17.2 (Apple Git-113)

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".