summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2017-11-29 21:06:49 -0300
committerJames Almer <jamrial@gmail.com>2017-11-29 21:06:49 -0300
commitd268094f889479a8edee43d8c847da8838b8bf0f (patch)
treec18f40311df91539300d2b269a628761dbe0c12d /libavcodec
parenteb01ac6c75b5b42a9d50d405248cb3315ccb3965 (diff)
parent99e9697e3a12ab4a6638a36b95edafd6a98f9eaa (diff)
Merge commit '99e9697e3a12ab4a6638a36b95edafd6a98f9eaa'
* commit '99e9697e3a12ab4a6638a36b95edafd6a98f9eaa': stereo3d: Support view type for frame sequence type Merged-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/h264_sei.c7
-rw-r--r--libavcodec/h264_sei.h1
-rw-r--r--libavcodec/h264_slice.c7
-rw-r--r--libavcodec/hevc_sei.c9
-rw-r--r--libavcodec/hevc_sei.h1
-rw-r--r--libavcodec/hevcdec.c7
6 files changed, 25 insertions, 7 deletions
diff --git a/libavcodec/h264_sei.c b/libavcodec/h264_sei.c
index ae5f39f775..27a37247b5 100644
--- a/libavcodec/h264_sei.c
+++ b/libavcodec/h264_sei.c
@@ -322,10 +322,11 @@ static int decode_frame_packing_arrangement(H264SEIFramePacking *h,
h->quincunx_sampling_flag = get_bits1(gb);
h->content_interpretation_type = get_bits(gb, 6);
- // the following skips: spatial_flipping_flag, frame0_flipped_flag,
- // field_views_flag, current_frame_is_frame0_flag,
+ // spatial_flipping_flag, frame0_flipped_flag, field_views_flag
+ skip_bits(gb, 3);
+ h->current_frame_is_frame0_flag = get_bits1(gb);
// frame0_self_contained_flag, frame1_self_contained_flag
- skip_bits(gb, 6);
+ skip_bits(gb, 2);
if (!h->quincunx_sampling_flag && h->frame_packing_arrangement_type != 5)
skip_bits(gb, 16); // frame[01]_grid_position_[xy]
diff --git a/libavcodec/h264_sei.h b/libavcodec/h264_sei.h
index a53f1899fa..817b4eaae9 100644
--- a/libavcodec/h264_sei.h
+++ b/libavcodec/h264_sei.h
@@ -125,6 +125,7 @@ typedef struct H264SEIFramePacking {
int frame_packing_arrangement_repetition_period;
int content_interpretation_type;
int quincunx_sampling_flag;
+ int current_frame_is_frame0_flag;
} H264SEIFramePacking;
typedef struct H264SEIDisplayOrientation {
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index da76b9293f..fff3112649 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1233,6 +1233,13 @@ static int h264_export_frame_props(H264Context *h)
if (fp->content_interpretation_type == 2)
stereo->flags = AV_STEREO3D_FLAG_INVERT;
+
+ if (fp->frame_packing_arrangement_type == 5) {
+ if (fp->current_frame_is_frame0_flag)
+ stereo->view = AV_STEREO3D_VIEW_LEFT;
+ else
+ stereo->view = AV_STEREO3D_VIEW_RIGHT;
+ }
}
}
diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
index 6ce1669820..8dd975508a 100644
--- a/libavcodec/hevc_sei.c
+++ b/libavcodec/hevc_sei.c
@@ -95,10 +95,11 @@ static int decode_nal_sei_frame_packing_arrangement(HEVCSEIFramePacking *s, GetB
s->quincunx_subsampling = get_bits1(gb);
s->content_interpretation_type = get_bits(gb, 6);
- // the following skips spatial_flipping_flag frame0_flipped_flag
- // field_views_flag current_frame_is_frame0_flag
- // frame0_self_contained_flag frame1_self_contained_flag
- skip_bits(gb, 6);
+ // spatial_flipping_flag, frame0_flipped_flag, field_views_flag
+ skip_bits(gb, 3);
+ s->current_frame_is_frame0_flag = get_bits1(gb);
+ // frame0_self_contained_flag, frame1_self_contained_flag
+ skip_bits(gb, 2);
if (!s->quincunx_subsampling && s->arrangement_type != 5)
skip_bits(gb, 16); // frame[01]_grid_position_[xy]
diff --git a/libavcodec/hevc_sei.h b/libavcodec/hevc_sei.h
index d290aaab53..e92da25bbf 100644
--- a/libavcodec/hevc_sei.h
+++ b/libavcodec/hevc_sei.h
@@ -67,6 +67,7 @@ typedef struct HEVCSEIFramePacking {
int arrangement_type;
int content_interpretation_type;
int quincunx_subsampling;
+ int current_frame_is_frame0_flag;
} HEVCSEIFramePacking;
typedef struct HEVCSEIDisplayOrientation {
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index 5ec6105d2f..433a7056ea 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -2647,6 +2647,13 @@ static int set_side_data(HEVCContext *s)
if (s->sei.frame_packing.content_interpretation_type == 2)
stereo->flags = AV_STEREO3D_FLAG_INVERT;
+
+ if (s->sei.frame_packing.arrangement_type == 5) {
+ if (s->sei.frame_packing.current_frame_is_frame0_flag)
+ stereo->view = AV_STEREO3D_VIEW_LEFT;
+ else
+ stereo->view = AV_STEREO3D_VIEW_RIGHT;
+ }
}
if (s->sei.display_orientation.present &&