Merge commit '99e9697e3a12ab4a6638a36b95edafd6a98f9eaa'

* commit '99e9697e3a12ab4a6638a36b95edafd6a98f9eaa':
  stereo3d: Support view type for frame sequence type

Merged-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2017-11-29 21:06:49 -03:00
commit d268094f88
11 changed files with 56 additions and 10 deletions

View File

@ -15,6 +15,9 @@ libavutil: 2017-10-21
API changes, most recent first:
2017-xx-xx - xxxxxxx - lavu 56.4.100 / 56.7.0 - stereo3d.h
Add view field to AVStereo3D structure and AVStereo3DView enum.
2017-xx-xx - xxxxxxx - lavc 58.6.100 - avcodec.h
Add const to AVCodecContext.hwaccel.

View File

@ -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]

View File

@ -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 {

View File

@ -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;
}
}
}

View File

@ -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]

View File

@ -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 {

View File

@ -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 &&

View File

@ -324,6 +324,8 @@ static int try_push_frame(AVFilterContext *ctx)
if (!stereo)
return AVERROR(ENOMEM);
stereo->type = s->format;
stereo->view = i == LEFT ? AV_STEREO3D_VIEW_LEFT
: AV_STEREO3D_VIEW_RIGHT;
// filter the frame and immediately relinquish its pointer
ret = ff_filter_frame(outlink, s->input_views[i]);

View File

@ -141,6 +141,25 @@ enum AVStereo3DType {
AV_STEREO3D_COLUMNS,
};
/**
* List of possible view types.
*/
enum AVStereo3DView {
/**
* Frame contains two packed views.
*/
AV_STEREO3D_VIEW_PACKED,
/**
* Frame contains only the left view.
*/
AV_STEREO3D_VIEW_LEFT,
/**
* Frame contains only the right view.
*/
AV_STEREO3D_VIEW_RIGHT,
};
/**
* Inverted views, Right/Bottom represents the left view.
@ -164,6 +183,11 @@ typedef struct AVStereo3D {
* Additional information about the frame packing.
*/
int flags;
/**
* Determines which views are packed.
*/
enum AVStereo3DView view;
} AVStereo3D;
/**

View File

@ -78,9 +78,8 @@
* @{
*/
#define LIBAVUTIL_VERSION_MAJOR 56
#define LIBAVUTIL_VERSION_MINOR 3
#define LIBAVUTIL_VERSION_MINOR 4
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \

View File

@ -3,7 +3,7 @@
#codec_id 0: vp8
#dimensions 0: 320x213
#sar 0: 1/1
0, 0, 0, 33, 2108, 0x59b92a34, S=2, 1900, 0x8fb3adc5, 8, 0x00000000
0, 0, 0, 33, 2108, 0x59b92a34, S=2, 1900, 0x8fb3adc5, 12, 0x00000000
0, 32, 32, 33, 142, 0x2f2a3fed, F=0x0, S=1, 160, 0xa13346af
0, 65, 65, 33, 157, 0x17804767, F=0x0, S=1, 209, 0x64115f15
0, 99, 99, 33, 206, 0x537262ca, F=0x0, S=1, 317, 0x44a09dd0