aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2015-03-21 14:38:59 +0100
committerMichael Niedermayer <michaelni@gmx.at>2015-03-21 14:38:59 +0100
commita8ac4c9b06b9f3ee73ef377a3e4392957c72c2b3 (patch)
treefb5114ebcffba281026acf7503aba6aa8212da8b /libavcodec
parent4ffbeddd35cb6a365a3db85bb2bdf2084fb1ba55 (diff)
parent066aafced4dc6c7c9e7b37082635472249f1e93e (diff)
downloadffmpeg-a8ac4c9b06b9f3ee73ef377a3e4392957c72c2b3.tar.gz
Merge commit '066aafced4dc6c7c9e7b37082635472249f1e93e'
* commit '066aafced4dc6c7c9e7b37082635472249f1e93e': h264: move direct_spatial_mv_pred into the per-slice context Conflicts: libavcodec/h264_mvpred.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/dxva2_h264.c2
-rw-r--r--libavcodec/h264.c2
-rw-r--r--libavcodec/h264.h3
-rw-r--r--libavcodec/h264_direct.c4
-rw-r--r--libavcodec/h264_mvpred.h6
-rw-r--r--libavcodec/h264_slice.c4
-rw-r--r--libavcodec/vaapi_h264.c2
7 files changed, 12 insertions, 11 deletions
diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c
index a964a4cf06..fc9fbd478f 100644
--- a/libavcodec/dxva2_h264.c
+++ b/libavcodec/dxva2_h264.c
@@ -279,7 +279,7 @@ static void fill_slice_long(AVCodecContext *avctx, DXVA_Slice_H264_Long *slice,
slice->slice_qp_delta = sl->qscale - h->pps.init_qp;
slice->redundant_pic_cnt = h->redundant_pic_count;
if (sl->slice_type == AV_PICTURE_TYPE_B)
- slice->direct_spatial_mv_pred_flag = h->direct_spatial_mv_pred;
+ slice->direct_spatial_mv_pred_flag = sl->direct_spatial_mv_pred;
slice->cabac_init_idc = h->pps.cabac ? h->cabac_init_idc : 0;
if (h->deblocking_filter < 2)
slice->disable_deblocking_filter_idc = 1 - h->deblocking_filter;
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 6397707d3c..b2cf137754 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -1310,7 +1310,7 @@ int ff_set_ref_count(H264Context *h, H264SliceContext *sl)
max[0] = max[1] = h->picture_structure == PICT_FRAME ? 15 : 31;
if (sl->slice_type_nos == AV_PICTURE_TYPE_B)
- h->direct_spatial_mv_pred = get_bits1(&h->gb);
+ sl->direct_spatial_mv_pred = get_bits1(&h->gb);
num_ref_idx_active_override_flag = get_bits1(&h->gb);
if (num_ref_idx_active_override_flag) {
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index 1ba9fc07a6..e897bd6dd4 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -392,6 +392,8 @@ typedef struct H264SliceContext {
*/
int neighbor_transform_size;
+ int direct_spatial_mv_pred;
+
/**
* non zero coeff count cache.
* is 64 if not available.
@@ -483,7 +485,6 @@ typedef struct H264Context {
int picture_structure;
int first_field;
- int direct_spatial_mv_pred;
int col_parity;
int col_fieldoff;
int dist_scale_factor[32];
diff --git a/libavcodec/h264_direct.c b/libavcodec/h264_direct.c
index 8d6ee4b756..12df16d838 100644
--- a/libavcodec/h264_direct.c
+++ b/libavcodec/h264_direct.c
@@ -140,7 +140,7 @@ void ff_h264_direct_ref_list_init(H264Context *const h, H264SliceContext *sl)
h->col_fieldoff = 2 * h->ref_list[1][0].reference - 3;
}
- if (sl->slice_type_nos != AV_PICTURE_TYPE_B || h->direct_spatial_mv_pred)
+ if (sl->slice_type_nos != AV_PICTURE_TYPE_B || sl->direct_spatial_mv_pred)
return;
for (list = 0; list < 2; list++) {
@@ -695,7 +695,7 @@ single_col:
void ff_h264_pred_direct_motion(H264Context *const h, H264SliceContext *sl,
int *mb_type)
{
- if (h->direct_spatial_mv_pred)
+ if (sl->direct_spatial_mv_pred)
pred_spatial_direct_motion(h, sl, mb_type);
else
pred_temp_direct_motion(h, sl, mb_type);
diff --git a/libavcodec/h264_mvpred.h b/libavcodec/h264_mvpred.h
index 20f8067ebf..e8bcf313ac 100644
--- a/libavcodec/h264_mvpred.h
+++ b/libavcodec/h264_mvpred.h
@@ -603,7 +603,7 @@ static void fill_decode_caches(H264Context *h, H264SliceContext *sl, int mb_type
}
}
- if (IS_INTER(mb_type) || (IS_DIRECT(mb_type) && h->direct_spatial_mv_pred)) {
+ if (IS_INTER(mb_type) || (IS_DIRECT(mb_type) && sl->direct_spatial_mv_pred)) {
int list;
int b_stride = h->b_stride;
for (list = 0; list < h->list_count; list++) {
@@ -613,7 +613,7 @@ static void fill_decode_caches(H264Context *h, H264SliceContext *sl, int mb_type
int16_t(*mv)[2] = h->cur_pic.motion_val[list];
if (!USES_LIST(mb_type, list))
continue;
- av_assert2(!(IS_DIRECT(mb_type) && !h->direct_spatial_mv_pred));
+ av_assert2(!(IS_DIRECT(mb_type) && !sl->direct_spatial_mv_pred));
if (USES_LIST(top_type, list)) {
const int b_xy = h->mb2b_xy[top_xy] + 3 * b_stride;
@@ -813,7 +813,7 @@ static void av_unused decode_mb_skip(H264Context *h, H264SliceContext *sl)
if (sl->slice_type_nos == AV_PICTURE_TYPE_B) {
// just for fill_caches. pred_direct_motion will set the real mb_type
mb_type |= MB_TYPE_L0L1 | MB_TYPE_DIRECT2 | MB_TYPE_SKIP;
- if (h->direct_spatial_mv_pred) {
+ if (sl->direct_spatial_mv_pred) {
fill_decode_neighbors(h, sl, mb_type);
fill_decode_caches(h, sl, mb_type); //FIXME check what is needed and what not ...
}
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 10eec2e888..3a4e525551 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1851,7 +1851,7 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl, H264Contex
}
}
- if (sl->slice_type_nos == AV_PICTURE_TYPE_B && !h->direct_spatial_mv_pred)
+ if (sl->slice_type_nos == AV_PICTURE_TYPE_B && !sl->direct_spatial_mv_pred)
ff_h264_direct_dist_scale_factor(h);
ff_h264_direct_ref_list_init(h, sl);
@@ -2018,7 +2018,7 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl, H264Contex
h->slice_alpha_c0_offset, h->slice_beta_offset,
sl->use_weight,
sl->use_weight == 1 && sl->use_weight_chroma ? "c" : "",
- sl->slice_type == AV_PICTURE_TYPE_B ? (h->direct_spatial_mv_pred ? "SPAT" : "TEMP") : "");
+ sl->slice_type == AV_PICTURE_TYPE_B ? (sl->direct_spatial_mv_pred ? "SPAT" : "TEMP") : "");
}
return 0;
diff --git a/libavcodec/vaapi_h264.c b/libavcodec/vaapi_h264.c
index ccff1c6069..ed776e5324 100644
--- a/libavcodec/vaapi_h264.c
+++ b/libavcodec/vaapi_h264.c
@@ -330,7 +330,7 @@ static int vaapi_h264_decode_slice(AVCodecContext *avctx,
slice_param->slice_data_bit_offset = get_bits_count(&h->gb) + 8; /* bit buffer started beyond nal_unit_type */
slice_param->first_mb_in_slice = (h->mb_y >> FIELD_OR_MBAFF_PICTURE(h)) * h->mb_width + h->mb_x;
slice_param->slice_type = ff_h264_get_slice_type(sl);
- slice_param->direct_spatial_mv_pred_flag = sl->slice_type == AV_PICTURE_TYPE_B ? h->direct_spatial_mv_pred : 0;
+ slice_param->direct_spatial_mv_pred_flag = sl->slice_type == AV_PICTURE_TYPE_B ? sl->direct_spatial_mv_pred : 0;
slice_param->num_ref_idx_l0_active_minus1 = h->list_count > 0 ? h->ref_count[0] - 1 : 0;
slice_param->num_ref_idx_l1_active_minus1 = h->list_count > 1 ? h->ref_count[1] - 1 : 0;
slice_param->cabac_init_idc = h->cabac_init_idc;