[FFmpeg-devel] [PATCH 2/4] avcodec: add a Film Grain codec property flag

James Almer jamrial at gmail.com
Mon Aug 16 18:51:00 EEST 2021


Signed-off-by: James Almer <jamrial at gmail.com>
---
 doc/APIchanges       | 3 +++
 fftools/ffprobe.c    | 1 +
 libavcodec/avcodec.c | 2 ++
 libavcodec/avcodec.h | 1 +
 libavcodec/version.h | 4 ++--
 5 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 28cc0344ad..45272aca2c 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,6 +14,9 @@ libavutil:     2021-04-27
 
 API changes, most recent first:
 
+2021-08-xx - xxxxxxxxxx - lavc 59.5.100 - avcodec.h
+  Add FF_CODEC_PROPERTY_FILM_GRAIN
+
 2021-08-14 - xxxxxxxxxx - lavu 57.4.100 - imgutils.h
   Add av_image_copy_plane_uc_from()
 
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 2e60e47334..acfec09656 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2656,6 +2656,7 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id
             print_int("coded_width",  dec_ctx->coded_width);
             print_int("coded_height", dec_ctx->coded_height);
             print_int("closed_captions", !!(dec_ctx->properties & FF_CODEC_PROPERTY_CLOSED_CAPTIONS));
+            print_int("film_grain", !!(dec_ctx->properties & FF_CODEC_PROPERTY_FILM_GRAIN));
         }
         print_int("has_b_frames", par->video_delay);
         sar = av_guess_sample_aspect_ratio(fmt_ctx, stream, NULL);
diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c
index 6d60026c07..2dd7dd84e0 100644
--- a/libavcodec/avcodec.c
+++ b/libavcodec/avcodec.c
@@ -658,6 +658,8 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
         } else {
             if (enc->properties & FF_CODEC_PROPERTY_CLOSED_CAPTIONS)
                 av_bprintf(&bprint, ", Closed Captions");
+            if (enc->properties & FF_CODEC_PROPERTY_FILM_GRAIN)
+                av_bprintf(&bprint, ", Film Grain");
             if (enc->properties & FF_CODEC_PROPERTY_LOSSLESS)
                 av_bprintf(&bprint, ", lossless");
         }
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 5e32c5b0bf..f3f401871b 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1818,6 +1818,7 @@ typedef struct AVCodecContext {
     unsigned properties;
 #define FF_CODEC_PROPERTY_LOSSLESS        0x00000001
 #define FF_CODEC_PROPERTY_CLOSED_CAPTIONS 0x00000002
+#define FF_CODEC_PROPERTY_FILM_GRAIN      0x00000004
 
     /**
      * Additional data associated with the entire coded stream.
diff --git a/libavcodec/version.h b/libavcodec/version.h
index c2482428ca..8cdbb4ecf3 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,8 +28,8 @@
 #include "libavutil/version.h"
 
 #define LIBAVCODEC_VERSION_MAJOR  59
-#define LIBAVCODEC_VERSION_MINOR   4
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MINOR   5
+#define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \
-- 
2.32.0



More information about the ffmpeg-devel mailing list