History

avcodec/h2645_sei: decode AFGS1 T.35 SEI

I restricted this SEI to HEVC for now, until I see a H.264 sample.

Niklas Haas committed 3 years ago

Commit 2e24c121 parent f50382c3 files · +29 −1Browse files

Showing the changes to libavcodec (3 of 3 files). Show all

Unified · Split

3 files
  1. libavcodec/Makefile +1 −1
  2. libavcodec/h2645_sei.c +25 −0
  3. libavcodec/h2645_sei.h +3 −0
libavcodec/Makefile+1−1
@@ -105,7 +105,7 @@ OBJS-$(CONFIG_H264_SEI) += h264_sei.o h2645_sei.o · 104 unmodified lines
105105 OBJS-$(CONFIG_HEVCPARSE) += hevc_parse.o hevc_ps.o hevc_data.o \
106106 h2645data.o h2645_parse.o h2645_vui.o
107107 OBJS-$(CONFIG_HEVC_SEI) += hevc_sei.o h2645_sei.o \
108− dynamic_hdr_vivid.o
108+ dynamic_hdr_vivid.o aom_film_grain.o
109109 OBJS-$(CONFIG_HPELDSP) += hpeldsp.o
110110 OBJS-$(CONFIG_HUFFMAN) += huffman.o
111111 OBJS-$(CONFIG_HUFFYUVDSP) += huffyuvdsp.o
libavcodec/h2645_sei.c+25−0
@@ -211,6 +211,24 @@ static int decode_registered_user_data(H2645SEI *h, GetByteContext *gb, · 210 unmodified lines
211211 }
212212 break;
213213 }
214+ case 0x5890: { // aom_provider_code
215+ const uint16_t aom_grain_provider_oriented_code = 0x0001;
216+ uint16_t provider_oriented_code;
217+
218+ if (!IS_HEVC(codec_id))
219+ goto unsupported_provider_code;
220+
221+ if (bytestream2_get_bytes_left(gb) < 2)
222+ return AVERROR_INVALIDDATA;
223+
224+ provider_oriented_code = bytestream2_get_byteu(gb);
225+ if (provider_oriented_code == aom_grain_provider_oriented_code) {
226+ return ff_aom_parse_film_grain_sets(&h->aom_film_grain,
227+ gb->buffer,
228+ bytestream2_get_bytes_left(gb));
229+ }
230+ break;
231+ }
214232 unsupported_provider_code:
215233 #endif
216234 default:
@@ -704,6 +722,12 @@ FF_ENABLE_DEPRECATION_WARNINGS · 487 unmodified lines
704722 avctx->properties |= FF_CODEC_PROPERTY_FILM_GRAIN;
705723 }
706724
725+#if CONFIG_HEVC_SEI
726+ ret = ff_aom_attach_film_grain_sets(&sei->aom_film_grain, frame);
727+ if (ret < 0)
728+ return ret;
729+#endif
730+
707731 if (sei->ambient_viewing_environment.present) {
708732 H2645SEIAmbientViewingEnvironment *env =
709733 &sei->ambient_viewing_environment;
@@ -800,4 +824,5 @@ void ff_h2645_sei_reset(H2645SEI *s) · 90 unmodified lines
800824 s->ambient_viewing_environment.present = 0;
801825 s->mastering_display.present = 0;
802826 s->content_light.present = 0;
827+ s->aom_film_grain.enable = 0;
803828 }
libavcodec/h2645_sei.h+3−0
@@ -23,7 +23,9 @@ · 22 unmodified lines
2323
2424 #include "libavutil/buffer.h"
2525 #include "libavutil/frame.h"
26+#include "libavutil/film_grain_params.h"
2627
28+#include "aom_film_grain.h"
2729 #include "avcodec.h"
2830 #include "bytestream.h"
2931 #include "codec_id.h"
@@ -132,6 +134,7 @@ typedef struct H2645SEI { · 102 unmodified lines
132134 H2645SEIAmbientViewingEnvironment ambient_viewing_environment;
133135 H2645SEIMasteringDisplay mastering_display;
134136 H2645SEIContentLight content_light;
137+ AVFilmGrainAFGS1Params aom_film_grain;
135138 } H2645SEI;
136139
137140 enum {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t