[FFmpeg-cvslog] Merge commit '39ab2ea53121b9976a619cd545fbd3464b908696'
Clément Bœsch
git at videolan.org
Wed Jun 29 20:09:08 CEST 2016
ffmpeg | branch: master | Clément Bœsch <u at pkh.me> | Wed Jun 29 20:07:52 2016 +0200| [57d30fde9ea847cf4bff70a1419facad905e72a4] | committer: Clément Bœsch
Merge commit '39ab2ea53121b9976a619cd545fbd3464b908696'
* commit '39ab2ea53121b9976a619cd545fbd3464b908696':
h264: rename mmco_index to nb_mmco
Merged-by: Clément Bœsch <u at pkh.me>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=57d30fde9ea847cf4bff70a1419facad905e72a4
---
libavcodec/h264.h | 2 +-
libavcodec/h264_picture.c | 2 +-
libavcodec/h264_refs.c | 36 ++++++++++++++++++------------------
libavcodec/h264_slice.c | 8 ++++----
4 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/libavcodec/h264.h b/libavcodec/h264.h
index 42f144f..3512aaa 100644
--- a/libavcodec/h264.h
+++ b/libavcodec/h264.h
@@ -599,7 +599,7 @@ typedef struct H264Context {
* memory management control operations buffer.
*/
MMCO mmco[MAX_MMCO_COUNT];
- int mmco_index;
+ int nb_mmco;
int mmco_reset;
int long_ref_count; ///< number of actual long term references
diff --git a/libavcodec/h264_picture.c b/libavcodec/h264_picture.c
index 7e2adda..320bb0c 100644
--- a/libavcodec/h264_picture.c
+++ b/libavcodec/h264_picture.c
@@ -164,7 +164,7 @@ int ff_h264_field_end(H264Context *h, H264SliceContext *sl, int in_setup)
if (in_setup || !(avctx->active_thread_type & FF_THREAD_FRAME)) {
if (!h->droppable) {
- err = ff_h264_execute_ref_pic_marking(h, h->mmco, h->mmco_index);
+ err = ff_h264_execute_ref_pic_marking(h, h->mmco, h->nb_mmco);
h->poc.prev_poc_msb = h->poc.poc_msb;
h->poc.prev_poc_lsb = h->poc.poc_lsb;
}
diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c
index c7676c4..e7ae447 100644
--- a/libavcodec/h264_refs.c
+++ b/libavcodec/h264_refs.c
@@ -604,30 +604,30 @@ static int check_opcodes(MMCO *mmco1, MMCO *mmco2, int n_mmcos)
int ff_generate_sliding_window_mmcos(H264Context *h, int first_slice)
{
MMCO mmco_temp[MAX_MMCO_COUNT], *mmco = first_slice ? h->mmco : mmco_temp;
- int mmco_index = 0, i = 0;
+ int nb_mmco = 0, i = 0;
if (h->short_ref_count &&
h->long_ref_count + h->short_ref_count >= h->ps.sps->ref_frame_count &&
!(FIELD_PICTURE(h) && !h->first_field && h->cur_pic_ptr->reference)) {
mmco[0].opcode = MMCO_SHORT2UNUSED;
mmco[0].short_pic_num = h->short_ref[h->short_ref_count - 1]->frame_num;
- mmco_index = 1;
+ nb_mmco = 1;
if (FIELD_PICTURE(h)) {
mmco[0].short_pic_num *= 2;
mmco[1].opcode = MMCO_SHORT2UNUSED;
mmco[1].short_pic_num = mmco[0].short_pic_num + 1;
- mmco_index = 2;
+ nb_mmco = 2;
}
}
if (first_slice) {
- h->mmco_index = mmco_index;
- } else if (!first_slice && mmco_index >= 0 &&
- (mmco_index != h->mmco_index ||
- (i = check_opcodes(h->mmco, mmco_temp, mmco_index)))) {
+ h->nb_mmco = nb_mmco;
+ } else if (!first_slice && nb_mmco >= 0 &&
+ (nb_mmco != h->nb_mmco ||
+ (i = check_opcodes(h->mmco, mmco_temp, nb_mmco)))) {
av_log(h->avctx, AV_LOG_ERROR,
"Inconsistent MMCO state between slices [%d, %d]\n",
- mmco_index, h->mmco_index);
+ nb_mmco, h->nb_mmco);
return AVERROR_INVALIDDATA;
}
return 0;
@@ -847,14 +847,14 @@ int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb,
{
int i, ret;
MMCO mmco_temp[MAX_MMCO_COUNT], *mmco = mmco_temp;
- int mmco_index = 0;
+ int nb_mmco = 0;
if (h->nal_unit_type == NAL_IDR_SLICE) { // FIXME fields
skip_bits1(gb); // broken_link
if (get_bits1(gb)) {
mmco[0].opcode = MMCO_LONG;
mmco[0].long_arg = 0;
- mmco_index = 1;
+ nb_mmco = 1;
}
} else {
if (get_bits1(gb)) { // adaptive_ref_pic_marking_mode_flag
@@ -900,26 +900,26 @@ int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb,
if (opcode == MMCO_END)
break;
}
- mmco_index = i;
+ nb_mmco = i;
} else {
if (first_slice) {
ret = ff_generate_sliding_window_mmcos(h, first_slice);
if (ret < 0 && h->avctx->err_recognition & AV_EF_EXPLODE)
return ret;
}
- mmco_index = -1;
+ nb_mmco = -1;
}
}
- if (first_slice && mmco_index != -1) {
+ if (first_slice && nb_mmco != -1) {
memcpy(h->mmco, mmco_temp, sizeof(h->mmco));
- h->mmco_index = mmco_index;
- } else if (!first_slice && mmco_index >= 0 &&
- (mmco_index != h->mmco_index ||
- check_opcodes(h->mmco, mmco_temp, mmco_index))) {
+ h->nb_mmco = nb_mmco;
+ } else if (!first_slice && nb_mmco >= 0 &&
+ (nb_mmco != h->nb_mmco ||
+ check_opcodes(h->mmco, mmco_temp, nb_mmco))) {
av_log(h->avctx, AV_LOG_ERROR,
"Inconsistent MMCO state between slices [%d, %d]\n",
- mmco_index, h->mmco_index);
+ nb_mmco, h->nb_mmco);
return AVERROR_INVALIDDATA;
}
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index e5fb64f..adbd1d8 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -429,7 +429,7 @@ int ff_h264_update_thread_context(AVCodecContext *dst,
h->next_outputed_poc = h1->next_outputed_poc;
memcpy(h->mmco, h1->mmco, sizeof(h->mmco));
- h->mmco_index = h1->mmco_index;
+ h->nb_mmco = h1->nb_mmco;
h->mmco_reset = h1->mmco_reset;
h->long_ref_count = h1->long_ref_count;
h->short_ref_count = h1->short_ref_count;
@@ -445,7 +445,7 @@ int ff_h264_update_thread_context(AVCodecContext *dst,
return 0;
if (!h->droppable) {
- err = ff_h264_execute_ref_pic_marking(h, h->mmco, h->mmco_index);
+ err = ff_h264_execute_ref_pic_marking(h, h->mmco, h->nb_mmco);
h->poc.prev_poc_msb = h->poc.poc_msb;
h->poc.prev_poc_lsb = h->poc.poc_lsb;
}
@@ -1441,7 +1441,7 @@ static int h264_slice_header_parse(H264Context *h, H264SliceContext *sl)
ret = ff_generate_sliding_window_mmcos(h, 1);
if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE))
return ret;
- ret = ff_h264_execute_ref_pic_marking(h, h->mmco, h->mmco_index);
+ ret = ff_h264_execute_ref_pic_marking(h, h->mmco, h->nb_mmco);
if (ret < 0 && (h->avctx->err_recognition & AV_EF_EXPLODE))
return ret;
/* Error concealment: If a ref is missing, copy the previous ref
@@ -1593,7 +1593,7 @@ static int h264_slice_header_parse(H264Context *h, H264SliceContext *sl)
sl->slice_type_nos, &sl->pwt, h->avctx);
// If frame-mt is enabled, only update mmco tables for the first slice
- // in a field. Subsequent slices can temporarily clobber h->mmco_index
+ // in a field. Subsequent slices can temporarily clobber h->nb_mmco
// or h->mmco, which will cause ref list mix-ups and decoding errors
// further down the line. This may break decoding if the first slice is
// corrupt, thus we only do this if frame-mt is enabled.
======================================================================
diff --cc libavcodec/h264_refs.c
index c7676c4,d985c5e..e7ae447
--- a/libavcodec/h264_refs.c
+++ b/libavcodec/h264_refs.c
@@@ -604,10 -539,12 +604,10 @@@ static int check_opcodes(MMCO *mmco1, M
int ff_generate_sliding_window_mmcos(H264Context *h, int first_slice)
{
MMCO mmco_temp[MAX_MMCO_COUNT], *mmco = first_slice ? h->mmco : mmco_temp;
- int mmco_index = 0, i = 0;
+ int nb_mmco = 0, i = 0;
- assert(h->long_ref_count + h->short_ref_count <= h->ps.sps->ref_frame_count);
-
if (h->short_ref_count &&
- h->long_ref_count + h->short_ref_count == h->ps.sps->ref_frame_count &&
+ h->long_ref_count + h->short_ref_count >= h->ps.sps->ref_frame_count &&
!(FIELD_PICTURE(h) && !h->first_field && h->cur_pic_ptr->reference)) {
mmco[0].opcode = MMCO_SHORT2UNUSED;
mmco[0].short_pic_num = h->short_ref[h->short_ref_count - 1]->frame_num;
@@@ -621,13 -558,13 +621,13 @@@
}
if (first_slice) {
- h->mmco_index = mmco_index;
- } else if (!first_slice && mmco_index >= 0 &&
- (mmco_index != h->mmco_index ||
- (i = check_opcodes(h->mmco, mmco_temp, mmco_index)))) {
+ h->nb_mmco = nb_mmco;
+ } else if (!first_slice && nb_mmco >= 0 &&
+ (nb_mmco != h->nb_mmco ||
+ (i = check_opcodes(h->mmco, mmco_temp, nb_mmco)))) {
av_log(h->avctx, AV_LOG_ERROR,
- "Inconsistent MMCO state between slices [%d, %d, %d]\n",
- nb_mmco, h->nb_mmco, i);
+ "Inconsistent MMCO state between slices [%d, %d]\n",
- mmco_index, h->mmco_index);
++ nb_mmco, h->nb_mmco);
return AVERROR_INVALIDDATA;
}
return 0;
@@@ -846,8 -747,8 +846,8 @@@ int ff_h264_decode_ref_pic_marking(H264
int first_slice)
{
int i, ret;
- MMCO mmco_temp[MAX_MMCO_COUNT], *mmco = first_slice ? h->mmco : mmco_temp;
+ MMCO mmco_temp[MAX_MMCO_COUNT], *mmco = mmco_temp;
- int mmco_index = 0;
+ int nb_mmco = 0;
if (h->nal_unit_type == NAL_IDR_SLICE) { // FIXME fields
skip_bits1(gb); // broken_link
@@@ -911,15 -812,14 +911,15 @@@
}
}
- if (first_slice && mmco_index != -1) {
+ if (first_slice && nb_mmco != -1) {
+ memcpy(h->mmco, mmco_temp, sizeof(h->mmco));
- h->mmco_index = mmco_index;
- } else if (!first_slice && mmco_index >= 0 &&
- (mmco_index != h->mmco_index ||
- check_opcodes(h->mmco, mmco_temp, mmco_index))) {
+ h->nb_mmco = nb_mmco;
+ } else if (!first_slice && nb_mmco >= 0 &&
+ (nb_mmco != h->nb_mmco ||
+ check_opcodes(h->mmco, mmco_temp, nb_mmco))) {
av_log(h->avctx, AV_LOG_ERROR,
"Inconsistent MMCO state between slices [%d, %d]\n",
- mmco_index, h->mmco_index);
+ nb_mmco, h->nb_mmco);
return AVERROR_INVALIDDATA;
}
diff --cc libavcodec/h264_slice.c
index e5fb64f,634f181..adbd1d8
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@@ -1590,10 -1340,10 +1590,10 @@@ static int h264_slice_header_parse(H264
(pps->weighted_bipred_idc == 1 &&
sl->slice_type_nos == AV_PICTURE_TYPE_B))
ff_h264_pred_weight_table(&sl->gb, sps, sl->ref_count,
- sl->slice_type_nos, &sl->pwt);
+ sl->slice_type_nos, &sl->pwt, h->avctx);
// If frame-mt is enabled, only update mmco tables for the first slice
- // in a field. Subsequent slices can temporarily clobber h->mmco_index
+ // in a field. Subsequent slices can temporarily clobber h->nb_mmco
// or h->mmco, which will cause ref list mix-ups and decoding errors
// further down the line. This may break decoding if the first slice is
// corrupt, thus we only do this if frame-mt is enabled.
More information about the ffmpeg-cvslog
mailing list