You've already forked FFmpeg
							
							
				mirror of
				https://github.com/FFmpeg/FFmpeg.git
				synced 2025-10-30 23:18:11 +02:00 
			
		
		
		
	Merge commit '0bfdcce4d42a6e654c00ea5f9237dc987626457f'
* commit '0bfdcce4d42a6e654c00ea5f9237dc987626457f': hevc: move the SliceType enum to hevc.h Merged-by: James Almer <jamrial@gmail.com>
This commit is contained in:
		| @@ -52,6 +52,12 @@ enum HEVCNALUnitType { | |||||||
|     HEVC_NAL_SEI_SUFFIX = 40, |     HEVC_NAL_SEI_SUFFIX = 40, | ||||||
| }; | }; | ||||||
|  |  | ||||||
|  | enum HEVCSliceType { | ||||||
|  |     HEVC_SLICE_B = 0, | ||||||
|  |     HEVC_SLICE_P = 1, | ||||||
|  |     HEVC_SLICE_I = 2, | ||||||
|  | }; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * 7.4.2.1 |  * 7.4.2.1 | ||||||
|  */ |  */ | ||||||
|   | |||||||
| @@ -26,6 +26,7 @@ | |||||||
|  |  | ||||||
| #include "cabac_functions.h" | #include "cabac_functions.h" | ||||||
| #include "hevc_data.h" | #include "hevc_data.h" | ||||||
|  | #include "hevc.h" | ||||||
| #include "hevcdec.h" | #include "hevcdec.h" | ||||||
|  |  | ||||||
| #define CABAC_MAX_BIN 31 | #define CABAC_MAX_BIN 31 | ||||||
| @@ -481,7 +482,7 @@ static void cabac_init_state(HEVCContext *s) | |||||||
|     int init_type = 2 - s->sh.slice_type; |     int init_type = 2 - s->sh.slice_type; | ||||||
|     int i; |     int i; | ||||||
|  |  | ||||||
|     if (s->sh.cabac_init_flag && s->sh.slice_type != I_SLICE) |     if (s->sh.cabac_init_flag && s->sh.slice_type != HEVC_SLICE_I) | ||||||
|         init_type ^= 3; |         init_type ^= 3; | ||||||
|  |  | ||||||
|     for (i = 0; i < HEVC_CONTEXTS; i++) { |     for (i = 0; i < HEVC_CONTEXTS; i++) { | ||||||
|   | |||||||
| @@ -21,6 +21,7 @@ | |||||||
|  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||||||
|  */ |  */ | ||||||
|  |  | ||||||
|  | #include "hevc.h" | ||||||
| #include "hevcdec.h" | #include "hevcdec.h" | ||||||
|  |  | ||||||
| static const uint8_t l0_l1_cand_idx[12][2] = { | static const uint8_t l0_l1_cand_idx[12][2] = { | ||||||
| @@ -315,7 +316,7 @@ static void derive_spatial_merge_candidates(HEVCContext *s, int x0, int y0, | |||||||
|     const int xB2    = x0 - 1; |     const int xB2    = x0 - 1; | ||||||
|     const int yB2    = y0 - 1; |     const int yB2    = y0 - 1; | ||||||
|  |  | ||||||
|     const int nb_refs = (s->sh.slice_type == P_SLICE) ? |     const int nb_refs = (s->sh.slice_type == HEVC_SLICE_P) ? | ||||||
|                         s->sh.nb_refs[0] : FFMIN(s->sh.nb_refs[0], s->sh.nb_refs[1]); |                         s->sh.nb_refs[0] : FFMIN(s->sh.nb_refs[0], s->sh.nb_refs[1]); | ||||||
|  |  | ||||||
|     int zero_idx = 0; |     int zero_idx = 0; | ||||||
| @@ -411,7 +412,7 @@ static void derive_spatial_merge_candidates(HEVCContext *s, int x0, int y0, | |||||||
|         Mv mv_l0_col = { 0 }, mv_l1_col = { 0 }; |         Mv mv_l0_col = { 0 }, mv_l1_col = { 0 }; | ||||||
|         int available_l0 = temporal_luma_motion_vector(s, x0, y0, nPbW, nPbH, |         int available_l0 = temporal_luma_motion_vector(s, x0, y0, nPbW, nPbH, | ||||||
|                                                        0, &mv_l0_col, 0); |                                                        0, &mv_l0_col, 0); | ||||||
|         int available_l1 = (s->sh.slice_type == B_SLICE) ? |         int available_l1 = (s->sh.slice_type == HEVC_SLICE_B) ? | ||||||
|                            temporal_luma_motion_vector(s, x0, y0, nPbW, nPbH, |                            temporal_luma_motion_vector(s, x0, y0, nPbW, nPbH, | ||||||
|                                                        0, &mv_l1_col, 1) : 0; |                                                        0, &mv_l1_col, 1) : 0; | ||||||
|  |  | ||||||
| @@ -430,7 +431,7 @@ static void derive_spatial_merge_candidates(HEVCContext *s, int x0, int y0, | |||||||
|     nb_orig_merge_cand = nb_merge_cand; |     nb_orig_merge_cand = nb_merge_cand; | ||||||
|  |  | ||||||
|     // combined bi-predictive merge candidates  (applies for B slices) |     // combined bi-predictive merge candidates  (applies for B slices) | ||||||
|     if (s->sh.slice_type == B_SLICE && nb_orig_merge_cand > 1 && |     if (s->sh.slice_type == HEVC_SLICE_B && nb_orig_merge_cand > 1 && | ||||||
|         nb_orig_merge_cand < s->sh.max_num_merge_cand) { |         nb_orig_merge_cand < s->sh.max_num_merge_cand) { | ||||||
|         int comb_idx = 0; |         int comb_idx = 0; | ||||||
|  |  | ||||||
| @@ -459,7 +460,7 @@ static void derive_spatial_merge_candidates(HEVCContext *s, int x0, int y0, | |||||||
|  |  | ||||||
|     // append Zero motion vector candidates |     // append Zero motion vector candidates | ||||||
|     while (nb_merge_cand < s->sh.max_num_merge_cand) { |     while (nb_merge_cand < s->sh.max_num_merge_cand) { | ||||||
|         mergecandlist[nb_merge_cand].pred_flag    = PF_L0 + ((s->sh.slice_type == B_SLICE) << 1); |         mergecandlist[nb_merge_cand].pred_flag    = PF_L0 + ((s->sh.slice_type == HEVC_SLICE_B) << 1); | ||||||
|         AV_ZERO32(mergecandlist[nb_merge_cand].mv + 0); |         AV_ZERO32(mergecandlist[nb_merge_cand].mv + 0); | ||||||
|         AV_ZERO32(mergecandlist[nb_merge_cand].mv + 1); |         AV_ZERO32(mergecandlist[nb_merge_cand].mv + 1); | ||||||
|         mergecandlist[nb_merge_cand].ref_idx[0]   = zero_idx < nb_refs ? zero_idx : 0; |         mergecandlist[nb_merge_cand].ref_idx[0]   = zero_idx < nb_refs ? zero_idx : 0; | ||||||
|   | |||||||
| @@ -360,14 +360,14 @@ static inline int parse_nal_units(AVCodecParserContext *s, const uint8_t *buf, | |||||||
|                 skip_bits(gb, 1); // slice_reserved_undetermined_flag[] |                 skip_bits(gb, 1); // slice_reserved_undetermined_flag[] | ||||||
|  |  | ||||||
|             sh->slice_type = get_ue_golomb(gb); |             sh->slice_type = get_ue_golomb(gb); | ||||||
|             if (!(sh->slice_type == I_SLICE || sh->slice_type == P_SLICE || |             if (!(sh->slice_type == HEVC_SLICE_I || sh->slice_type == HEVC_SLICE_P || | ||||||
|                   sh->slice_type == B_SLICE)) { |                   sh->slice_type == HEVC_SLICE_B)) { | ||||||
|                 av_log(avctx, AV_LOG_ERROR, "Unknown slice type: %d.\n", |                 av_log(avctx, AV_LOG_ERROR, "Unknown slice type: %d.\n", | ||||||
|                        sh->slice_type); |                        sh->slice_type); | ||||||
|                 return AVERROR_INVALIDDATA; |                 return AVERROR_INVALIDDATA; | ||||||
|             } |             } | ||||||
|             s->pict_type = sh->slice_type == B_SLICE ? AV_PICTURE_TYPE_B : |             s->pict_type = sh->slice_type == HEVC_SLICE_B ? AV_PICTURE_TYPE_B : | ||||||
|                            sh->slice_type == P_SLICE ? AV_PICTURE_TYPE_P : |                            sh->slice_type == HEVC_SLICE_P ? AV_PICTURE_TYPE_P : | ||||||
|                                                        AV_PICTURE_TYPE_I; |                                                        AV_PICTURE_TYPE_I; | ||||||
|  |  | ||||||
|             if (ps->pps->output_flag_present_flag) |             if (ps->pps->output_flag_present_flag) | ||||||
|   | |||||||
| @@ -300,7 +300,7 @@ int ff_hevc_slice_rpl(HEVCContext *s) | |||||||
| { | { | ||||||
|     SliceHeader *sh = &s->sh; |     SliceHeader *sh = &s->sh; | ||||||
|  |  | ||||||
|     uint8_t nb_list = sh->slice_type == B_SLICE ? 2 : 1; |     uint8_t nb_list = sh->slice_type == HEVC_SLICE_B ? 2 : 1; | ||||||
|     uint8_t list_idx; |     uint8_t list_idx; | ||||||
|     int i, j, ret; |     int i, j, ret; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -192,7 +192,7 @@ static void pred_weight_table(HEVCContext *s, GetBitContext *gb) | |||||||
|             s->sh.chroma_offset_l0[i][1] = 0; |             s->sh.chroma_offset_l0[i][1] = 0; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     if (s->sh.slice_type == B_SLICE) { |     if (s->sh.slice_type == HEVC_SLICE_B) { | ||||||
|         for (i = 0; i < s->sh.nb_refs[L1]; i++) { |         for (i = 0; i < s->sh.nb_refs[L1]; i++) { | ||||||
|             luma_weight_l1_flag[i] = get_bits1(gb); |             luma_weight_l1_flag[i] = get_bits1(gb); | ||||||
|             if (!luma_weight_l1_flag[i]) { |             if (!luma_weight_l1_flag[i]) { | ||||||
| @@ -510,14 +510,14 @@ static int hls_slice_header(HEVCContext *s) | |||||||
|             skip_bits(gb, 1);  // slice_reserved_undetermined_flag[] |             skip_bits(gb, 1);  // slice_reserved_undetermined_flag[] | ||||||
|  |  | ||||||
|         sh->slice_type = get_ue_golomb_long(gb); |         sh->slice_type = get_ue_golomb_long(gb); | ||||||
|         if (!(sh->slice_type == I_SLICE || |         if (!(sh->slice_type == HEVC_SLICE_I || | ||||||
|               sh->slice_type == P_SLICE || |               sh->slice_type == HEVC_SLICE_P || | ||||||
|               sh->slice_type == B_SLICE)) { |               sh->slice_type == HEVC_SLICE_B)) { | ||||||
|             av_log(s->avctx, AV_LOG_ERROR, "Unknown slice type: %d.\n", |             av_log(s->avctx, AV_LOG_ERROR, "Unknown slice type: %d.\n", | ||||||
|                    sh->slice_type); |                    sh->slice_type); | ||||||
|             return AVERROR_INVALIDDATA; |             return AVERROR_INVALIDDATA; | ||||||
|         } |         } | ||||||
|         if (IS_IRAP(s) && sh->slice_type != I_SLICE) { |         if (IS_IRAP(s) && sh->slice_type != HEVC_SLICE_I) { | ||||||
|             av_log(s->avctx, AV_LOG_ERROR, "Inter slices in an IRAP frame.\n"); |             av_log(s->avctx, AV_LOG_ERROR, "Inter slices in an IRAP frame.\n"); | ||||||
|             return AVERROR_INVALIDDATA; |             return AVERROR_INVALIDDATA; | ||||||
|         } |         } | ||||||
| @@ -608,16 +608,16 @@ static int hls_slice_header(HEVCContext *s) | |||||||
|         } |         } | ||||||
|  |  | ||||||
|         sh->nb_refs[L0] = sh->nb_refs[L1] = 0; |         sh->nb_refs[L0] = sh->nb_refs[L1] = 0; | ||||||
|         if (sh->slice_type == P_SLICE || sh->slice_type == B_SLICE) { |         if (sh->slice_type == HEVC_SLICE_P || sh->slice_type == HEVC_SLICE_B) { | ||||||
|             int nb_refs; |             int nb_refs; | ||||||
|  |  | ||||||
|             sh->nb_refs[L0] = s->ps.pps->num_ref_idx_l0_default_active; |             sh->nb_refs[L0] = s->ps.pps->num_ref_idx_l0_default_active; | ||||||
|             if (sh->slice_type == B_SLICE) |             if (sh->slice_type == HEVC_SLICE_B) | ||||||
|                 sh->nb_refs[L1] = s->ps.pps->num_ref_idx_l1_default_active; |                 sh->nb_refs[L1] = s->ps.pps->num_ref_idx_l1_default_active; | ||||||
|  |  | ||||||
|             if (get_bits1(gb)) { // num_ref_idx_active_override_flag |             if (get_bits1(gb)) { // num_ref_idx_active_override_flag | ||||||
|                 sh->nb_refs[L0] = get_ue_golomb_long(gb) + 1; |                 sh->nb_refs[L0] = get_ue_golomb_long(gb) + 1; | ||||||
|                 if (sh->slice_type == B_SLICE) |                 if (sh->slice_type == HEVC_SLICE_B) | ||||||
|                     sh->nb_refs[L1] = get_ue_golomb_long(gb) + 1; |                     sh->nb_refs[L1] = get_ue_golomb_long(gb) + 1; | ||||||
|             } |             } | ||||||
|             if (sh->nb_refs[L0] > HEVC_MAX_REFS || sh->nb_refs[L1] > HEVC_MAX_REFS) { |             if (sh->nb_refs[L0] > HEVC_MAX_REFS || sh->nb_refs[L1] > HEVC_MAX_REFS) { | ||||||
| @@ -641,7 +641,7 @@ static int hls_slice_header(HEVCContext *s) | |||||||
|                         sh->list_entry_lx[0][i] = get_bits(gb, av_ceil_log2(nb_refs)); |                         sh->list_entry_lx[0][i] = get_bits(gb, av_ceil_log2(nb_refs)); | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|                 if (sh->slice_type == B_SLICE) { |                 if (sh->slice_type == HEVC_SLICE_B) { | ||||||
|                     sh->rpl_modification_flag[1] = get_bits1(gb); |                     sh->rpl_modification_flag[1] = get_bits1(gb); | ||||||
|                     if (sh->rpl_modification_flag[1] == 1) |                     if (sh->rpl_modification_flag[1] == 1) | ||||||
|                         for (i = 0; i < sh->nb_refs[L1]; i++) |                         for (i = 0; i < sh->nb_refs[L1]; i++) | ||||||
| @@ -649,7 +649,7 @@ static int hls_slice_header(HEVCContext *s) | |||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             if (sh->slice_type == B_SLICE) |             if (sh->slice_type == HEVC_SLICE_B) | ||||||
|                 sh->mvd_l1_zero_flag = get_bits1(gb); |                 sh->mvd_l1_zero_flag = get_bits1(gb); | ||||||
|  |  | ||||||
|             if (s->ps.pps->cabac_init_present_flag) |             if (s->ps.pps->cabac_init_present_flag) | ||||||
| @@ -660,7 +660,7 @@ static int hls_slice_header(HEVCContext *s) | |||||||
|             sh->collocated_ref_idx = 0; |             sh->collocated_ref_idx = 0; | ||||||
|             if (sh->slice_temporal_mvp_enabled_flag) { |             if (sh->slice_temporal_mvp_enabled_flag) { | ||||||
|                 sh->collocated_list = L0; |                 sh->collocated_list = L0; | ||||||
|                 if (sh->slice_type == B_SLICE) |                 if (sh->slice_type == HEVC_SLICE_B) | ||||||
|                     sh->collocated_list = !get_bits1(gb); |                     sh->collocated_list = !get_bits1(gb); | ||||||
|  |  | ||||||
|                 if (sh->nb_refs[sh->collocated_list] > 1) { |                 if (sh->nb_refs[sh->collocated_list] > 1) { | ||||||
| @@ -674,8 +674,8 @@ static int hls_slice_header(HEVCContext *s) | |||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             if ((s->ps.pps->weighted_pred_flag   && sh->slice_type == P_SLICE) || |             if ((s->ps.pps->weighted_pred_flag   && sh->slice_type == HEVC_SLICE_P) || | ||||||
|                 (s->ps.pps->weighted_bipred_flag && sh->slice_type == B_SLICE)) { |                 (s->ps.pps->weighted_bipred_flag && sh->slice_type == HEVC_SLICE_B)) { | ||||||
|                 pred_weight_table(s, gb); |                 pred_weight_table(s, gb); | ||||||
|             } |             } | ||||||
|  |  | ||||||
| @@ -1347,8 +1347,8 @@ static void luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, | |||||||
|     int pic_height       = s->ps.sps->height; |     int pic_height       = s->ps.sps->height; | ||||||
|     int mx               = mv->x & 3; |     int mx               = mv->x & 3; | ||||||
|     int my               = mv->y & 3; |     int my               = mv->y & 3; | ||||||
|     int weight_flag      = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || |     int weight_flag      = (s->sh.slice_type == HEVC_SLICE_P && s->ps.pps->weighted_pred_flag) || | ||||||
|                            (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); |                            (s->sh.slice_type == HEVC_SLICE_B && s->ps.pps->weighted_bipred_flag); | ||||||
|     int idx              = ff_hevc_pel_weight[block_w]; |     int idx              = ff_hevc_pel_weight[block_w]; | ||||||
|  |  | ||||||
|     x_off += mv->x >> 2; |     x_off += mv->x >> 2; | ||||||
| @@ -1410,8 +1410,8 @@ static void luma_mc_uni(HEVCContext *s, uint8_t *dst, ptrdiff_t dststride, | |||||||
|     int my0              = mv0->y & 3; |     int my0              = mv0->y & 3; | ||||||
|     int mx1              = mv1->x & 3; |     int mx1              = mv1->x & 3; | ||||||
|     int my1              = mv1->y & 3; |     int my1              = mv1->y & 3; | ||||||
|     int weight_flag      = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || |     int weight_flag      = (s->sh.slice_type == HEVC_SLICE_P && s->ps.pps->weighted_pred_flag) || | ||||||
|                            (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); |                            (s->sh.slice_type == HEVC_SLICE_B && s->ps.pps->weighted_bipred_flag); | ||||||
|     int x_off0           = x_off + (mv0->x >> 2); |     int x_off0           = x_off + (mv0->x >> 2); | ||||||
|     int y_off0           = y_off + (mv0->y >> 2); |     int y_off0           = y_off + (mv0->y >> 2); | ||||||
|     int x_off1           = x_off + (mv1->x >> 2); |     int x_off1           = x_off + (mv1->x >> 2); | ||||||
| @@ -1496,8 +1496,8 @@ static void chroma_mc_uni(HEVCContext *s, uint8_t *dst0, | |||||||
|     int pic_width        = s->ps.sps->width >> s->ps.sps->hshift[1]; |     int pic_width        = s->ps.sps->width >> s->ps.sps->hshift[1]; | ||||||
|     int pic_height       = s->ps.sps->height >> s->ps.sps->vshift[1]; |     int pic_height       = s->ps.sps->height >> s->ps.sps->vshift[1]; | ||||||
|     const Mv *mv         = ¤t_mv->mv[reflist]; |     const Mv *mv         = ¤t_mv->mv[reflist]; | ||||||
|     int weight_flag      = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || |     int weight_flag      = (s->sh.slice_type == HEVC_SLICE_P && s->ps.pps->weighted_pred_flag) || | ||||||
|                            (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); |                            (s->sh.slice_type == HEVC_SLICE_B && s->ps.pps->weighted_bipred_flag); | ||||||
|     int idx              = ff_hevc_pel_weight[block_w]; |     int idx              = ff_hevc_pel_weight[block_w]; | ||||||
|     int hshift           = s->ps.sps->hshift[1]; |     int hshift           = s->ps.sps->hshift[1]; | ||||||
|     int vshift           = s->ps.sps->vshift[1]; |     int vshift           = s->ps.sps->vshift[1]; | ||||||
| @@ -1561,8 +1561,8 @@ static void chroma_mc_bi(HEVCContext *s, uint8_t *dst0, ptrdiff_t dststride, AVF | |||||||
|     uint8_t *src2        = ref1->data[cidx+1]; |     uint8_t *src2        = ref1->data[cidx+1]; | ||||||
|     ptrdiff_t src1stride = ref0->linesize[cidx+1]; |     ptrdiff_t src1stride = ref0->linesize[cidx+1]; | ||||||
|     ptrdiff_t src2stride = ref1->linesize[cidx+1]; |     ptrdiff_t src2stride = ref1->linesize[cidx+1]; | ||||||
|     int weight_flag      = (s->sh.slice_type == P_SLICE && s->ps.pps->weighted_pred_flag) || |     int weight_flag      = (s->sh.slice_type == HEVC_SLICE_P && s->ps.pps->weighted_pred_flag) || | ||||||
|                            (s->sh.slice_type == B_SLICE && s->ps.pps->weighted_bipred_flag); |                            (s->sh.slice_type == HEVC_SLICE_B && s->ps.pps->weighted_bipred_flag); | ||||||
|     int pic_width        = s->ps.sps->width >> s->ps.sps->hshift[1]; |     int pic_width        = s->ps.sps->width >> s->ps.sps->hshift[1]; | ||||||
|     int pic_height       = s->ps.sps->height >> s->ps.sps->vshift[1]; |     int pic_height       = s->ps.sps->height >> s->ps.sps->vshift[1]; | ||||||
|     Mv *mv0              = ¤t_mv->mv[0]; |     Mv *mv0              = ¤t_mv->mv[0]; | ||||||
| @@ -1662,7 +1662,7 @@ static void hevc_luma_mv_mvp_mode(HEVCContext *s, int x0, int y0, int nPbW, | |||||||
|  |  | ||||||
|     ff_hevc_set_neighbour_available(s, x0, y0, nPbW, nPbH); |     ff_hevc_set_neighbour_available(s, x0, y0, nPbW, nPbH); | ||||||
|     mv->pred_flag = 0; |     mv->pred_flag = 0; | ||||||
|     if (s->sh.slice_type == B_SLICE) |     if (s->sh.slice_type == HEVC_SLICE_B) | ||||||
|         inter_pred_idc = ff_hevc_inter_pred_idc_decode(s, nPbW, nPbH); |         inter_pred_idc = ff_hevc_inter_pred_idc_decode(s, nPbW, nPbH); | ||||||
|  |  | ||||||
|     if (inter_pred_idc != PRED_L1) { |     if (inter_pred_idc != PRED_L1) { | ||||||
| @@ -2040,7 +2040,7 @@ static int hls_coding_unit(HEVCContext *s, int x0, int y0, int log2_cb_size) | |||||||
|     } else |     } else | ||||||
|         lc->cu.cu_transquant_bypass_flag = 0; |         lc->cu.cu_transquant_bypass_flag = 0; | ||||||
|  |  | ||||||
|     if (s->sh.slice_type != I_SLICE) { |     if (s->sh.slice_type != HEVC_SLICE_I) { | ||||||
|         uint8_t skip_flag = ff_hevc_skip_flag_decode(s, x0, y0, x_cb, y_cb); |         uint8_t skip_flag = ff_hevc_skip_flag_decode(s, x0, y0, x_cb, y_cb); | ||||||
|  |  | ||||||
|         x = y_cb * min_cb_width + x_cb; |         x = y_cb * min_cb_width + x_cb; | ||||||
| @@ -2066,7 +2066,7 @@ static int hls_coding_unit(HEVCContext *s, int x0, int y0, int log2_cb_size) | |||||||
|     } else { |     } else { | ||||||
|         int pcm_flag = 0; |         int pcm_flag = 0; | ||||||
|  |  | ||||||
|         if (s->sh.slice_type != I_SLICE) |         if (s->sh.slice_type != HEVC_SLICE_I) | ||||||
|             lc->cu.pred_mode = ff_hevc_pred_mode_decode(s); |             lc->cu.pred_mode = ff_hevc_pred_mode_decode(s); | ||||||
|         if (lc->cu.pred_mode != MODE_INTRA || |         if (lc->cu.pred_mode != MODE_INTRA || | ||||||
|             log2_cb_size == s->ps.sps->log2_min_cb_size) { |             log2_cb_size == s->ps.sps->log2_min_cb_size) { | ||||||
| @@ -2806,7 +2806,7 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal) | |||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (!s->sh.dependent_slice_segment_flag && |         if (!s->sh.dependent_slice_segment_flag && | ||||||
|             s->sh.slice_type != I_SLICE) { |             s->sh.slice_type != HEVC_SLICE_I) { | ||||||
|             ret = ff_hevc_slice_rpl(s); |             ret = ff_hevc_slice_rpl(s); | ||||||
|             if (ret < 0) { |             if (ret < 0) { | ||||||
|                 av_log(s->avctx, AV_LOG_WARNING, |                 av_log(s->avctx, AV_LOG_WARNING, | ||||||
|   | |||||||
| @@ -87,12 +87,6 @@ enum RPSType { | |||||||
|     NB_RPS_TYPE, |     NB_RPS_TYPE, | ||||||
| }; | }; | ||||||
|  |  | ||||||
| enum SliceType { |  | ||||||
|     B_SLICE = 0, |  | ||||||
|     P_SLICE = 1, |  | ||||||
|     I_SLICE = 2, |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| enum SyntaxElement { | enum SyntaxElement { | ||||||
|     SAO_MERGE_FLAG = 0, |     SAO_MERGE_FLAG = 0, | ||||||
|     SAO_TYPE_IDX, |     SAO_TYPE_IDX, | ||||||
| @@ -258,7 +252,7 @@ typedef struct SliceHeader { | |||||||
|     ///< address (in raster order) of the first block in the current slice |     ///< address (in raster order) of the first block in the current slice | ||||||
|     unsigned int   slice_addr; |     unsigned int   slice_addr; | ||||||
|  |  | ||||||
|     enum SliceType slice_type; |     enum HEVCSliceType slice_type; | ||||||
|  |  | ||||||
|     int pic_order_cnt_lsb; |     int pic_order_cnt_lsb; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -25,7 +25,7 @@ | |||||||
| #include "libavutil/pixfmt.h" | #include "libavutil/pixfmt.h" | ||||||
|  |  | ||||||
| #include "avcodec.h" | #include "avcodec.h" | ||||||
| #include "hevcdec.h" | #include "hevc.h" | ||||||
| #include "internal.h" | #include "internal.h" | ||||||
| #include "put_bits.h" | #include "put_bits.h" | ||||||
| #include "vaapi_encode.h" | #include "vaapi_encode.h" | ||||||
| @@ -630,11 +630,11 @@ static void vaapi_encode_h265_write_slice_header2(PutBitContext *pbc, | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         if (vslice->slice_type == P_SLICE || vslice->slice_type == B_SLICE) { |         if (vslice->slice_type == HEVC_SLICE_P || vslice->slice_type == HEVC_SLICE_B) { | ||||||
|             u(1, vslice_field(num_ref_idx_active_override_flag)); |             u(1, vslice_field(num_ref_idx_active_override_flag)); | ||||||
|             if (vslice->slice_fields.bits.num_ref_idx_active_override_flag) { |             if (vslice->slice_fields.bits.num_ref_idx_active_override_flag) { | ||||||
|                 ue(vslice_var(num_ref_idx_l0_active_minus1)); |                 ue(vslice_var(num_ref_idx_l0_active_minus1)); | ||||||
|                 if (vslice->slice_type == B_SLICE) { |                 if (vslice->slice_type == HEVC_SLICE_B) { | ||||||
|                     ue(vslice_var(num_ref_idx_l1_active_minus1)); |                     ue(vslice_var(num_ref_idx_l1_active_minus1)); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
| @@ -643,21 +643,21 @@ static void vaapi_encode_h265_write_slice_header2(PutBitContext *pbc, | |||||||
|                 av_assert0(0); |                 av_assert0(0); | ||||||
|                 // ref_pic_lists_modification() |                 // ref_pic_lists_modification() | ||||||
|             } |             } | ||||||
|             if (vslice->slice_type == B_SLICE) { |             if (vslice->slice_type == HEVC_SLICE_B) { | ||||||
|                 u(1, vslice_field(mvd_l1_zero_flag)); |                 u(1, vslice_field(mvd_l1_zero_flag)); | ||||||
|             } |             } | ||||||
|             if (mseq->cabac_init_present_flag) { |             if (mseq->cabac_init_present_flag) { | ||||||
|                 u(1, vslice_field(cabac_init_flag)); |                 u(1, vslice_field(cabac_init_flag)); | ||||||
|             } |             } | ||||||
|             if (vslice->slice_fields.bits.slice_temporal_mvp_enabled_flag) { |             if (vslice->slice_fields.bits.slice_temporal_mvp_enabled_flag) { | ||||||
|                 if (vslice->slice_type == B_SLICE) |                 if (vslice->slice_type == HEVC_SLICE_B) | ||||||
|                     u(1, vslice_field(collocated_from_l0_flag)); |                     u(1, vslice_field(collocated_from_l0_flag)); | ||||||
|                 ue(vpic->collocated_ref_pic_index, collocated_ref_idx); |                 ue(vpic->collocated_ref_pic_index, collocated_ref_idx); | ||||||
|             } |             } | ||||||
|             if ((vpic->pic_fields.bits.weighted_pred_flag && |             if ((vpic->pic_fields.bits.weighted_pred_flag && | ||||||
|                  vslice->slice_type == P_SLICE) || |                  vslice->slice_type == HEVC_SLICE_P) || | ||||||
|                 (vpic->pic_fields.bits.weighted_bipred_flag && |                 (vpic->pic_fields.bits.weighted_bipred_flag && | ||||||
|                  vslice->slice_type == B_SLICE)) { |                  vslice->slice_type == HEVC_SLICE_B)) { | ||||||
|                 av_assert0(0); |                 av_assert0(0); | ||||||
|                 // pred_weight_table() |                 // pred_weight_table() | ||||||
|             } |             } | ||||||
| @@ -1055,13 +1055,13 @@ static int vaapi_encode_h265_init_slice_params(AVCodecContext *avctx, | |||||||
|     switch (pic->type) { |     switch (pic->type) { | ||||||
|     case PICTURE_TYPE_IDR: |     case PICTURE_TYPE_IDR: | ||||||
|     case PICTURE_TYPE_I: |     case PICTURE_TYPE_I: | ||||||
|         vslice->slice_type = I_SLICE; |         vslice->slice_type = HEVC_SLICE_I; | ||||||
|         break; |         break; | ||||||
|     case PICTURE_TYPE_P: |     case PICTURE_TYPE_P: | ||||||
|         vslice->slice_type = P_SLICE; |         vslice->slice_type = HEVC_SLICE_P; | ||||||
|         break; |         break; | ||||||
|     case PICTURE_TYPE_B: |     case PICTURE_TYPE_B: | ||||||
|         vslice->slice_type = B_SLICE; |         vslice->slice_type = HEVC_SLICE_B; | ||||||
|         break; |         break; | ||||||
|     default: |     default: | ||||||
|         av_assert0(0 && "invalid picture type"); |         av_assert0(0 && "invalid picture type"); | ||||||
|   | |||||||
| @@ -297,9 +297,9 @@ static void fill_pred_weight_table(const HEVCContext *h, | |||||||
|     slice_param->delta_chroma_log2_weight_denom = 0; |     slice_param->delta_chroma_log2_weight_denom = 0; | ||||||
|     slice_param->luma_log2_weight_denom         = 0; |     slice_param->luma_log2_weight_denom         = 0; | ||||||
|  |  | ||||||
|     if (sh->slice_type == I_SLICE || |     if (sh->slice_type == HEVC_SLICE_I || | ||||||
|         (sh->slice_type == P_SLICE && !h->ps.pps->weighted_pred_flag) || |         (sh->slice_type == HEVC_SLICE_P && !h->ps.pps->weighted_pred_flag) || | ||||||
|         (sh->slice_type == B_SLICE && !h->ps.pps->weighted_bipred_flag)) |         (sh->slice_type == HEVC_SLICE_B && !h->ps.pps->weighted_bipred_flag)) | ||||||
|         return; |         return; | ||||||
|  |  | ||||||
|     slice_param->luma_log2_weight_denom = sh->luma_log2_weight_denom; |     slice_param->luma_log2_weight_denom = sh->luma_log2_weight_denom; | ||||||
| @@ -317,7 +317,7 @@ static void fill_pred_weight_table(const HEVCContext *h, | |||||||
|         slice_param->ChromaOffsetL0[i][1] = sh->chroma_offset_l0[i][1]; |         slice_param->ChromaOffsetL0[i][1] = sh->chroma_offset_l0[i][1]; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     if (sh->slice_type == B_SLICE) { |     if (sh->slice_type == HEVC_SLICE_B) { | ||||||
|         for (i = 0; i < 15 && i < sh->nb_refs[L1]; i++) { |         for (i = 0; i < 15 && i < sh->nb_refs[L1]; i++) { | ||||||
|             slice_param->delta_luma_weight_l1[i] = sh->luma_weight_l1[i] - (1 << sh->luma_log2_weight_denom); |             slice_param->delta_luma_weight_l1[i] = sh->luma_weight_l1[i] - (1 << sh->luma_log2_weight_denom); | ||||||
|             slice_param->luma_offset_l1[i] = sh->luma_offset_l1[i]; |             slice_param->luma_offset_l1[i] = sh->luma_offset_l1[i]; | ||||||
| @@ -356,8 +356,8 @@ static int vaapi_hevc_decode_slice(AVCodecContext *avctx, | |||||||
|     const SliceHeader       *sh = &h->sh; |     const SliceHeader       *sh = &h->sh; | ||||||
|     VAAPIDecodePictureHEVC *pic = h->ref->hwaccel_picture_private; |     VAAPIDecodePictureHEVC *pic = h->ref->hwaccel_picture_private; | ||||||
|  |  | ||||||
|     int nb_list = (sh->slice_type == B_SLICE) ? |     int nb_list = (sh->slice_type == HEVC_SLICE_B) ? | ||||||
|                   2 : (sh->slice_type == I_SLICE ? 0 : 1); |                   2 : (sh->slice_type == HEVC_SLICE_I ? 0 : 1); | ||||||
|  |  | ||||||
|     int err, i, list_idx; |     int err, i, list_idx; | ||||||
|  |  | ||||||
| @@ -387,7 +387,7 @@ static int vaapi_hevc_decode_slice(AVCodecContext *avctx, | |||||||
|         .slice_beta_offset_div2        = sh->beta_offset / 2, |         .slice_beta_offset_div2        = sh->beta_offset / 2, | ||||||
|         .slice_tc_offset_div2          = sh->tc_offset / 2, |         .slice_tc_offset_div2          = sh->tc_offset / 2, | ||||||
|         .collocated_ref_idx            = sh->slice_temporal_mvp_enabled_flag ? sh->collocated_ref_idx : 0xFF, |         .collocated_ref_idx            = sh->slice_temporal_mvp_enabled_flag ? sh->collocated_ref_idx : 0xFF, | ||||||
|         .five_minus_max_num_merge_cand = sh->slice_type == I_SLICE ? 0 : 5 - sh->max_num_merge_cand, |         .five_minus_max_num_merge_cand = sh->slice_type == HEVC_SLICE_I ? 0 : 5 - sh->max_num_merge_cand, | ||||||
|         .num_ref_idx_l0_active_minus1  = sh->nb_refs[L0] ? sh->nb_refs[L0] - 1 : 0, |         .num_ref_idx_l0_active_minus1  = sh->nb_refs[L0] ? sh->nb_refs[L0] - 1 : 0, | ||||||
|         .num_ref_idx_l1_active_minus1  = sh->nb_refs[L1] ? sh->nb_refs[L1] - 1 : 0, |         .num_ref_idx_l1_active_minus1  = sh->nb_refs[L1] ? sh->nb_refs[L1] - 1 : 0, | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user