Re: [FFmpeg-devel] [PATCH v2 1/4] avformat: add av_program_copy()
On 2023-02-16 12:22 pm, Andreas Rheinhardt wrote: Gyan Doshi: Helper to transfer programs from one muxing context to another. --- doc/APIchanges | 3 ++ libavformat/avformat.c | 70 ++ libavformat/avformat.h | 14 + libavformat/version.h | 2 +- 4 files changed, 88 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index 6baf914760..4916d1abe8 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -14,6 +14,9 @@ libavutil: 2021-04-27 API changes, most recent first: +2023-02-xx - xx - lavf 59.39.100 - avformat.h + Add av_program_copy() + 2023-0x-xx - xx - lavc 59.63.100 Allow AV_CODEC_FLAG_COPY_OPAQUE to be used with decoders. diff --git a/libavformat/avformat.c b/libavformat/avformat.c index 19c7219471..d3c8def170 100644 --- a/libavformat/avformat.c +++ b/libavformat/avformat.c @@ -359,6 +359,76 @@ void av_program_add_stream_index(AVFormatContext *ac, int progid, unsigned idx) } } +int av_program_copy(AVFormatContext *dst, AVFormatContext *src, int progid, int overwrite) +{ +AVProgram *src_prog = NULL; Should be const. +AVProgram *dst_prog = NULL; +int i, j, ret; +int idx = -1; + +for (i = 0; i < src->nb_programs; i++) 1. nb_programs is unsigned and therefore the iterator should be, too. 2. Use a smaller scope for the iterator. (Same for all other iterators.) +if (src->programs[i]->id == progid) +src_prog = src->programs[i]; + +if (!src_prog) { +av_log(src, AV_LOG_ERROR, "source program not found: id=0x%04x\n", progid); +return AVERROR(EINVAL); +} + +for (i = 0; i < dst->nb_programs; i++) { +if (dst->programs[i]->id == progid) +idx = i; +} + +if (idx >= 0 && !overwrite) { +av_log(src, AV_LOG_ERROR, "target muxer already has program with id=0x%04x; not overwriting\n", progid); +return AVERROR(EINVAL); This should not be an error. +} + +av_log(src, AV_LOG_TRACE, "%s program: id=0x%04x\n", idx >= 0 ? "overwriting" : "copying", progid); + +if (idx >= 0) { +dst_prog = dst->programs[idx]; +av_dict_free(_prog->metadata); +av_freep(_prog->stream_index); +dst_prog->nb_stream_indexes = 0; +} else { +dst_prog = av_mallocz(sizeof(*dst_prog)); +if (!dst_prog) +return AVERROR(ENOMEM); +ret = av_dynarray_add_nofree(>programs, >nb_programs, dst_prog); av_dynarray_add_nofree() presumes that dst->programs points to a buffer for a power-of-two pointers (or to NULL); what if a user has reallocated dst->programs himself and moved AVPrograms from another AVFormatContext manually? Do we treat this as API violation? That scenario should be treated the same way as in av_new_program(). But I presume that if a user knows of and uses this helper, they won't have done that. I can add it in the doxy as a caveat. +if (ret < 0) { +av_free(dst_prog); +return AVERROR(ENOMEM); +} +} + +/* public fields */ +dst_prog->id = src_prog->id; +dst_prog->flags = src_prog->flags; +dst_prog->discard = src_prog->discard; +dst_prog->program_num = src_prog->program_num; +dst_prog->pmt_pid = src_prog->pmt_pid; +dst_prog->pcr_pid = src_prog->pcr_pid; +dst_prog->pmt_version = src_prog->pmt_version; + +for (i = 0; i < dst->nb_streams; i++) { +for (j = 0; j < src_prog->nb_stream_indexes; j++) +if (dst->streams[i]->id == src->streams[src_prog->stream_index[j]]->id) The documentation should mention that AVStream.id is used for stream-matching. +av_program_add_stream_index(dst, dst_prog->id, i); This involves a realloction whose success can't be checked due to a design bug in av_program_add_stream_index(). Add an ff_program_add_stream_index() without this design bug and turn av_program_add_stream_index() into a wrapper for it. Isn't it better to deprecate this and add av_program_add_stream_index2() without the bug? +} + +av_dict_copy(_prog->metadata, src_prog->metadata, 0); Missing error check. Ok, but as a note, most usages (80%+) in the codebase omit the check, including lavu/opt.c, lavu/tests/dict.c, lavf/mux.c and fftools/* Do I restore the destination program (when overwriting) or bow out? + +/* private fields */ +dst_prog->start_time = src_prog->start_time; +dst_prog->end_time = src_prog->end_time; +dst_prog->pts_wrap_reference = src_prog->pts_wrap_reference; +dst_prog->pts_wrap_behavior = src_prog->pts_wrap_behavior; These private fields are demuxer-only; there is no need to copy them for muxers. + +return 0; +} + AVProgram *av_find_program_from_stream(AVFormatContext *ic, AVProgram *last, int s) { for (unsigned i = 0; i < ic->nb_programs; i++) { diff --git
[FFmpeg-devel] [PATCH v7 08/10] lavc/vaapi_hevc: Add vaapi profile parse support for SCC
From: Linjie Fu Note that Screen-Extended Main 4:4:4 and 4:4:4 10 supports chroma_format_idc from 0, 1 or 3, hence both 420 and 444 are supported. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- libavcodec/vaapi_decode.c | 4 +++- libavcodec/vaapi_hevc.c | 14 -- libavcodec/vaapi_hevc.h | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c index 134f10eca5..ab8c12e364 100644 --- a/libavcodec/vaapi_decode.c +++ b/libavcodec/vaapi_decode.c @@ -410,7 +410,9 @@ static const struct { #endif #if VA_CHECK_VERSION(1, 2, 0) && CONFIG_HEVC_VAAPI_HWACCEL MAP(HEVC,HEVC_REXT, None, - ff_vaapi_parse_hevc_rext_profile ), + ff_vaapi_parse_hevc_rext_scc_profile ), +MAP(HEVC,HEVC_SCC,None, + ff_vaapi_parse_hevc_rext_scc_profile ), #endif MAP(MJPEG, MJPEG_HUFFMAN_BASELINE_DCT, JPEGBaseline), diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c index a7b541750c..1cf43bd4dc 100644 --- a/libavcodec/vaapi_hevc.c +++ b/libavcodec/vaapi_hevc.c @@ -591,9 +591,9 @@ static int ptl_convert(const PTLCommon *general_ptl, H265RawProfileTierLevel *h2 } /* - * Find exact va_profile for HEVC Range Extension + * Find exact va_profile for HEVC Range Extension and Screen Content Coding Extension */ -VAProfile ff_vaapi_parse_hevc_rext_profile(AVCodecContext *avctx) +VAProfile ff_vaapi_parse_hevc_rext_scc_profile(AVCodecContext *avctx) { const HEVCContext *h = avctx->priv_data; const HEVCSPS *sps = h->ps.sps; @@ -632,6 +632,16 @@ VAProfile ff_vaapi_parse_hevc_rext_profile(AVCodecContext *avctx) else if (!strcmp(profile->name, "Main 4:4:4 12") || !strcmp(profile->name, "Main 4:4:4 12 Intra")) return VAProfileHEVCMain444_12; +else if (!strcmp(profile->name, "Screen-Extended Main")) +return VAProfileHEVCSccMain; +else if (!strcmp(profile->name, "Screen-Extended Main 10")) +return VAProfileHEVCSccMain10; +else if (!strcmp(profile->name, "Screen-Extended Main 4:4:4")) +return VAProfileHEVCSccMain444; +#if VA_CHECK_VERSION(1, 8, 0) +else if (!strcmp(profile->name, "Screen-Extended Main 4:4:4 10")) +return VAProfileHEVCSccMain444_10; +#endif #else av_log(avctx, AV_LOG_WARNING, "HEVC profile %s is " "not supported with this VA version.\n", profile->name); diff --git a/libavcodec/vaapi_hevc.h b/libavcodec/vaapi_hevc.h index b3b0e6fc1e..449635d0d7 100644 --- a/libavcodec/vaapi_hevc.h +++ b/libavcodec/vaapi_hevc.h @@ -22,6 +22,6 @@ #include #include "avcodec.h" -VAProfile ff_vaapi_parse_hevc_rext_profile(AVCodecContext *avctx); +VAProfile ff_vaapi_parse_hevc_rext_scc_profile(AVCodecContext *avctx); #endif /* AVCODEC_VAAPI_HEVC_H */ -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v7 07/10] lavc/vaapi_hevc: Pass SCC parameters Through VA-API
From: Linjie Fu Including sps/pps/slice parameters. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- libavcodec/vaapi_hevc.c | 57 + 1 file changed, 52 insertions(+), 5 deletions(-) diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c index 20fb36adfa..a7b541750c 100644 --- a/libavcodec/vaapi_hevc.c +++ b/libavcodec/vaapi_hevc.c @@ -126,6 +126,10 @@ static int vaapi_hevc_start_frame(AVCodecContext *avctx, const ScalingList *scaling_list = NULL; int pic_param_size, err, i; +#if VA_CHECK_VERSION(1, 2, 0) +int num_comps, pre_palette_size; +#endif + VAPictureParameterBufferHEVC *pic_param = (VAPictureParameterBufferHEVC *)>pic_param; pic->pic.output_surface = ff_vaapi_get_surface_id(h->ref->frame); @@ -218,7 +222,8 @@ static int vaapi_hevc_start_frame(AVCodecContext *avctx, } #if VA_CHECK_VERSION(1, 2, 0) -if (avctx->profile == FF_PROFILE_HEVC_REXT) { +if (avctx->profile == FF_PROFILE_HEVC_REXT || +avctx->profile == FF_PROFILE_HEVC_SCC) { pic->pic_param.rext = (VAPictureParameterBufferHEVCRext) { .range_extension_pic_fields.bits = { .transform_skip_rotation_enabled_flag = sps->transform_skip_rotation_enabled_flag, @@ -245,8 +250,46 @@ static int vaapi_hevc_start_frame(AVCodecContext *avctx, for (i = 0; i < 6; i++) pic->pic_param.rext.cr_qp_offset_list[i]= pps->cr_qp_offset_list[i]; } + +pre_palette_size = pps->pps_palette_predictor_initializers_present_flag ? + pps->pps_num_palette_predictor_initializers : + (sps->sps_palette_predictor_initializers_present_flag ? + sps->sps_num_palette_predictor_initializers_minus1 + 1 : + 0); + +if (avctx->profile == FF_PROFILE_HEVC_SCC) { +pic->pic_param.scc = (VAPictureParameterBufferHEVCScc) { +.screen_content_pic_fields.bits = { +.pps_curr_pic_ref_enabled_flag = pps->pps_curr_pic_ref_enabled_flag, +.palette_mode_enabled_flag = sps->palette_mode_enabled_flag, +.motion_vector_resolution_control_idc = sps->motion_vector_resolution_control_idc, +.intra_boundary_filtering_disabled_flag = sps->intra_boundary_filtering_disabled_flag, +.residual_adaptive_colour_transform_enabled_flag += pps->residual_adaptive_colour_transform_enabled_flag, +.pps_slice_act_qp_offsets_present_flag = pps->pps_slice_act_qp_offsets_present_flag, +}, +.palette_max_size = sps->palette_max_size, +.delta_palette_max_predictor_size = sps->delta_palette_max_predictor_size, +.predictor_palette_size = pre_palette_size, +.pps_act_y_qp_offset_plus5 = pps->residual_adaptive_colour_transform_enabled_flag ? + pps->pps_act_y_qp_offset + 5 : 0, +.pps_act_cb_qp_offset_plus5 = pps->residual_adaptive_colour_transform_enabled_flag ? + pps->pps_act_cb_qp_offset + 5 : 0, +.pps_act_cr_qp_offset_plus3 = pps->residual_adaptive_colour_transform_enabled_flag ? + pps->pps_act_cr_qp_offset + 3 : 0, +}; + +num_comps = pps->monochrome_palette_flag ? 1 : 3; +for (int comp = 0; comp < num_comps; comp++) +for (int j = 0; j < pre_palette_size; j++) +pic->pic_param.scc.predictor_palette_entries[comp][j] = +pps->pps_palette_predictor_initializers_present_flag ? +pps->pps_palette_predictor_initializer[comp][j]: +sps->sps_palette_predictor_initializer[comp][j]; +} + #endif -pic_param_size = avctx->profile == FF_PROFILE_HEVC_REXT ? +pic_param_size = avctx->profile >= FF_PROFILE_HEVC_REXT ? sizeof(pic->pic_param) : sizeof(VAPictureParameterBufferHEVC); err = ff_vaapi_decode_make_param_buffer(avctx, >pic, @@ -299,7 +342,7 @@ static int vaapi_hevc_end_frame(AVCodecContext *avctx) VASliceParameterBufferHEVC *last_slice_param = (VASliceParameterBufferHEVC *)>last_slice_param; int ret; -int slice_param_size = avctx->profile == FF_PROFILE_HEVC_REXT ? +int slice_param_size = avctx->profile >= FF_PROFILE_HEVC_REXT ? sizeof(pic->last_slice_param) : sizeof(VASliceParameterBufferHEVC); if (pic->last_size) { @@ -413,7 +456,7 @@ static int vaapi_hevc_decode_slice(AVCodecContext *avctx,
[FFmpeg-devel] [PATCH v7 10/10] lavc/vaapi_hevc: Loose the restricts for SCC decoding
From: Linjie Fu Allow current picture as the reference picture. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- libavcodec/vaapi_hevc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c index a06785f7a6..0e5da15e53 100644 --- a/libavcodec/vaapi_hevc.c +++ b/libavcodec/vaapi_hevc.c @@ -104,7 +104,8 @@ static void fill_vaapi_reference_frames(const HEVCContext *h, VAPictureParameter const HEVCFrame *frame = NULL; while (!frame && j < FF_ARRAY_ELEMS(h->DPB)) { -if (>DPB[j] != current_picture && (h->DPB[j].flags & (HEVC_FRAME_FLAG_LONG_REF | HEVC_FRAME_FLAG_SHORT_REF))) +if ((>DPB[j] != current_picture || h->ps.pps->pps_curr_pic_ref_enabled_flag) && +(h->DPB[j].flags & (HEVC_FRAME_FLAG_LONG_REF | HEVC_FRAME_FLAG_SHORT_REF))) frame = >DPB[j]; j++; } -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v7 09/10] lavc/vaapi_hevc: Set correct rps type for scc
From: Linjie Fu According to 8.1.3 and 8.3.2. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- libavcodec/vaapi_hevc.c | 4 1 file changed, 4 insertions(+) diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c index 1cf43bd4dc..a06785f7a6 100644 --- a/libavcodec/vaapi_hevc.c +++ b/libavcodec/vaapi_hevc.c @@ -71,6 +71,7 @@ static void fill_vaapi_pic(VAPictureHEVC *va_pic, const HEVCFrame *pic, int rps_ static int find_frame_rps_type(const HEVCContext *h, const HEVCFrame *pic) { VASurfaceID pic_surf = ff_vaapi_get_surface_id(pic->frame); +const HEVCFrame *current_picture = h->ref; int i; for (i = 0; i < h->rps[ST_CURR_BEF].nb_refs; i++) { @@ -88,6 +89,9 @@ static int find_frame_rps_type(const HEVCContext *h, const HEVCFrame *pic) return VA_PICTURE_HEVC_RPS_LT_CURR; } +if (h->ps.pps->pps_curr_pic_ref_enabled_flag && current_picture->poc == pic->poc) +return VA_PICTURE_HEVC_LONG_TERM_REFERENCE; + return 0; } -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v7 06/10] lavc/hevc: Update reference list for SCC
From: Linjie Fu Screen Content Coding allows non-intra slice in an IRAP frame which can reference the frame itself, and would mark the current decoded picture as "used for long-term reference", no matter TwoVersionsOfCurrDecPicFlag(8.1.3), hence some previous restricts are not suitable any more. Constructe RefPicListTemp and RefPicList according to 8-8/9/10. Disable slice decoding for SCC profile to avoid unexpected error in hevc native decoder and patch welcome. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- libavcodec/hevc_refs.c | 21 - libavcodec/hevcdec.c | 10 +- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c index 811e8feff8..96153a2459 100644 --- a/libavcodec/hevc_refs.c +++ b/libavcodec/hevc_refs.c @@ -322,7 +322,7 @@ int ff_hevc_slice_rpl(HEVCContext *s) return ret; if (!(s->rps[ST_CURR_BEF].nb_refs + s->rps[ST_CURR_AFT].nb_refs + - s->rps[LT_CURR].nb_refs)) { + s->rps[LT_CURR].nb_refs) && !s->ps.pps->pps_curr_pic_ref_enabled_flag) { av_log(s->avctx, AV_LOG_ERROR, "Zero refs in the frame RPS.\n"); return AVERROR_INVALIDDATA; } @@ -349,6 +349,13 @@ int ff_hevc_slice_rpl(HEVCContext *s) rpl_tmp.nb_refs++; } } +// Construct RefPicList0, RefPicList1 (8-8, 8-10) +if (s->ps.pps->pps_curr_pic_ref_enabled_flag) { +rpl_tmp.list[rpl_tmp.nb_refs] = s->ref->poc; +rpl_tmp.ref[rpl_tmp.nb_refs]= s->ref; +rpl_tmp.isLongTerm[rpl_tmp.nb_refs] = 1; +rpl_tmp.nb_refs++; +} } /* reorder the references if necessary */ @@ -371,6 +378,14 @@ int ff_hevc_slice_rpl(HEVCContext *s) rpl->nb_refs = FFMIN(rpl->nb_refs, sh->nb_refs[list_idx]); } +// 8-9 +if (s->ps.pps->pps_curr_pic_ref_enabled_flag && +!sh->rpl_modification_flag[list_idx] && +rpl_tmp.nb_refs > sh->nb_refs[L0]) { +rpl->list[sh->nb_refs[L0] - 1] = s->ref->poc; +rpl->ref[sh->nb_refs[L0] - 1] = s->ref; +} + if (sh->collocated_list == list_idx && sh->collocated_ref_idx < rpl->nb_refs) s->ref->collocated_ref = rpl->ref[sh->collocated_ref_idx]; @@ -541,5 +556,9 @@ int ff_hevc_frame_nb_refs(const HEVCContext *s) for (i = 0; i < long_rps->nb_refs; i++) ret += !!long_rps->used[i]; } + +if (s->ps.pps->pps_curr_pic_ref_enabled_flag) +ret++; + return ret; } diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index 52fa627133..121ceb4e75 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -668,7 +668,8 @@ static int hls_slice_header(HEVCContext *s) sh->slice_type); return AVERROR_INVALIDDATA; } -if (IS_IRAP(s) && sh->slice_type != HEVC_SLICE_I) { +if (IS_IRAP(s) && sh->slice_type != HEVC_SLICE_I && +!s->ps.pps->pps_curr_pic_ref_enabled_flag) { av_log(s->avctx, AV_LOG_ERROR, "Inter slices in an IRAP frame.\n"); return AVERROR_INVALIDDATA; } @@ -3123,6 +3124,13 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal) if (ret < 0) goto fail; } else { +if (s->avctx->profile == FF_PROFILE_HEVC_SCC) { +av_log(s->avctx, AV_LOG_ERROR, + "SCC profile is not yet implemented in hevc native decoder.\n"); +ret = AVERROR_PATCHWELCOME; +goto fail; +} + if (s->threads_number > 1 && s->sh.num_entry_point_offsets > 0) ctb_addr_ts = hls_slice_data_wpp(s, nal); else -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v7 05/10] lavc/hevcdec: Set max_num_merge_cand to uint8_t
From: Linjie Fu uint8_t is big enough and keep consistent with the definition in cbs_h265.h. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- libavcodec/hevcdec.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h index a7fc669bcb..aab816791e 100644 --- a/libavcodec/hevcdec.h +++ b/libavcodec/hevcdec.h @@ -304,7 +304,7 @@ typedef struct SliceHeader { int beta_offset;///< beta_offset_div2 * 2 int tc_offset; ///< tc_offset_div2 * 2 -unsigned int max_num_merge_cand; ///< 5 - 5_minus_max_num_merge_cand +uint8_t max_num_merge_cand; ///< 5 - 5_minus_max_num_merge_cand uint8_t use_integer_mv_flag; unsigned *entry_point_offset; -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v7 04/10] lavc/hevcdec: Fix the parsing for use_integer_mv_flag
From: Linjie Fu According to 7.3.6.1, use_integer_mv_flag should be parsed if motion_vector_resolution_control_idc equals to 2. If not present, it equals to motion_vector_resolution_control_idc. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- libavcodec/hevcdec.c | 8 libavcodec/hevcdec.h | 1 + 2 files changed, 9 insertions(+) diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index f9a97ac7f5..52fa627133 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -839,6 +839,14 @@ static int hls_slice_header(HEVCContext *s) sh->max_num_merge_cand); return AVERROR_INVALIDDATA; } + +// Syntax in 7.3.6.1 +if (s->ps.sps->motion_vector_resolution_control_idc == 2) +sh->use_integer_mv_flag = get_bits1(gb); +else +// Inferred to be equal to motion_vector_resolution_control_idc if not present +sh->use_integer_mv_flag = s->ps.sps->motion_vector_resolution_control_idc; + } sh->slice_qp_delta = get_se_golomb(gb); diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h index 7841ba8565..a7fc669bcb 100644 --- a/libavcodec/hevcdec.h +++ b/libavcodec/hevcdec.h @@ -305,6 +305,7 @@ typedef struct SliceHeader { int tc_offset; ///< tc_offset_div2 * 2 unsigned int max_num_merge_cand; ///< 5 - 5_minus_max_num_merge_cand +uint8_t use_integer_mv_flag; unsigned *entry_point_offset; int * offset; -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v7 02/10] lavc/hevc_ps: Add SPS/PPS parse support for HEVC extension syntax
From: Linjie Fu 1. Add extension syntax according to 7.3.2.2.3/7.3.2.3.3 in T-REC-H.265-201911. 2. Keep using parsed PPS when bitstream overread for compatibility. For example, the clip PS_A_VIDYO_3.bit in FATE test has incomplete extension syntax which will be overread and un-decodable if without this change. 3. Format brace in pps_range_extensions(). Signed-off-by: Linjie Fu Signed-off-by: Haihao Xiang Signed-off-by: Fei Wang --- libavcodec/hevc.h| 3 + libavcodec/hevc_ps.c | 289 +-- libavcodec/hevc_ps.h | 69 +++ 3 files changed, 349 insertions(+), 12 deletions(-) diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h index 1804755327..6b454a75c1 100644 --- a/libavcodec/hevc.h +++ b/libavcodec/hevc.h @@ -154,6 +154,9 @@ enum { // get near that, though, so set a lower limit here with the maximum // possible value for 4K video (at most 135 16x16 Ctb rows). HEVC_MAX_ENTRY_POINT_OFFSETS = HEVC_MAX_TILE_COLUMNS * 135, + +// A.3.7: Screen content coding extensions +HEVC_MAX_PALETTE_PREDICTOR_SIZE = 128, }; diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c index 4aa5b76d5f..348e4d8de2 100644 --- a/libavcodec/hevc_ps.c +++ b/libavcodec/hevc_ps.c @@ -853,7 +853,7 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, HEVCWindow *ow; int ret = 0; int log2_diff_max_min_transform_block_size; -int bit_depth_chroma, start, vui_present, sublayer_ordering_info; +int bit_depth_chroma, start, vui_present, sublayer_ordering_info, num_comps; int i; // Coded parameters @@ -1074,8 +1074,12 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, decode_vui(gb, avctx, apply_defdispwin, sps); if (get_bits1(gb)) { // sps_extension_flag -sps->sps_range_extension_flag = get_bits1(gb); -skip_bits(gb, 7); //sps_extension_7bits = get_bits(gb, 7); +sps->sps_range_extension_flag = get_bits1(gb); +sps->sps_multilayer_extension_flag = get_bits1(gb); +sps->sps_3d_extension_flag = get_bits1(gb); +sps->sps_scc_extension_flag= get_bits1(gb); +skip_bits(gb, 4); // sps_extension_4bits + if (sps->sps_range_extension_flag) { sps->transform_skip_rotation_enabled_flag = get_bits1(gb); sps->transform_skip_context_enabled_flag = get_bits1(gb); @@ -1101,6 +1105,57 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, av_log(avctx, AV_LOG_WARNING, "cabac_bypass_alignment_enabled_flag not yet implemented\n"); } + +if (sps->sps_multilayer_extension_flag) { +skip_bits1(gb); // inter_view_mv_vert_constraint_flag +av_log(avctx, AV_LOG_WARNING, + "sps_multilayer_extension_flag not yet implemented\n"); +} + +if (sps->sps_3d_extension_flag) { +for (i = 0; i <= 1; i++) { +skip_bits1(gb); // iv_di_mc_enabled_flag +skip_bits1(gb); // iv_mv_scal_enabled_flag +if (i == 0) { +get_ue_golomb_long(gb); // log2_ivmc_sub_pb_size_minus3 +skip_bits1(gb); // iv_res_pred_enabled_flag +skip_bits1(gb); // depth_ref_enabled_flag +skip_bits1(gb); // vsp_mc_enabled_flag +skip_bits1(gb); // dbbp_enabled_flag +} else { +skip_bits1(gb); // tex_mc_enabled_flag +get_ue_golomb_long(gb); // log2_ivmc_sub_pb_size_minus3 +skip_bits1(gb); // intra_contour_enabled_flag +skip_bits1(gb); // intra_dc_only_wedge_enabled_flag +skip_bits1(gb); // cqt_cu_part_pred_enabled_flag +skip_bits1(gb); // inter_dc_only_enabled_flag +skip_bits1(gb); // skip_intra_enabled_flag +} +} +av_log(avctx, AV_LOG_WARNING, + "sps_3d_extension_flag not yet implemented\n"); +} + +if (sps->sps_scc_extension_flag) { +sps->sps_curr_pic_ref_enabled_flag = get_bits1(gb); +sps->palette_mode_enabled_flag = get_bits1(gb); +if (sps->palette_mode_enabled_flag) { +sps->palette_max_size = get_ue_golomb_long(gb); +sps->delta_palette_max_predictor_size = get_ue_golomb_long(gb); +sps->sps_palette_predictor_initializers_present_flag = get_bits1(gb); + +if (sps->sps_palette_predictor_initializers_present_flag) { +sps->sps_num_palette_predictor_initializers_minus1 = get_ue_golomb_long(gb); +num_comps = !sps->chroma_format_idc ? 1 : 3; +for (int comp = 0; comp < num_comps; comp++) +for (i = 0; i <=
[FFmpeg-devel] [PATCH v7 03/10] lavc/hevcdec: Add slice parse support for HEVC SCC extension
From: Linjie Fu Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- libavcodec/hevcdec.c | 6 ++ libavcodec/hevcdec.h | 4 2 files changed, 10 insertions(+) diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index 567e8d81d4..f9a97ac7f5 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -856,6 +856,12 @@ static int hls_slice_header(HEVCContext *s) sh->slice_cr_qp_offset = 0; } +if (s->ps.pps->pps_slice_act_qp_offsets_present_flag) { +sh->slice_act_y_qp_offset = get_se_golomb(gb); +sh->slice_act_cb_qp_offset = get_se_golomb(gb); +sh->slice_act_cr_qp_offset = get_se_golomb(gb); +} + if (s->ps.pps->chroma_qp_offset_list_enabled_flag) sh->cu_chroma_qp_offset_enabled_flag = get_bits1(gb); else diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h index 9d3f4adbb3..7841ba8565 100644 --- a/libavcodec/hevcdec.h +++ b/libavcodec/hevcdec.h @@ -295,6 +295,10 @@ typedef struct SliceHeader { int slice_cb_qp_offset; int slice_cr_qp_offset; +int slice_act_y_qp_offset; +int slice_act_cb_qp_offset; +int slice_act_cr_qp_offset; + uint8_t cu_chroma_qp_offset_enabled_flag; int beta_offset;///< beta_offset_div2 * 2 -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v7 01/10] lavc/avcodec: Add HEVC Screen Content Coding Extensions profile
From: Linjie Fu Described in HEVC spec A.3.7. Bump minor version and add APIchanges entry for new added profile. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- 1. fix warning of patchwork report for V6. doc/APIchanges| 3 +++ libavcodec/avcodec.h | 1 + libavcodec/hevc_ps.c | 2 ++ libavcodec/profiles.c | 1 + libavcodec/version.h | 2 +- 5 files changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index 29161e30bf..196f681730 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09 API changes, most recent first: +2023-02-16 - xx - lavc 60.3.100 - avcodec.h + Add FF_PROFILE_HEVC_SCC. + 2023-02-16 - xx - lavf 60.2.100 - avformat.h Deprecate AVFormatContext io_close callback. The superior io_close2 callback should be used instead. diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 39881a1d2b..9a0fe97cad 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -1654,6 +1654,7 @@ typedef struct AVCodecContext { #define FF_PROFILE_HEVC_MAIN_10 2 #define FF_PROFILE_HEVC_MAIN_STILL_PICTURE 3 #define FF_PROFILE_HEVC_REXT4 +#define FF_PROFILE_HEVC_SCC 9 #define FF_PROFILE_VVC_MAIN_10 1 #define FF_PROFILE_VVC_MAIN_10_444 33 diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c index 5fe62ec35b..4aa5b76d5f 100644 --- a/libavcodec/hevc_ps.c +++ b/libavcodec/hevc_ps.c @@ -259,6 +259,8 @@ static int decode_profile_tier_level(GetBitContext *gb, AVCodecContext *avctx, av_log(avctx, AV_LOG_DEBUG, "Main Still Picture profile bitstream\n"); else if (ptl->profile_idc == FF_PROFILE_HEVC_REXT) av_log(avctx, AV_LOG_DEBUG, "Range Extension profile bitstream\n"); +else if (ptl->profile_idc == FF_PROFILE_HEVC_SCC) +av_log(avctx, AV_LOG_DEBUG, "Screen Content Coding Extension profile bitstream\n"); else av_log(avctx, AV_LOG_WARNING, "Unknown HEVC profile: %d\n", ptl->profile_idc); diff --git a/libavcodec/profiles.c b/libavcodec/profiles.c index 7af7fbeb13..2230fc5415 100644 --- a/libavcodec/profiles.c +++ b/libavcodec/profiles.c @@ -85,6 +85,7 @@ const AVProfile ff_hevc_profiles[] = { { FF_PROFILE_HEVC_MAIN_10, "Main 10" }, { FF_PROFILE_HEVC_MAIN_STILL_PICTURE, "Main Still Picture" }, { FF_PROFILE_HEVC_REXT, "Rext"}, +{ FF_PROFILE_HEVC_SCC, "Scc" }, { FF_PROFILE_UNKNOWN }, }; diff --git a/libavcodec/version.h b/libavcodec/version.h index 0550d7b0d8..43794ea588 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #include "version_major.h" -#define LIBAVCODEC_VERSION_MINOR 2 +#define LIBAVCODEC_VERSION_MINOR 3 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v2 1/4] avformat: add av_program_copy()
On 2023-02-11 11:26 am, Gyan Doshi wrote: On 2023-02-09 04:25 pm, Gyan Doshi wrote: Helper to transfer programs from one muxing context to another. Comments? Comments? Plan to push in 48h. Regards, Gyan --- doc/APIchanges | 3 ++ libavformat/avformat.c | 70 ++ libavformat/avformat.h | 14 + libavformat/version.h | 2 +- 4 files changed, 88 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index 6baf914760..4916d1abe8 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -14,6 +14,9 @@ libavutil: 2021-04-27 API changes, most recent first: +2023-02-xx - xx - lavf 59.39.100 - avformat.h + Add av_program_copy() + 2023-0x-xx - xx - lavc 59.63.100 Allow AV_CODEC_FLAG_COPY_OPAQUE to be used with decoders. diff --git a/libavformat/avformat.c b/libavformat/avformat.c index 19c7219471..d3c8def170 100644 --- a/libavformat/avformat.c +++ b/libavformat/avformat.c @@ -359,6 +359,76 @@ void av_program_add_stream_index(AVFormatContext *ac, int progid, unsigned idx) } } +int av_program_copy(AVFormatContext *dst, AVFormatContext *src, int progid, int overwrite) +{ + AVProgram *src_prog = NULL; + AVProgram *dst_prog = NULL; + int i, j, ret; + int idx = -1; + + for (i = 0; i < src->nb_programs; i++) + if (src->programs[i]->id == progid) + src_prog = src->programs[i]; + + if (!src_prog) { + av_log(src, AV_LOG_ERROR, "source program not found: id=0x%04x\n", progid); + return AVERROR(EINVAL); + } + + for (i = 0; i < dst->nb_programs; i++) { + if (dst->programs[i]->id == progid) + idx = i; + } + + if (idx >= 0 && !overwrite) { + av_log(src, AV_LOG_ERROR, "target muxer already has program with id=0x%04x; not overwriting\n", progid); + return AVERROR(EINVAL); + } + + av_log(src, AV_LOG_TRACE, "%s program: id=0x%04x\n", idx >= 0 ? "overwriting" : "copying", progid); + + if (idx >= 0) { + dst_prog = dst->programs[idx]; + av_dict_free(_prog->metadata); + av_freep(_prog->stream_index); + dst_prog->nb_stream_indexes = 0; + } else { + dst_prog = av_mallocz(sizeof(*dst_prog)); + if (!dst_prog) + return AVERROR(ENOMEM); + ret = av_dynarray_add_nofree(>programs, >nb_programs, dst_prog); + if (ret < 0) { + av_free(dst_prog); + return AVERROR(ENOMEM); + } + } + + /* public fields */ + dst_prog->id = src_prog->id; + dst_prog->flags = src_prog->flags; + dst_prog->discard = src_prog->discard; + dst_prog->program_num = src_prog->program_num; + dst_prog->pmt_pid = src_prog->pmt_pid; + dst_prog->pcr_pid = src_prog->pcr_pid; + dst_prog->pmt_version = src_prog->pmt_version; + + for (i = 0; i < dst->nb_streams; i++) { + for (j = 0; j < src_prog->nb_stream_indexes; j++) + if (dst->streams[i]->id == src->streams[src_prog->stream_index[j]]->id) + av_program_add_stream_index(dst, dst_prog->id, i); + } + + av_dict_copy(_prog->metadata, src_prog->metadata, 0); + + /* private fields */ + dst_prog->start_time = src_prog->start_time; + dst_prog->end_time = src_prog->end_time; + dst_prog->pts_wrap_reference = src_prog->pts_wrap_reference; + dst_prog->pts_wrap_behavior = src_prog->pts_wrap_behavior; + + return 0; +} + AVProgram *av_find_program_from_stream(AVFormatContext *ic, AVProgram *last, int s) { for (unsigned i = 0; i < ic->nb_programs; i++) { diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 1d97d56ac5..2b7ed3abd8 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1996,6 +1996,20 @@ uint8_t *av_stream_get_side_data(const AVStream *stream, AVProgram *av_new_program(AVFormatContext *s, int id); +/** + * Copy an AVProgram from one AVFormatContext to another. + * + * @param dst pointer to the target muxer context + * @param src pointer to the source muxer context + * @param progid ID of the program to be copied + * @param overwrite whether to overwrite if target muxer already + * contains a program with the same ID + * + * @return 0 in case of success, a negative AVERROR code in case of + * failure + */ +int av_program_copy(AVFormatContext *dst, AVFormatContext *src, int progid, int overwrite); + /** * @} */ diff --git a/libavformat/version.h b/libavformat/version.h index 134cdb2b89..9aba356e09 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -31,7 +31,7 @@ #include "version_major.h" -#define LIBAVFORMAT_VERSION_MINOR 38 +#define LIBAVFORMAT_VERSION_MINOR 39 #define LIBAVFORMAT_VERSION_MICRO 100 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
Re: [FFmpeg-devel] [PATCH v5 01/10] lavc/avcodec: Add HEVC Screen Content Coding Extensions profile
On Tue, 2023-02-14 at 11:11 +0100, Anton Khirnov wrote: > Quoting Fei Wang (2023-02-06 06:44:49) > > From: Linjie Fu > > > > Described in HEVC spec A.3.7. > > > > Signed-off-by: Linjie Fu > > Signed-off-by: Fei Wang > > --- > > 1. fix compile warning with VAAPI version less than 1.2.0 > > > > libavcodec/avcodec.h | 1 + > > libavcodec/hevc_ps.c | 2 ++ > > libavcodec/profiles.c | 1 + > > 3 files changed, 4 insertions(+) > > > > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h > > index 90b437ccbe..9e36d2402a 100644 > > --- a/libavcodec/avcodec.h > > +++ b/libavcodec/avcodec.h > > @@ -1672,6 +1672,7 @@ typedef struct AVCodecContext { > > #define FF_PROFILE_HEVC_MAIN_10 2 > > #define FF_PROFILE_HEVC_MAIN_STILL_PICTURE 3 > > #define FF_PROFILE_HEVC_REXT4 > > +#define FF_PROFILE_HEVC_SCC 9 > > This is an API addition and so needs a minor bump and an entry in > APIchanges Fixed in V6. Thanks. Fei > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v6 08/10] lavc/vaapi_hevc: Add vaapi profile parse support for SCC
From: Linjie Fu Note that Screen-Extended Main 4:4:4 and 4:4:4 10 supports chroma_format_idc from 0, 1 or 3, hence both 420 and 444 are supported. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- libavcodec/vaapi_decode.c | 4 +++- libavcodec/vaapi_hevc.c | 14 -- libavcodec/vaapi_hevc.h | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/libavcodec/vaapi_decode.c b/libavcodec/vaapi_decode.c index 134f10eca5..ab8c12e364 100644 --- a/libavcodec/vaapi_decode.c +++ b/libavcodec/vaapi_decode.c @@ -410,7 +410,9 @@ static const struct { #endif #if VA_CHECK_VERSION(1, 2, 0) && CONFIG_HEVC_VAAPI_HWACCEL MAP(HEVC,HEVC_REXT, None, - ff_vaapi_parse_hevc_rext_profile ), + ff_vaapi_parse_hevc_rext_scc_profile ), +MAP(HEVC,HEVC_SCC,None, + ff_vaapi_parse_hevc_rext_scc_profile ), #endif MAP(MJPEG, MJPEG_HUFFMAN_BASELINE_DCT, JPEGBaseline), diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c index a7b541750c..1cf43bd4dc 100644 --- a/libavcodec/vaapi_hevc.c +++ b/libavcodec/vaapi_hevc.c @@ -591,9 +591,9 @@ static int ptl_convert(const PTLCommon *general_ptl, H265RawProfileTierLevel *h2 } /* - * Find exact va_profile for HEVC Range Extension + * Find exact va_profile for HEVC Range Extension and Screen Content Coding Extension */ -VAProfile ff_vaapi_parse_hevc_rext_profile(AVCodecContext *avctx) +VAProfile ff_vaapi_parse_hevc_rext_scc_profile(AVCodecContext *avctx) { const HEVCContext *h = avctx->priv_data; const HEVCSPS *sps = h->ps.sps; @@ -632,6 +632,16 @@ VAProfile ff_vaapi_parse_hevc_rext_profile(AVCodecContext *avctx) else if (!strcmp(profile->name, "Main 4:4:4 12") || !strcmp(profile->name, "Main 4:4:4 12 Intra")) return VAProfileHEVCMain444_12; +else if (!strcmp(profile->name, "Screen-Extended Main")) +return VAProfileHEVCSccMain; +else if (!strcmp(profile->name, "Screen-Extended Main 10")) +return VAProfileHEVCSccMain10; +else if (!strcmp(profile->name, "Screen-Extended Main 4:4:4")) +return VAProfileHEVCSccMain444; +#if VA_CHECK_VERSION(1, 8, 0) +else if (!strcmp(profile->name, "Screen-Extended Main 4:4:4 10")) +return VAProfileHEVCSccMain444_10; +#endif #else av_log(avctx, AV_LOG_WARNING, "HEVC profile %s is " "not supported with this VA version.\n", profile->name); diff --git a/libavcodec/vaapi_hevc.h b/libavcodec/vaapi_hevc.h index b3b0e6fc1e..449635d0d7 100644 --- a/libavcodec/vaapi_hevc.h +++ b/libavcodec/vaapi_hevc.h @@ -22,6 +22,6 @@ #include #include "avcodec.h" -VAProfile ff_vaapi_parse_hevc_rext_profile(AVCodecContext *avctx); +VAProfile ff_vaapi_parse_hevc_rext_scc_profile(AVCodecContext *avctx); #endif /* AVCODEC_VAAPI_HEVC_H */ -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v6 09/10] lavc/vaapi_hevc: Set correct rps type for scc
From: Linjie Fu According to 8.1.3 and 8.3.2. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- libavcodec/vaapi_hevc.c | 4 1 file changed, 4 insertions(+) diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c index 1cf43bd4dc..a06785f7a6 100644 --- a/libavcodec/vaapi_hevc.c +++ b/libavcodec/vaapi_hevc.c @@ -71,6 +71,7 @@ static void fill_vaapi_pic(VAPictureHEVC *va_pic, const HEVCFrame *pic, int rps_ static int find_frame_rps_type(const HEVCContext *h, const HEVCFrame *pic) { VASurfaceID pic_surf = ff_vaapi_get_surface_id(pic->frame); +const HEVCFrame *current_picture = h->ref; int i; for (i = 0; i < h->rps[ST_CURR_BEF].nb_refs; i++) { @@ -88,6 +89,9 @@ static int find_frame_rps_type(const HEVCContext *h, const HEVCFrame *pic) return VA_PICTURE_HEVC_RPS_LT_CURR; } +if (h->ps.pps->pps_curr_pic_ref_enabled_flag && current_picture->poc == pic->poc) +return VA_PICTURE_HEVC_LONG_TERM_REFERENCE; + return 0; } -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v6 10/10] lavc/vaapi_hevc: Loose the restricts for SCC decoding
From: Linjie Fu Allow current picture as the reference picture. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- libavcodec/vaapi_hevc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c index a06785f7a6..0e5da15e53 100644 --- a/libavcodec/vaapi_hevc.c +++ b/libavcodec/vaapi_hevc.c @@ -104,7 +104,8 @@ static void fill_vaapi_reference_frames(const HEVCContext *h, VAPictureParameter const HEVCFrame *frame = NULL; while (!frame && j < FF_ARRAY_ELEMS(h->DPB)) { -if (>DPB[j] != current_picture && (h->DPB[j].flags & (HEVC_FRAME_FLAG_LONG_REF | HEVC_FRAME_FLAG_SHORT_REF))) +if ((>DPB[j] != current_picture || h->ps.pps->pps_curr_pic_ref_enabled_flag) && +(h->DPB[j].flags & (HEVC_FRAME_FLAG_LONG_REF | HEVC_FRAME_FLAG_SHORT_REF))) frame = >DPB[j]; j++; } -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v6 07/10] lavc/vaapi_hevc: Pass SCC parameters Through VA-API
From: Linjie Fu Including sps/pps/slice parameters. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- libavcodec/vaapi_hevc.c | 57 + 1 file changed, 52 insertions(+), 5 deletions(-) diff --git a/libavcodec/vaapi_hevc.c b/libavcodec/vaapi_hevc.c index 20fb36adfa..a7b541750c 100644 --- a/libavcodec/vaapi_hevc.c +++ b/libavcodec/vaapi_hevc.c @@ -126,6 +126,10 @@ static int vaapi_hevc_start_frame(AVCodecContext *avctx, const ScalingList *scaling_list = NULL; int pic_param_size, err, i; +#if VA_CHECK_VERSION(1, 2, 0) +int num_comps, pre_palette_size; +#endif + VAPictureParameterBufferHEVC *pic_param = (VAPictureParameterBufferHEVC *)>pic_param; pic->pic.output_surface = ff_vaapi_get_surface_id(h->ref->frame); @@ -218,7 +222,8 @@ static int vaapi_hevc_start_frame(AVCodecContext *avctx, } #if VA_CHECK_VERSION(1, 2, 0) -if (avctx->profile == FF_PROFILE_HEVC_REXT) { +if (avctx->profile == FF_PROFILE_HEVC_REXT || +avctx->profile == FF_PROFILE_HEVC_SCC) { pic->pic_param.rext = (VAPictureParameterBufferHEVCRext) { .range_extension_pic_fields.bits = { .transform_skip_rotation_enabled_flag = sps->transform_skip_rotation_enabled_flag, @@ -245,8 +250,46 @@ static int vaapi_hevc_start_frame(AVCodecContext *avctx, for (i = 0; i < 6; i++) pic->pic_param.rext.cr_qp_offset_list[i]= pps->cr_qp_offset_list[i]; } + +pre_palette_size = pps->pps_palette_predictor_initializers_present_flag ? + pps->pps_num_palette_predictor_initializers : + (sps->sps_palette_predictor_initializers_present_flag ? + sps->sps_num_palette_predictor_initializers_minus1 + 1 : + 0); + +if (avctx->profile == FF_PROFILE_HEVC_SCC) { +pic->pic_param.scc = (VAPictureParameterBufferHEVCScc) { +.screen_content_pic_fields.bits = { +.pps_curr_pic_ref_enabled_flag = pps->pps_curr_pic_ref_enabled_flag, +.palette_mode_enabled_flag = sps->palette_mode_enabled_flag, +.motion_vector_resolution_control_idc = sps->motion_vector_resolution_control_idc, +.intra_boundary_filtering_disabled_flag = sps->intra_boundary_filtering_disabled_flag, +.residual_adaptive_colour_transform_enabled_flag += pps->residual_adaptive_colour_transform_enabled_flag, +.pps_slice_act_qp_offsets_present_flag = pps->pps_slice_act_qp_offsets_present_flag, +}, +.palette_max_size = sps->palette_max_size, +.delta_palette_max_predictor_size = sps->delta_palette_max_predictor_size, +.predictor_palette_size = pre_palette_size, +.pps_act_y_qp_offset_plus5 = pps->residual_adaptive_colour_transform_enabled_flag ? + pps->pps_act_y_qp_offset + 5 : 0, +.pps_act_cb_qp_offset_plus5 = pps->residual_adaptive_colour_transform_enabled_flag ? + pps->pps_act_cb_qp_offset + 5 : 0, +.pps_act_cr_qp_offset_plus3 = pps->residual_adaptive_colour_transform_enabled_flag ? + pps->pps_act_cr_qp_offset + 3 : 0, +}; + +num_comps = pps->monochrome_palette_flag ? 1 : 3; +for (int comp = 0; comp < num_comps; comp++) +for (int j = 0; j < pre_palette_size; j++) +pic->pic_param.scc.predictor_palette_entries[comp][j] = +pps->pps_palette_predictor_initializers_present_flag ? +pps->pps_palette_predictor_initializer[comp][j]: +sps->sps_palette_predictor_initializer[comp][j]; +} + #endif -pic_param_size = avctx->profile == FF_PROFILE_HEVC_REXT ? +pic_param_size = avctx->profile >= FF_PROFILE_HEVC_REXT ? sizeof(pic->pic_param) : sizeof(VAPictureParameterBufferHEVC); err = ff_vaapi_decode_make_param_buffer(avctx, >pic, @@ -299,7 +342,7 @@ static int vaapi_hevc_end_frame(AVCodecContext *avctx) VASliceParameterBufferHEVC *last_slice_param = (VASliceParameterBufferHEVC *)>last_slice_param; int ret; -int slice_param_size = avctx->profile == FF_PROFILE_HEVC_REXT ? +int slice_param_size = avctx->profile >= FF_PROFILE_HEVC_REXT ? sizeof(pic->last_slice_param) : sizeof(VASliceParameterBufferHEVC); if (pic->last_size) { @@ -413,7 +456,7 @@ static int vaapi_hevc_decode_slice(AVCodecContext *avctx,
[FFmpeg-devel] [PATCH v6 06/10] lavc/hevc: Update reference list for SCC
From: Linjie Fu Screen Content Coding allows non-intra slice in an IRAP frame which can reference the frame itself, and would mark the current decoded picture as "used for long-term reference", no matter TwoVersionsOfCurrDecPicFlag(8.1.3), hence some previous restricts are not suitable any more. Constructe RefPicListTemp and RefPicList according to 8-8/9/10. Disable slice decoding for SCC profile to avoid unexpected error in hevc native decoder and patch welcome. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- libavcodec/hevc_refs.c | 21 - libavcodec/hevcdec.c | 10 +- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/libavcodec/hevc_refs.c b/libavcodec/hevc_refs.c index 811e8feff8..96153a2459 100644 --- a/libavcodec/hevc_refs.c +++ b/libavcodec/hevc_refs.c @@ -322,7 +322,7 @@ int ff_hevc_slice_rpl(HEVCContext *s) return ret; if (!(s->rps[ST_CURR_BEF].nb_refs + s->rps[ST_CURR_AFT].nb_refs + - s->rps[LT_CURR].nb_refs)) { + s->rps[LT_CURR].nb_refs) && !s->ps.pps->pps_curr_pic_ref_enabled_flag) { av_log(s->avctx, AV_LOG_ERROR, "Zero refs in the frame RPS.\n"); return AVERROR_INVALIDDATA; } @@ -349,6 +349,13 @@ int ff_hevc_slice_rpl(HEVCContext *s) rpl_tmp.nb_refs++; } } +// Construct RefPicList0, RefPicList1 (8-8, 8-10) +if (s->ps.pps->pps_curr_pic_ref_enabled_flag) { +rpl_tmp.list[rpl_tmp.nb_refs] = s->ref->poc; +rpl_tmp.ref[rpl_tmp.nb_refs]= s->ref; +rpl_tmp.isLongTerm[rpl_tmp.nb_refs] = 1; +rpl_tmp.nb_refs++; +} } /* reorder the references if necessary */ @@ -371,6 +378,14 @@ int ff_hevc_slice_rpl(HEVCContext *s) rpl->nb_refs = FFMIN(rpl->nb_refs, sh->nb_refs[list_idx]); } +// 8-9 +if (s->ps.pps->pps_curr_pic_ref_enabled_flag && +!sh->rpl_modification_flag[list_idx] && +rpl_tmp.nb_refs > sh->nb_refs[L0]) { +rpl->list[sh->nb_refs[L0] - 1] = s->ref->poc; +rpl->ref[sh->nb_refs[L0] - 1] = s->ref; +} + if (sh->collocated_list == list_idx && sh->collocated_ref_idx < rpl->nb_refs) s->ref->collocated_ref = rpl->ref[sh->collocated_ref_idx]; @@ -541,5 +556,9 @@ int ff_hevc_frame_nb_refs(const HEVCContext *s) for (i = 0; i < long_rps->nb_refs; i++) ret += !!long_rps->used[i]; } + +if (s->ps.pps->pps_curr_pic_ref_enabled_flag) +ret++; + return ret; } diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index 52fa627133..121ceb4e75 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -668,7 +668,8 @@ static int hls_slice_header(HEVCContext *s) sh->slice_type); return AVERROR_INVALIDDATA; } -if (IS_IRAP(s) && sh->slice_type != HEVC_SLICE_I) { +if (IS_IRAP(s) && sh->slice_type != HEVC_SLICE_I && +!s->ps.pps->pps_curr_pic_ref_enabled_flag) { av_log(s->avctx, AV_LOG_ERROR, "Inter slices in an IRAP frame.\n"); return AVERROR_INVALIDDATA; } @@ -3123,6 +3124,13 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal) if (ret < 0) goto fail; } else { +if (s->avctx->profile == FF_PROFILE_HEVC_SCC) { +av_log(s->avctx, AV_LOG_ERROR, + "SCC profile is not yet implemented in hevc native decoder.\n"); +ret = AVERROR_PATCHWELCOME; +goto fail; +} + if (s->threads_number > 1 && s->sh.num_entry_point_offsets > 0) ctb_addr_ts = hls_slice_data_wpp(s, nal); else -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v6 05/10] lavc/hevcdec: Set max_num_merge_cand to uint8_t
From: Linjie Fu uint8_t is big enough and keep consistent with the definition in cbs_h265.h. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- libavcodec/hevcdec.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h index a7fc669bcb..aab816791e 100644 --- a/libavcodec/hevcdec.h +++ b/libavcodec/hevcdec.h @@ -304,7 +304,7 @@ typedef struct SliceHeader { int beta_offset;///< beta_offset_div2 * 2 int tc_offset; ///< tc_offset_div2 * 2 -unsigned int max_num_merge_cand; ///< 5 - 5_minus_max_num_merge_cand +uint8_t max_num_merge_cand; ///< 5 - 5_minus_max_num_merge_cand uint8_t use_integer_mv_flag; unsigned *entry_point_offset; -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v6 04/10] lavc/hevcdec: Fix the parsing for use_integer_mv_flag
From: Linjie Fu According to 7.3.6.1, use_integer_mv_flag should be parsed if motion_vector_resolution_control_idc equals to 2. If not present, it equals to motion_vector_resolution_control_idc. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- libavcodec/hevcdec.c | 8 libavcodec/hevcdec.h | 1 + 2 files changed, 9 insertions(+) diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index f9a97ac7f5..52fa627133 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -839,6 +839,14 @@ static int hls_slice_header(HEVCContext *s) sh->max_num_merge_cand); return AVERROR_INVALIDDATA; } + +// Syntax in 7.3.6.1 +if (s->ps.sps->motion_vector_resolution_control_idc == 2) +sh->use_integer_mv_flag = get_bits1(gb); +else +// Inferred to be equal to motion_vector_resolution_control_idc if not present +sh->use_integer_mv_flag = s->ps.sps->motion_vector_resolution_control_idc; + } sh->slice_qp_delta = get_se_golomb(gb); diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h index 7841ba8565..a7fc669bcb 100644 --- a/libavcodec/hevcdec.h +++ b/libavcodec/hevcdec.h @@ -305,6 +305,7 @@ typedef struct SliceHeader { int tc_offset; ///< tc_offset_div2 * 2 unsigned int max_num_merge_cand; ///< 5 - 5_minus_max_num_merge_cand +uint8_t use_integer_mv_flag; unsigned *entry_point_offset; int * offset; -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v6 03/10] lavc/hevcdec: Add slice parse support for HEVC SCC extension
From: Linjie Fu Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- libavcodec/hevcdec.c | 6 ++ libavcodec/hevcdec.h | 4 2 files changed, 10 insertions(+) diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index 567e8d81d4..f9a97ac7f5 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -856,6 +856,12 @@ static int hls_slice_header(HEVCContext *s) sh->slice_cr_qp_offset = 0; } +if (s->ps.pps->pps_slice_act_qp_offsets_present_flag) { +sh->slice_act_y_qp_offset = get_se_golomb(gb); +sh->slice_act_cb_qp_offset = get_se_golomb(gb); +sh->slice_act_cr_qp_offset = get_se_golomb(gb); +} + if (s->ps.pps->chroma_qp_offset_list_enabled_flag) sh->cu_chroma_qp_offset_enabled_flag = get_bits1(gb); else diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h index 9d3f4adbb3..7841ba8565 100644 --- a/libavcodec/hevcdec.h +++ b/libavcodec/hevcdec.h @@ -295,6 +295,10 @@ typedef struct SliceHeader { int slice_cb_qp_offset; int slice_cr_qp_offset; +int slice_act_y_qp_offset; +int slice_act_cb_qp_offset; +int slice_act_cr_qp_offset; + uint8_t cu_chroma_qp_offset_enabled_flag; int beta_offset;///< beta_offset_div2 * 2 -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH v6 02/10] lavc/hevc_ps: Add SPS/PPS parse support for HEVC extension syntax
From: Linjie Fu 1. Add extension syntax according to 7.3.2.2.3/7.3.2.3.3 in T-REC-H.265-201911. 2. Keep using parsed PPS when bitstream overread for compatibility. For example, the clip PS_A_VIDYO_3.bit in FATE test has incomplete extension syntax which will be overread and un-decodable if without this change. 3. Format brace in pps_range_extensions(). Signed-off-by: Linjie Fu Signed-off-by: Haihao Xiang Signed-off-by: Fei Wang --- libavcodec/hevc.h| 3 + libavcodec/hevc_ps.c | 289 +-- libavcodec/hevc_ps.h | 69 +++ 3 files changed, 349 insertions(+), 12 deletions(-) diff --git a/libavcodec/hevc.h b/libavcodec/hevc.h index 1804755327..6b454a75c1 100644 --- a/libavcodec/hevc.h +++ b/libavcodec/hevc.h @@ -154,6 +154,9 @@ enum { // get near that, though, so set a lower limit here with the maximum // possible value for 4K video (at most 135 16x16 Ctb rows). HEVC_MAX_ENTRY_POINT_OFFSETS = HEVC_MAX_TILE_COLUMNS * 135, + +// A.3.7: Screen content coding extensions +HEVC_MAX_PALETTE_PREDICTOR_SIZE = 128, }; diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c index 4aa5b76d5f..348e4d8de2 100644 --- a/libavcodec/hevc_ps.c +++ b/libavcodec/hevc_ps.c @@ -853,7 +853,7 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, HEVCWindow *ow; int ret = 0; int log2_diff_max_min_transform_block_size; -int bit_depth_chroma, start, vui_present, sublayer_ordering_info; +int bit_depth_chroma, start, vui_present, sublayer_ordering_info, num_comps; int i; // Coded parameters @@ -1074,8 +1074,12 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, decode_vui(gb, avctx, apply_defdispwin, sps); if (get_bits1(gb)) { // sps_extension_flag -sps->sps_range_extension_flag = get_bits1(gb); -skip_bits(gb, 7); //sps_extension_7bits = get_bits(gb, 7); +sps->sps_range_extension_flag = get_bits1(gb); +sps->sps_multilayer_extension_flag = get_bits1(gb); +sps->sps_3d_extension_flag = get_bits1(gb); +sps->sps_scc_extension_flag= get_bits1(gb); +skip_bits(gb, 4); // sps_extension_4bits + if (sps->sps_range_extension_flag) { sps->transform_skip_rotation_enabled_flag = get_bits1(gb); sps->transform_skip_context_enabled_flag = get_bits1(gb); @@ -1101,6 +1105,57 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, av_log(avctx, AV_LOG_WARNING, "cabac_bypass_alignment_enabled_flag not yet implemented\n"); } + +if (sps->sps_multilayer_extension_flag) { +skip_bits1(gb); // inter_view_mv_vert_constraint_flag +av_log(avctx, AV_LOG_WARNING, + "sps_multilayer_extension_flag not yet implemented\n"); +} + +if (sps->sps_3d_extension_flag) { +for (i = 0; i <= 1; i++) { +skip_bits1(gb); // iv_di_mc_enabled_flag +skip_bits1(gb); // iv_mv_scal_enabled_flag +if (i == 0) { +get_ue_golomb_long(gb); // log2_ivmc_sub_pb_size_minus3 +skip_bits1(gb); // iv_res_pred_enabled_flag +skip_bits1(gb); // depth_ref_enabled_flag +skip_bits1(gb); // vsp_mc_enabled_flag +skip_bits1(gb); // dbbp_enabled_flag +} else { +skip_bits1(gb); // tex_mc_enabled_flag +get_ue_golomb_long(gb); // log2_ivmc_sub_pb_size_minus3 +skip_bits1(gb); // intra_contour_enabled_flag +skip_bits1(gb); // intra_dc_only_wedge_enabled_flag +skip_bits1(gb); // cqt_cu_part_pred_enabled_flag +skip_bits1(gb); // inter_dc_only_enabled_flag +skip_bits1(gb); // skip_intra_enabled_flag +} +} +av_log(avctx, AV_LOG_WARNING, + "sps_3d_extension_flag not yet implemented\n"); +} + +if (sps->sps_scc_extension_flag) { +sps->sps_curr_pic_ref_enabled_flag = get_bits1(gb); +sps->palette_mode_enabled_flag = get_bits1(gb); +if (sps->palette_mode_enabled_flag) { +sps->palette_max_size = get_ue_golomb_long(gb); +sps->delta_palette_max_predictor_size = get_ue_golomb_long(gb); +sps->sps_palette_predictor_initializers_present_flag = get_bits1(gb); + +if (sps->sps_palette_predictor_initializers_present_flag) { +sps->sps_num_palette_predictor_initializers_minus1 = get_ue_golomb_long(gb); +num_comps = !sps->chroma_format_idc ? 1 : 3; +for (int comp = 0; comp < num_comps; comp++) +for (i = 0; i <=
[FFmpeg-devel] [PATCH v6 01/10] lavc/avcodec: Add HEVC Screen Content Coding Extensions profile
From: Linjie Fu Described in HEVC spec A.3.7. Bump minor version and add APIchanges entry for new added profile. Signed-off-by: Linjie Fu Signed-off-by: Fei Wang --- update: 1. bump minor version and add APIchanges entry for new profile. doc/APIchanges| 3 +++ libavcodec/avcodec.h | 1 + libavcodec/hevc_ps.c | 2 ++ libavcodec/profiles.c | 1 + libavcodec/version.h | 2 +- 5 files changed, 8 insertions(+), 1 deletion(-) diff --git a/doc/APIchanges b/doc/APIchanges index 3ca724724b..5ab4a9c94f 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -2,6 +2,9 @@ The last version increases of all libraries were on 2023-02-09 API changes, most recent first: +2023-02-14 - xx - lavc 60.3.100 - avcodec.h + Add FF_PROFILE_HEVC_SCC. + 2023-02-13 - xx - lavu 58.1.100 - frame.h Deprecate AVFrame.coded_picture_number and display_picture_number. Their usefulness is questionable and very few decoders set them. diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 39881a1d2b..9a0fe97cad 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -1654,6 +1654,7 @@ typedef struct AVCodecContext { #define FF_PROFILE_HEVC_MAIN_10 2 #define FF_PROFILE_HEVC_MAIN_STILL_PICTURE 3 #define FF_PROFILE_HEVC_REXT4 +#define FF_PROFILE_HEVC_SCC 9 #define FF_PROFILE_VVC_MAIN_10 1 #define FF_PROFILE_VVC_MAIN_10_444 33 diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c index 5fe62ec35b..4aa5b76d5f 100644 --- a/libavcodec/hevc_ps.c +++ b/libavcodec/hevc_ps.c @@ -259,6 +259,8 @@ static int decode_profile_tier_level(GetBitContext *gb, AVCodecContext *avctx, av_log(avctx, AV_LOG_DEBUG, "Main Still Picture profile bitstream\n"); else if (ptl->profile_idc == FF_PROFILE_HEVC_REXT) av_log(avctx, AV_LOG_DEBUG, "Range Extension profile bitstream\n"); +else if (ptl->profile_idc == FF_PROFILE_HEVC_SCC) +av_log(avctx, AV_LOG_DEBUG, "Screen Content Coding Extension profile bitstream\n"); else av_log(avctx, AV_LOG_WARNING, "Unknown HEVC profile: %d\n", ptl->profile_idc); diff --git a/libavcodec/profiles.c b/libavcodec/profiles.c index 7af7fbeb13..2230fc5415 100644 --- a/libavcodec/profiles.c +++ b/libavcodec/profiles.c @@ -85,6 +85,7 @@ const AVProfile ff_hevc_profiles[] = { { FF_PROFILE_HEVC_MAIN_10, "Main 10" }, { FF_PROFILE_HEVC_MAIN_STILL_PICTURE, "Main Still Picture" }, { FF_PROFILE_HEVC_REXT, "Rext"}, +{ FF_PROFILE_HEVC_SCC, "Scc" }, { FF_PROFILE_UNKNOWN }, }; diff --git a/libavcodec/version.h b/libavcodec/version.h index 0550d7b0d8..43794ea588 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -29,7 +29,7 @@ #include "version_major.h" -#define LIBAVCODEC_VERSION_MINOR 2 +#define LIBAVCODEC_VERSION_MINOR 3 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ -- 2.25.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v3 1/3] hwcontext_d3d11va: add mutiple supported DXGI formats
On Di, 2023-02-14 at 10:45 +0800, Tong Wu wrote: > Add support for VUYX, YUYV422, Y210, XV30, P012, Y212, XV36. > > The added formats work with qsv acceleration and will not have > impact on d3d11va acceleration(-hwaccel d3d11va) since so far > these formats are still not supported by using d3d11va acceleration. > > Hwupload and hwdownload can work with the added formats. > > Signed-off-by: Tong Wu > --- > libavutil/hwcontext_d3d11va.c | 7 +++ > 1 file changed, 7 insertions(+) > > diff --git a/libavutil/hwcontext_d3d11va.c b/libavutil/hwcontext_d3d11va.c > index 363ec6a47d..aa50538d64 100644 > --- a/libavutil/hwcontext_d3d11va.c > +++ b/libavutil/hwcontext_d3d11va.c > @@ -89,6 +89,13 @@ static const struct { > { DXGI_FORMAT_B8G8R8A8_UNORM,AV_PIX_FMT_BGRA }, > { DXGI_FORMAT_R10G10B10A2_UNORM, AV_PIX_FMT_X2BGR10 }, > { DXGI_FORMAT_R16G16B16A16_FLOAT, AV_PIX_FMT_RGBAF16 }, > +{ DXGI_FORMAT_AYUV, AV_PIX_FMT_VUYX }, > +{ DXGI_FORMAT_YUY2, AV_PIX_FMT_YUYV422 }, > +{ DXGI_FORMAT_Y210, AV_PIX_FMT_Y210 }, > +{ DXGI_FORMAT_Y410, AV_PIX_FMT_XV30 }, > +{ DXGI_FORMAT_P016, AV_PIX_FMT_P012 }, > +{ DXGI_FORMAT_Y216, AV_PIX_FMT_Y212 }, > +{ DXGI_FORMAT_Y416, AV_PIX_FMT_XV36 }, > // Special opaque formats. The pix_fmt is merely a place holder, as the > // opaque format cannot be accessed directly. > { DXGI_FORMAT_420_OPAQUE, AV_PIX_FMT_YUV420P }, LGTM, thx - Haihao ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v2] libavcodec/qsvenc: Do not pass RGB solorspace to VPL/MSDK
On Ma, 2023-02-13 at 16:49 +0800, wenbin.chen-at-intel@ffmpeg.org wrote: > From: Wenbin Chen > > When encode RGB frame, Intel driver convert RGB to YUV, so we cannot > set RGB colorspace to VPL/MSDK. > > Signed-off-by: Wenbin Chen > --- > libavcodec/qsvenc.c | 7 ++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c > index 2f0e94a914..d3f7532fc0 100644 > --- a/libavcodec/qsvenc.c > +++ b/libavcodec/qsvenc.c > @@ -1185,7 +1185,12 @@ static int init_video_param(AVCodecContext *avctx, > QSVEncContext *q) > q->extvsi.ColourDescriptionPresent = 1; > q->extvsi.ColourPrimaries = avctx->color_primaries; > q->extvsi.TransferCharacteristics = avctx->color_trc; > -q->extvsi.MatrixCoefficients = avctx->colorspace; > +if (avctx->colorspace == AVCOL_SPC_RGB) > +// RGB will be converted to YUV, so RGB colorspace is not > supported > +q->extvsi.MatrixCoefficients = AVCOL_SPC_UNSPECIFIED; > +else > +q->extvsi.MatrixCoefficients = avctx->colorspace; > + > } > > if ((avctx->codec_id != AV_CODEC_ID_VP9) && (q->extvsi.VideoFullRange || > q->extvsi.ColourDescriptionPresent)) { LGTM, will apply Thanks Haihao ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v2] libavcodec/qsvenc: Flush cached frames before reset encoder
On Ma, 2023-02-13 at 17:03 +0800, wenbin.chen-at-intel@ffmpeg.org wrote: > From: Wenbin Chen > > According to > https://github.com/Intel-Media-SDK/MediaSDK/blob/master/doc/mediasdk-man.md#configuration-change > . > Before calling MFXVideoENCODE_Reset, The application needs to retrieve > any cached frames in the SDK encoder. > A loop is added before MFXVideoENCODE_Reset to retrieve cached frames > and add them to async_fifo, so that dynamic configuration works when > async_depth > 1. > > Signed-off-by: Wenbin Chen > --- > libavcodec/qsvenc.c | 122 > 1 file changed, 66 insertions(+), 56 deletions(-) > > diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c > index 2f0e94a914..3951f40e7b 100644 > --- a/libavcodec/qsvenc.c > +++ b/libavcodec/qsvenc.c > @@ -1600,7 +1600,7 @@ int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext > *q) > > q->param.AsyncDepth = q->async_depth; > > -q->async_fifo = av_fifo_alloc2(q->async_depth, sizeof(QSVPacket), 0); > +q->async_fifo = av_fifo_alloc2(q->async_depth, sizeof(QSVPacket), > AV_FIFO_FLAG_AUTO_GROW); > if (!q->async_fifo) > return AVERROR(ENOMEM); > > @@ -2296,58 +2296,6 @@ static int update_pic_timing_sei(AVCodecContext *avctx, > QSVEncContext *q) > return updated; > } > > -static int update_parameters(AVCodecContext *avctx, QSVEncContext *q, > - const AVFrame *frame) > -{ > -int needReset = 0, ret = 0; > - > -if (!frame || avctx->codec_id == AV_CODEC_ID_MJPEG) > -return 0; > - > -needReset = update_qp(avctx, q); > -needReset |= update_max_frame_size(avctx, q); > -needReset |= update_gop_size(avctx, q); > -needReset |= update_rir(avctx, q); > -needReset |= update_low_delay_brc(avctx, q); > -needReset |= update_frame_rate(avctx, q); > -needReset |= update_bitrate(avctx, q); > -needReset |= update_pic_timing_sei(avctx, q); > -ret = update_min_max_qp(avctx, q); > -if (ret < 0) > -return ret; > -needReset |= ret; > -if (!needReset) > -return 0; > - > -if (avctx->hwaccel_context) { > -AVQSVContext *qsv = avctx->hwaccel_context; > -int i, j; > -q->param.ExtParam = q->extparam; > -for (i = 0; i < qsv->nb_ext_buffers; i++) > -q->param.ExtParam[i] = qsv->ext_buffers[i]; > -q->param.NumExtParam = qsv->nb_ext_buffers; > - > -for (i = 0; i < q->nb_extparam_internal; i++) { > -for (j = 0; j < qsv->nb_ext_buffers; j++) { > -if (qsv->ext_buffers[j]->BufferId == q->extparam_internal[i]- > >BufferId) > -break; > -} > -if (j < qsv->nb_ext_buffers) > -continue; > -q->param.ExtParam[q->param.NumExtParam++] = q- > >extparam_internal[i]; > -} > -} else { > -q->param.ExtParam= q->extparam_internal; > -q->param.NumExtParam = q->nb_extparam_internal; > -} > -av_log(avctx, AV_LOG_DEBUG, "Parameter change, call msdk reset.\n"); > -ret = MFXVideoENCODE_Reset(q->session, >param); > -if (ret < 0) > -return ff_qsv_print_error(avctx, ret, "Error during resetting"); > - > -return 0; > -} > - > static int encode_frame(AVCodecContext *avctx, QSVEncContext *q, > const AVFrame *frame) > { > @@ -2438,7 +2386,7 @@ static int encode_frame(AVCodecContext *avctx, > QSVEncContext *q, > > if (ret < 0) { > ret = (ret == MFX_ERR_MORE_DATA) ? > - 0 : ff_qsv_print_error(avctx, ret, "Error during encoding"); > + AVERROR(EAGAIN) : ff_qsv_print_error(avctx, ret, "Error during > encoding"); > goto free; > } > > @@ -2448,7 +2396,9 @@ static int encode_frame(AVCodecContext *avctx, > QSVEncContext *q, > ret = 0; > > if (*pkt.sync) { > -av_fifo_write(q->async_fifo, , 1); > +ret = av_fifo_write(q->async_fifo, , 1); > +if (ret < 0) > +goto free; > } else { > free: > av_freep(); > @@ -2466,6 +2416,66 @@ nomem: > goto free; > } > > +static int update_parameters(AVCodecContext *avctx, QSVEncContext *q, > + const AVFrame *frame) > +{ > +int needReset = 0, ret = 0; > + > +if (!frame || avctx->codec_id == AV_CODEC_ID_MJPEG) > +return 0; > + > +needReset = update_qp(avctx, q); > +needReset |= update_max_frame_size(avctx, q); > +needReset |= update_gop_size(avctx, q); > +needReset |= update_rir(avctx, q); > +needReset |= update_low_delay_brc(avctx, q); > +needReset |= update_frame_rate(avctx, q); > +needReset |= update_bitrate(avctx, q); > +needReset |= update_pic_timing_sei(avctx, q); > +ret = update_min_max_qp(avctx, q); > +if (ret < 0) > +return ret; > +needReset |= ret; > +if (!needReset) > +return 0; > + > +if (avctx->hwaccel_context) {
[FFmpeg-devel] [PATCH] doc: remove docs for options removed at the bump
Signed-off-by: Marton Balint --- doc/encoders.texi | 16 doc/filters.texi | 5 - doc/muxers.texi | 6 -- 3 files changed, 27 deletions(-) diff --git a/doc/encoders.texi b/doc/encoders.texi index 727f12a59d..b02737b9df 100644 --- a/doc/encoders.texi +++ b/doc/encoders.texi @@ -1949,22 +1949,6 @@ Set the number of slices, used in parallelized encoding. Default value is 0. This is only used when @option{slice_mode} is set to @samp{fixed}. -@item slice_mode -Set slice mode. Can assume one of the following possible values: - -@table @samp -@item fixed -a fixed number of slices -@item rowmb -one slice per row of macroblocks -@item auto -automatic number of slices according to number of threads -@item dyn -dynamic slicing -@end table - -Default value is @samp{auto}. - @item loopfilter Enable loop filter, if set to 1 (automatically enabled). To disable set a value of 0. diff --git a/doc/filters.texi b/doc/filters.texi index a4e235d2af..49b0cd0683 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -26843,11 +26843,6 @@ Specify the frame rate expected for the video stream. @item pixel_aspect, sar The sample (pixel) aspect ratio of the input video. -@item sws_param -This option is deprecated and ignored. Prepend @code{sws_flags=@var{flags};} -to the filtergraph description to specify swscale flags for automatically -inserted scalers. See @ref{Filtergraph syntax}. - @item hw_frames_ctx When using a hardware pixel format, this should be a reference to an AVHWFramesContext describing input frames. diff --git a/doc/muxers.texi b/doc/muxers.texi index ed5341be39..79dd864182 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -795,12 +795,6 @@ deletes them. Increase this to allow continue clients to download segments which were recently referenced in the playlist. Default value is 1, meaning segments older than @code{hls_list_size+1} will be deleted. -@item hls_ts_options @var{options_list} -Set output format options using a :-separated list of key=value -parameters. Values containing @code{:} special characters must be -escaped. -@code{hls_ts_options} is deprecated, use hls_segment_options instead of it.. - @item hls_start_number_source Start the playlist sequence number (@code{#EXT-X-MEDIA-SEQUENCE}) according to the specified source. Unless @code{hls_flags single_file} is set, it also specifies source of starting sequence numbers of -- 2.35.3 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avformat: deprecate AVFormatContext io_close callback
On Wed, 15 Feb 2023, Anton Khirnov wrote: Quoting Marton Balint (2023-02-14 21:30:09) On Tue, 14 Feb 2023, Anton Khirnov wrote: Quoting Marton Balint (2023-02-13 22:37:54) diff --git a/libavformat/version.h b/libavformat/version.h index 904e7f06aa..7ff1483912 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -31,7 +31,7 @@ #include "version_major.h" -#define LIBAVFORMAT_VERSION_MINOR 2 +#define LIBAVFORMAT_VERSION_MINOR 3 I don't think this needs a version bump, because nothing about the API or ABI changes with this commit, it's just an expression of intent to change it in the future. My concern with not increasing the version number is that the entry in doc/APIChanges will not point to the version where the change happened... I don't see that as a problem, because the relevant question from the user perspective is "in what version was the replacement for added" rather than "in what version was deprecated", since one should always use the newer API when it is present. Ok, applied without the bump. Thanks, Marton ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avcodec/libx265: fix else clause when zeroing reordered_opaque
On Mon, 13 Feb 2023, Marton Balint wrote: CC libavcodec/libx265.o libavcodec/libx265.c: In function ‘libx265_encode_frame’: libavcodec/libx265.c:781:5: warning: this ‘else’ clause does not guard... [-Wmisleading-indentation] else ^~~~ libavcodec/libx265.c:782:1: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’ FF_DISABLE_DEPRECATION_WARNINGS ^~~ Applied. Regards, Marton Signed-off-by: Marton Balint --- libavcodec/libx265.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c index 6a2600c5e7..420d0953af 100644 --- a/libavcodec/libx265.c +++ b/libavcodec/libx265.c @@ -778,10 +778,11 @@ FF_ENABLE_DEPRECATION_WARNINGS rd_release(ctx, idx); } #if FF_API_REORDERED_OPAQUE -else +else { FF_DISABLE_DEPRECATION_WARNINGS avctx->reordered_opaque = 0; FF_ENABLE_DEPRECATION_WARNINGS +} #endif *got_packet = 1; -- 2.35.3 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] FFmpeg 6.0
On Fri, Feb 10, 2023 at 07:50:29PM +0100, Lynne wrote: > Feb 10, 2023, 18:47 by mich...@niedermayer.cc: > > > Hi all > > > > i plan to branch off release/6.0 from master in the next days > > If theres something blocking and i should wait, please reply here > > > > 6.0 release will be maybe 1 week after the branch point > > once it has branched all important fixes should be backported of course > > > > Working hard on the Vulkan rewrite with video decoding, finished > the infra today, just need to port all filters to it. I should be done > in a couple of days, so please wait for it. Please reply here when its no longer blocking branching thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Dictatorship: All citizens are under surveillance, all their steps and actions recorded, for the politicians to enforce control. Democracy: All politicians are under surveillance, all their steps and actions recorded, for the citizens to enforce control. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] avformat/matroskadec: Prevent expensive get_cue_desc lookups
Due to the way the bandwidth estimation code works, the get_cue_desc function was called many times over. This function did a from-scratch lookup using a timestamp. This lookup was done using linear iteration (O(n)), resulting in significant overhead when many cues exist. This change uses ff_index_search_timestamp (binary search, O(log n)) for the lookup. Additionally, the lookup is prevented entirely in most cases by maintaining the indexes of the cues (O(1)). Signed-off-by: Tom Boshoven --- libavformat/matroskadec.c | 64 +++ 1 file changed, 38 insertions(+), 26 deletions(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index d582f566a2..c81694c55b 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -4008,35 +4008,45 @@ typedef struct { int64_t end_offset; } CueDesc; -/* This function searches all the Cues and returns the CueDesc corresponding to - * the timestamp ts. Returned CueDesc will be such that start_time_ns <= ts < - * end_time_ns. All 4 fields will be set to -1 if ts >= file's duration or - * if an error occurred. +/** + * Find the index of the cue corresponding to the timestamp ts. */ -static CueDesc get_cue_desc(AVFormatContext *s, int64_t ts, int64_t cues_start) { +static int get_cue_index(AVFormatContext *s, int64_t ts) { +MatroskaDemuxContext *matroska = s->priv_data; +FFStream *const sti = ffstream(s->streams[0]); + +if (ts >= (int64_t)(matroska->duration * matroska->time_scale)) +return -1; + +// Look up the index entry corresponding to the timestamp (dividing by timescale) +return ff_index_search_timestamp( +sti->index_entries, +sti->nb_index_entries, +ts / matroska->time_scale, +AVSEEK_FLAG_ANY | AVSEEK_FLAG_BACKWARD +); +} + +/** + * Get the CueDesc for a specific index. + * For a given timestamp, the index can be obtained using get_cue_index. + */ +static CueDesc get_cue_desc_from_index(AVFormatContext *s, int idx, int64_t cues_start) { MatroskaDemuxContext *matroska = s->priv_data; FFStream *const sti = ffstream(s->streams[0]); AVIndexEntry *const index_entries = sti->index_entries; int nb_index_entries = sti->nb_index_entries; CueDesc cue_desc; -int i; -if (ts >= (int64_t)(matroska->duration * matroska->time_scale)) +if (idx < 0 || idx >= nb_index_entries) { return (CueDesc) {-1, -1, -1, -1}; -for (i = 1; i < nb_index_entries; i++) { -if (index_entries[i - 1].timestamp * matroska->time_scale <= ts && -index_entries[i].timestamp * matroska->time_scale > ts) { -break; -} } ---i; -if (index_entries[i].timestamp > matroska->duration) -return (CueDesc) {-1, -1, -1, -1}; -cue_desc.start_time_ns = index_entries[i].timestamp * matroska->time_scale; -cue_desc.start_offset = index_entries[i].pos - matroska->segment_start; -if (i != nb_index_entries - 1) { -cue_desc.end_time_ns = index_entries[i + 1].timestamp * matroska->time_scale; -cue_desc.end_offset = index_entries[i + 1].pos - matroska->segment_start; + +cue_desc.start_time_ns = index_entries[idx].timestamp * matroska->time_scale; +cue_desc.start_offset = index_entries[idx].pos - matroska->segment_start; +if (idx != nb_index_entries - 1) { +cue_desc.end_time_ns = index_entries[idx + 1].timestamp * matroska->time_scale; +cue_desc.end_offset = index_entries[idx + 1].pos - matroska->segment_start; } else { cue_desc.end_time_ns = matroska->duration * matroska->time_scale; // FIXME: this needs special handling for files where Cues appear @@ -4110,7 +4120,8 @@ static int buffer_size_after_time_downloaded(int64_t time_ns, double search_sec, int64_t time_to_search_ns = (int64_t)(search_sec * nano_seconds_per_second); int64_t end_time_ns = time_ns + time_to_search_ns; double sec_downloaded = 0.0; -CueDesc desc_curr = get_cue_desc(s, time_ns, cues_start); +int cue_idx = get_cue_index(s, time_ns); +CueDesc desc_curr = get_cue_desc_from_index(s, cue_idx, cues_start); if (desc_curr.start_time_ns == -1) return -1; *sec_to_download = 0.0; @@ -4138,7 +4149,7 @@ static int buffer_size_after_time_downloaded(int64_t time_ns, double search_sec, } // Get the next Cue. - desc_curr = get_cue_desc(s, desc_curr.end_time_ns, cues_start); + desc_curr = get_cue_desc_from_index(s, ++cue_idx, cues_start); } while (desc_curr.start_time_ns != -1) { @@ -4167,7 +4178,7 @@ static int buffer_size_after_time_downloaded(int64_t time_ns, double search_sec, break; } -desc_curr = get_cue_desc(s, desc_curr.end_time_ns, cues_start); +desc_curr = get_cue_desc_from_index(s, ++cue_idx, cues_start); } *buffer = *buffer + sec_downloaded; return rv; @@ -4196,7 +4207,8 @@ static int64_t
Re: [FFmpeg-devel] [PATCH v14 9/9] avcodec/evc: Changes in Changelog and MAINTAINERS files
On Wed, 15 Feb 2023 at 08:49, Dawid Kozinski/Multimedia (PLT) /SRPOL/Staff Engineer/Samsung Electronics wrote: > > Dear Kieran, > > While I appreciate your concerns, I must point out that the issues you > mentioned regarding the maintenance of third-party libraries are not > limited > to corporate contributors. People change jobs and their focus may change, > but this is not exclusive to those working for corporations. Furthermore, > it > is not necessarily the case that someone who has maintained a particular > part of code in a project like FFmpeg will abruptly cease doing so upon > changing jobs. > > I believe it's important to consider each individual's level of commitment > to a project, rather than making assumptions based on generalizations. It's > also worth noting that while there may have been issues with maintaining > patches to certain third-party libraries in the past, it doesn't mean that > it will be each and every time. > > Regards > Dawid > Whilst all of this is true, the community is able to pick up when it's an internal FFmpeg component. When it's a third-party library on another person's Github, the community can't do that. Kieran ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] RK Audio demuxer and decoder
On 2/5/2023 4:17 PM, Paul B Mahol wrote: On 2/4/23, Paul B Mahol wrote: Hi, Patches attached, decoder is not bit by bit exact yet for lossless mode because some samples are not properly rounded. Now lossless mode is bit exact. [...] +static av_cold int rka_decode_init(AVCodecContext *avctx) +{ +RKAContext *s = avctx->priv_data; +int cmode; + +if (avctx->extradata_size < 16) +return AVERROR_INVALIDDATA; + +s->bps = avctx->bits_per_raw_sample = avctx->extradata[13]; + +switch (s->bps) { +case 8: +avctx->sample_fmt = AV_SAMPLE_FMT_U8P; +break; +case 16: +avctx->sample_fmt = AV_SAMPLE_FMT_S16P; +break; +default: +return AVERROR_INVALIDDATA; +} + +s->channels = avctx->ch_layout.nb_channels; You're ignoring the channels reported by the extradata despite flagging this decoder as AV_CODEC_CAP_CHANNEL_CONF. It should be the other way around, and ignore the user set layout, if any, with av_channel_layout_uninit(>ch_layout); s->channels = avctx->ch_layout.nb_channels = avctx->extradata[12]; Because the stream may not necessarily come from the lavf demuxer. Extradata presence is required given you check for it above, but the avctx fields could be set to whatever if the source is not the lavf rka demuxer. +if (s->channels < 1 || s->channels > 2) +return AVERROR_INVALIDDATA; + +s->align = (s->channels * (avctx->bits_per_raw_sample >> 3)); +s->samples_left = s->total_nb_samples = (AV_RL32(avctx->extradata + 4)) / s->align; +s->frame_samples = 131072 / s->align; +s->last_nb_samples = s->total_nb_samples % s->frame_samples; + +cmode = avctx->extradata[14] & 0xf; +if ((avctx->extradata[15] & 4) != 0) +cmode = -cmode; + +s->ch[0].cmode = s->ch[1].cmode = cmode; +s->ch[0].cmode2 = -s->ch[0].cmode; +s->ch[1].cmode2 = -s->ch[1].cmode; +av_log(avctx, AV_LOG_DEBUG, "cmode: %d\n", cmode); + +return 0; +} ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
[FFmpeg-devel] [PATCH] lavfi/metal: fix build for iOS with deployment target lower than 13
supportsFamily: is only available on iOS 13.0 or newer Signed-off-by: Rechi --- libavfilter/metal/utils.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavfilter/metal/utils.m b/libavfilter/metal/utils.m index f365d3cee..bb1825ae3 100644 --- a/libavfilter/metal/utils.m +++ b/libavfilter/metal/utils.m @@ -31,7 +31,7 @@ void ff_metal_compute_encoder_dispatch(id device, BOOL fallback = YES; // MAC_OS_X_VERSION_10_15 is only defined on SDKs new enough to include its functionality (including iOS, tvOS, etc) #ifdef MAC_OS_X_VERSION_10_15 -if (@available(macOS 10.15, iOS 11, tvOS 14.5, *)) { +if (@available(macOS 10.15, iOS 13, tvOS 14.5, *)) { if ([device supportsFamily:MTLGPUFamilyCommon3]) { MTLSize threadsPerGrid = MTLSizeMake(width, height, 1); [encoder dispatchThreads:threadsPerGrid threadsPerThreadgroup:threadsPerThreadgroup]; -- 2.39.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] Towards YUVJ removal
On Fri, 9 Dec 2022, Niklas Haas wrote: So, as was discussed at the last meeting, we should move towards removing YUVJ. Libswscale still does have cases where it doesn't work correctly, for some conversions, unless differences in range is signalled with the YUVJ pixel formats (this, despite that swscale itself warns that the user is specifying the deprecated pixel formats). Attached is a small testcase example, which uses swscale to convert from YUV to YUV, with various color spaces and ranges. When converting from limited to full range or vice versa, within the same colorspace, swscale fails to realize that this isn't a no-op operation, unless the YUVJ formats are used. When running the attached test example, I get the following output (modulo swscale warnings): red 601 limited -> 601 full YUV 49,109,184 -> 38,106,192 red 601 full -> 601 limited YUV 38,106,192 -> 49,109,184 red 709 limited -> 709 full YUV 39,115,184 -> 27,113,192 red 709 full -> 709 limited YUV 27,113,192 -> 39,115,184 If the example is modified to always set yuv_{in,out}->format to AV_PIX_FMT_YUV420P, then swscale no longer actually does any conversion: red 601 limited -> 601 full YUV 49,109,184 -> 49,109,184 red 601 full -> 601 limited YUV 38,106,192 -> 38,106,192 red 709 limited -> 709 full YUV 39,115,184 -> 39,115,184 red 709 full -> 709 limited YUV 27,113,192 -> 27,113,192 So this is yet another small detail that needs to be fixed before we can proceed towards actually removing the YUVJ formats. // Martin #include #include static void yuv2yuv(int Y, int U, int V, int in_colorspace, int param_in_full, int out_colorspace, int param_out_full, const char* name) { AVFrame* yuv_in = av_frame_alloc(); yuv_in->format = param_in_full ? AV_PIX_FMT_YUVJ420P : AV_PIX_FMT_YUV420P; yuv_in->width = 128; yuv_in->height = 128; yuv_in->color_range = param_in_full ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG; yuv_in->color_primaries = in_colorspace; yuv_in->color_trc = in_colorspace; yuv_in->colorspace = in_colorspace; av_frame_get_buffer(yuv_in, 0); AVFrame* yuv_out = av_frame_alloc(); yuv_out->format = param_out_full ? AV_PIX_FMT_YUVJ420P : AV_PIX_FMT_YUV420P; yuv_out->width = 128; yuv_out->height = 128; yuv_out->color_range = param_out_full ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG; yuv_out->color_primaries = out_colorspace; yuv_out->color_trc = out_colorspace; yuv_out->colorspace = out_colorspace; av_frame_get_buffer(yuv_out, 0); memset(yuv_in->data[0], Y, yuv_in->linesize[0] * yuv_in->height); memset(yuv_in->data[1], U, yuv_in->linesize[1] * (yuv_in->height / 2)); memset(yuv_in->data[2], V, yuv_in->linesize[2] * (yuv_in->height / 2)); struct SwsContext *sws = sws_getContext(yuv_in->width, yuv_in->height, yuv_in->format, yuv_out->width, yuv_out->height, yuv_out->format, 0, NULL, NULL, NULL); int in_full, out_full, brightness, contrast, saturation; const int *inv_table, *table; sws_getColorspaceDetails(sws, (int **)_table, _full, (int **), _full, , , ); in_full = param_in_full; out_full = param_out_full; inv_table = sws_getCoefficients(in_colorspace); table = sws_getCoefficients(out_colorspace); sws_setColorspaceDetails(sws, inv_table, in_full, table, out_full, brightness, contrast, saturation); sws_scale_frame(sws, yuv_out, yuv_in); printf("%s YUV %d,%d,%d -> %d,%d,%d\n", name, Y, U, V, yuv_out->data[0][0], yuv_out->data[1][0], yuv_out->data[2][0]); } int main(int argc, char* argv[]) { yuv2yuv(49, 109, 184, SWS_CS_ITU601, 0, SWS_CS_ITU601, 1, "red 601 limited -> 601 full"); yuv2yuv(38, 106, 192, SWS_CS_ITU601, 1, SWS_CS_ITU601, 0, "red 601 full -> 601 limited"); yuv2yuv(39, 115, 184, SWS_CS_ITU709, 0, SWS_CS_ITU709, 1, "red 709 limited -> 709 full"); yuv2yuv(27, 113, 192, SWS_CS_ITU709, 1, SWS_CS_ITU709, 0, "red 709 full -> 709 limited"); return 0; } ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v14 9/9] avcodec/evc: Changes in Changelog and MAINTAINERS files
-Original Message- From: ffmpeg-devel On Behalf Of Lynne Sent: wtorek, 14 lutego 2023 19:01 To: FFmpeg development discussions and patches Subject: Re: [FFmpeg-devel] [PATCH v14 9/9] avcodec/evc: Changes in Changelog and MAINTAINERS files Feb 14, 2023, 13:10 by d.kozin...@samsung.com: > > -Original Message- > From: ffmpeg-devel On Behalf Of > Lynne > Sent: poniedziałek, 13 lutego 2023 18:32 > To: FFmpeg development discussions and patches > > Subject: Re: [FFmpeg-devel] [PATCH v14 9/9] avcodec/evc: Changes in > Changelog and MAINTAINERS files > > Feb 13, 2023, 10:29 by d.kozin...@samsung.com: > >> Lynne, if it concerns us, we will comply with both the current and >> the new maintainership policy once your patchset is pushed. We see >> that your change has not yet been pushed into the main branch, and it >> appears that the discussion on this topic may still be ongoing, >> although both Michael and other maintainers have reviewed and >> commented on >> > it. > >> >> > > What do you mean both current and new policy? > > Lynne, you mentioned a new policy change on maintainership in one of > the previous emails: > "I assign myself to personally review the patchset and push it, if you > review my policy change on maintainership. As I said, I have no > objection on who gets maintainership, just that it is done explicitly > via a separate list in the maintainers file." > Fair enough, I'll just review the patchset while ignoring this patch. Dear Lynne, Thank you for your response. I really appreciate your willingness to review the patchset, and I I'm looking forward to hearing your feedback. I understand that this patch may present some challenges, since it's a quite big, but I believe that with your guidance, we can finally come up with a solution that meets FFmpeg requirements. Thank you again for taking the time to review the patchset. We will be eagerly awaiting your feedback. Best regards, Dawid ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://protect2.fireeye.com/v1/url?k=c6da1d34-a6388069-c6db967b-000babd9f1ba-f1087034b8a00e05=1=f6840520-ddf5-4d1d-890b-9f658856ac36=https%3A%2F%2Fffmpeg.org%2Fmailman%2Flistinfo%2Fffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH v14 9/9] avcodec/evc: Changes in Changelog and MAINTAINERS files
-Original Message- From: ffmpeg-devel On Behalf Of Kieran Kunhya Sent: wtorek, 14 lutego 2023 19:04 To: FFmpeg development discussions and patches Subject: Re: [FFmpeg-devel] [PATCH v14 9/9] avcodec/evc: Changes in Changelog and MAINTAINERS files On Tue, 14 Feb 2023 at 12:10, Dawid Kozinski/Multimedia (PLT) /SRPOL/Staff Engineer/Samsung Electronics wrote: > > At the moment, it doesn't matter to us whether there are two lists or one. > What matters to us is pushing our patchset containing an EVC codec > wrapper to ffmpeg. We want to refine and maintain this code and have > the information somewhere about who is responsible for it (EVC) and > who to contact with questions. We hope that our patchset will > eventually be accepted, and we will then apply for write access to Git > because we want to take care of the EVC code. > I appreciate your sincerity but history shows that patches to third-party libs from corporate contributors are not maintained (as Ronald said). People change jobs, work focus changes etc etc. A good example of this is libyami. Even more so for EVC which has had very limited uptake. Regards, Kieran Kunhya Dear Kieran, While I appreciate your concerns, I must point out that the issues you mentioned regarding the maintenance of third-party libraries are not limited to corporate contributors. People change jobs and their focus may change, but this is not exclusive to those working for corporations. Furthermore, it is not necessarily the case that someone who has maintained a particular part of code in a project like FFmpeg will abruptly cease doing so upon changing jobs. I believe it's important to consider each individual's level of commitment to a project, rather than making assumptions based on generalizations. It's also worth noting that while there may have been issues with maintaining patches to certain third-party libraries in the past, it doesn't mean that it will be each and every time. Regards Dawid ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://protect2.fireeye.com/v1/url?k=855b68ee-e4268092-855ae3a1-74fe485cc33 c-1cc56f5c2e13512a=1=5312676a-e04b-4a74-875c-83809d999e92=https%3A%2F% 2Fffmpeg.org%2Fmailman%2Flistinfo%2Fffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".