diff options
author | Vittorio Giovara <vittorio.giovara@gmail.com> | 2013-11-10 23:23:57 +0100 |
---|---|---|
committer | Vittorio Giovara <vittorio.giovara@gmail.com> | 2013-12-09 16:02:43 +0100 |
commit | acb77dff6af036192f6064c84f9cccc48582989e (patch) | |
tree | 2c20623f907e9052898616ba034e963bd3a5445b /libavcodec/hevc.c | |
parent | 3d1d175367f1f22e0c4952299a258272e2e2acf1 (diff) | |
download | ffmpeg-acb77dff6af036192f6064c84f9cccc48582989e.tar.gz |
hevc: parse frame packing arrangement SEI messages and save relevant stereo3d information
Diffstat (limited to 'libavcodec/hevc.c')
-rw-r--r-- | libavcodec/hevc.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c index f00667c6ff..6b935b6dba 100644 --- a/libavcodec/hevc.c +++ b/libavcodec/hevc.c @@ -29,6 +29,7 @@ #include "libavutil/md5.h" #include "libavutil/opt.h" #include "libavutil/pixdesc.h" +#include "libavutil/stereo3d.h" #include "bytestream.h" #include "cabac_functions.h" @@ -2347,6 +2348,41 @@ static void restore_tqb_pixels(HEVCContext *s) } } +static int set_side_data(HEVCContext *s) +{ + AVFrame *out = s->ref->frame; + + if (s->sei_frame_packing_present && + s->frame_packing_arrangement_type >= 3 && + s->frame_packing_arrangement_type <= 5 && + s->content_interpretation_type > 0 && + s->content_interpretation_type < 3) { + AVStereo3D *stereo = av_stereo3d_create_side_data(out); + if (!stereo) + return AVERROR(ENOMEM); + + switch (s->frame_packing_arrangement_type) { + case 3: + if (s->quincunx_subsampling) + stereo->type = AV_STEREO3D_SIDEBYSIDE_QUINCUNX; + else + stereo->type = AV_STEREO3D_SIDEBYSIDE; + break; + case 4: + stereo->type = AV_STEREO3D_TOPBOTTOM; + break; + case 5: + stereo->type = AV_STEREO3D_FRAMESEQUENCE; + break; + } + + if (s->content_interpretation_type == 2) + stereo->flags = AV_STEREO3D_FLAG_INVERT; + } + + return 0; +} + static int hevc_frame_start(HEVCContext *s) { HEVCLocalContext *lc = &s->HEVClc; @@ -2381,6 +2417,10 @@ static int hevc_frame_start(HEVCContext *s) goto fail; } + ret = set_side_data(s); + if (ret < 0) + goto fail; + av_frame_unref(s->output_frame); ret = ff_hevc_output_frame(s, s->output_frame, 0); if (ret < 0) |