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

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
105OBJS-$(CONFIG_HEVCPARSE) += hevc_parse.o hevc_ps.o hevc_data.o \105OBJS-$(CONFIG_HEVCPARSE) += hevc_parse.o hevc_ps.o hevc_data.o \
106 h2645data.o h2645_parse.o h2645_vui.o106 h2645data.o h2645_parse.o h2645_vui.o
107OBJS-$(CONFIG_HEVC_SEI) += hevc_sei.o h2645_sei.o \107OBJS-$(CONFIG_HEVC_SEI) += hevc_sei.o h2645_sei.o \
108 dynamic_hdr_vivid.o108 dynamic_hdr_vivid.o aom_film_grain.o
109OBJS-$(CONFIG_HPELDSP) += hpeldsp.o109OBJS-$(CONFIG_HPELDSP) += hpeldsp.o
110OBJS-$(CONFIG_HUFFMAN) += huffman.o110OBJS-$(CONFIG_HUFFMAN) += huffman.o
111OBJS-$(CONFIG_HUFFYUVDSP) += huffyuvdsp.o111OBJS-$(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
211 }211 }
212 break;212 break;
213 }213 }
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 }
214 unsupported_provider_code:232 unsupported_provider_code:
215#endif233#endif
216 default:234 default:
@@ -704,6 +722,12 @@ FF_ENABLE_DEPRECATION_WARNINGS · 487 unmodified lines
704 avctx->properties |= FF_CODEC_PROPERTY_FILM_GRAIN;722 avctx->properties |= FF_CODEC_PROPERTY_FILM_GRAIN;
705 }723 }
706 724
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
707 if (sei->ambient_viewing_environment.present) {731 if (sei->ambient_viewing_environment.present) {
708 H2645SEIAmbientViewingEnvironment *env =732 H2645SEIAmbientViewingEnvironment *env =
709 &sei->ambient_viewing_environment;733 &sei->ambient_viewing_environment;
@@ -800,4 +824,5 @@ void ff_h2645_sei_reset(H2645SEI *s) · 90 unmodified lines
800 s->ambient_viewing_environment.present = 0;824 s->ambient_viewing_environment.present = 0;
801 s->mastering_display.present = 0;825 s->mastering_display.present = 0;
802 s->content_light.present = 0;826 s->content_light.present = 0;
827 s->aom_film_grain.enable = 0;
803}828}
libavcodec/h2645_sei.h+3−0
@@ -23,7 +23,9 @@ · 22 unmodified lines
23 23
24#include "libavutil/buffer.h"24#include "libavutil/buffer.h"
25#include "libavutil/frame.h"25#include "libavutil/frame.h"
26#include "libavutil/film_grain_params.h"
26 27
28#include "aom_film_grain.h"
27#include "avcodec.h"29#include "avcodec.h"
28#include "bytestream.h"30#include "bytestream.h"
29#include "codec_id.h"31#include "codec_id.h"
@@ -132,6 +134,7 @@ typedef struct H2645SEI { · 102 unmodified lines
132 H2645SEIAmbientViewingEnvironment ambient_viewing_environment;134 H2645SEIAmbientViewingEnvironment ambient_viewing_environment;
133 H2645SEIMasteringDisplay mastering_display;135 H2645SEIMasteringDisplay mastering_display;
134 H2645SEIContentLight content_light;136 H2645SEIContentLight content_light;
137 AVFilmGrainAFGS1Params aom_film_grain;
135} H2645SEI;138} H2645SEI;
136 139
137enum {140enum {

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