diff mbox series

[FFmpeg-devel,v2,1/3] lavc/avs2_parser.c, lavf/davs2.c: Add AVS2_* prefix

Message ID 20200820091107.1035-1-hwrenx@126.com
State New
Headers show
Series [FFmpeg-devel,v2,1/3] lavc/avs2_parser.c, lavf/davs2.c: Add AVS2_* prefix
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

hwren Aug. 20, 2020, 9:11 a.m. UTC
From: hwren <hwrenx@126.com>

Add AVS2_* prefix to macro definitions to avoid confusion

Signed-off-by: hwren <hwrenx@126.com>
---
 libavcodec/avs2_parser.c | 10 +++++-----
 libavformat/davs2.c      | 20 ++++++++++----------
 2 files changed, 15 insertions(+), 15 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/avs2_parser.c b/libavcodec/avs2_parser.c
index 1c9b3423ff..02af08f079 100644
--- a/libavcodec/avs2_parser.c
+++ b/libavcodec/avs2_parser.c
@@ -21,10 +21,10 @@ 
 
 #include "parser.h"
 
-#define SLICE_MAX_START_CODE    0x000001af
+#define AVS2_SLICE_MAX_START_CODE 0x000001AF
 
-#define ISPIC(x)  ((x) == 0xB3 || (x) == 0xB6)
-#define ISUNIT(x) ((x) == 0xB0 || (x) == 0xB1 || (x) == 0xB2 || ISPIC(x))
+#define AVS2_ISPIC(x)  ((x) == 0xB3 || (x) == 0xB6)
+#define AVS2_ISUNIT(x) ((x) == 0xB0 || (x) == 0xB1 || (x) == 0xB2 || AVS2_ISPIC(x))
 
 static int avs2_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_size)
 {
@@ -35,7 +35,7 @@  static int avs2_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_siz
     if (!pic_found) {
         for (; cur < buf_size; ++cur) {
             state = (state<<8) | buf[cur];
-            if (ISUNIT(buf[cur])){
+            if (AVS2_ISUNIT(buf[cur])){
                 ++cur;
                 pic_found = 1;
                 break;
@@ -48,7 +48,7 @@  static int avs2_find_frame_end(ParseContext *pc, const uint8_t *buf, int buf_siz
             return END_NOT_FOUND;
         for (; cur < buf_size; ++cur) {
             state = (state << 8) | buf[cur];
-            if ((state & 0xFFFFFF00) == 0x100 && state > SLICE_MAX_START_CODE) {
+            if ((state & 0xFFFFFF00) == 0x100 && state > AVS2_SLICE_MAX_START_CODE) {
                 pc->frame_start_found = 0;
                 pc->state = -1;
                 return cur - 3;
diff --git a/libavformat/davs2.c b/libavformat/davs2.c
index 59f41fd499..f8337ea500 100644
--- a/libavformat/davs2.c
+++ b/libavformat/davs2.c
@@ -25,11 +25,11 @@ 
 #include "libavcodec/internal.h"
 #include "libavutil/intreadwrite.h"
 
-#define ISSQH(x)  ((x) == 0xB0 )
-#define ISEND(x)  ((x) == 0xB1 )
-#define ISPIC(x)  ((x) == 0xB3 || (x) == 0xB6)
-#define ISUNIT(x) ( ISSQH(x) || ISEND(x) || (x) == 0xB2 || ISPIC(x) || (x) == 0xB5 || (x) == 0xB7 )
-#define ISAVS2(x) ((x) == 0x20 || (x) == 0x22 || (x) == 0x30 || (x) == 0x32 )
+#define AVS2_ISSQH(x)  ((x) == 0xB0)
+#define AVS2_ISEND(x)  ((x) == 0xB1)
+#define AVS2_ISPIC(x)  ((x) == 0xB3 || (x) == 0xB6)
+#define AVS2_ISUNIT(x) (AVS2_ISSQH(x) || AVS2_ISEND(x) || (x) == 0xB2 || AVS2_ISPIC(x) || (x) == 0xB5 || (x) == 0xB7)
+#define AVS2_ISPROFILE(x) ((x) == 0x20 || (x) == 0x22 || (x) == 0x30 || (x) == 0x32)
 
 static int avs2_probe(const AVProbeData *p)
 {
@@ -44,18 +44,18 @@  static int avs2_probe(const AVProbeData *p)
         ptr = avpriv_find_start_code(ptr, end, &code);
         state = code & 0xFF;
         if ((code & 0xffffff00) == 0x100) {
-            if (ISUNIT(state)) {
+            if (AVS2_ISUNIT(state)) {
                 if (sqb && !hds) {
                     hds = ptr - sqb;
                 }
-                if (ISSQH(state)) {
-                    if (!ISAVS2(*ptr))
+                if (AVS2_ISSQH(state)) {
+                    if (!AVS2_ISPROFILE(*ptr))
                         return 0;
                     sqb = ptr;
                     seq++;
-                } else if (ISPIC(state)) {
+                } else if (AVS2_ISPIC(state)) {
                     pic++;
-                } else if (ISEND(state)) {
+                } else if (AVS2_ISEND(state)) {
                     break;
                 }
             }