No hwaccel other than nvdec cares about this field Signed-off-by: James Almer <jamr...@gmail.com> --- libavcodec/av1dec.c | 33 --------------------------------- libavcodec/av1dec.h | 2 -- libavcodec/nvdec_av1.c | 29 ++++++++++++++++++++++++++++- 3 files changed, 28 insertions(+), 36 deletions(-)
diff --git a/libavcodec/av1dec.c b/libavcodec/av1dec.c index c1967f03bd..c8f9152451 100644 --- a/libavcodec/av1dec.c +++ b/libavcodec/av1dec.c @@ -217,36 +217,6 @@ static void skip_mode_params(AV1DecContext *s) AV1_REF_FRAME_LAST + FFMAX(forward_idx, second_forward_idx); } -static void coded_lossless_param(AV1DecContext *s) -{ - const AV1RawFrameHeader *header = s->raw_frame_header; - int i; - - if (header->delta_q_y_dc || header->delta_q_u_ac || - header->delta_q_u_dc || header->delta_q_v_ac || - header->delta_q_v_dc) { - s->cur_frame.coded_lossless = 0; - return; - } - - s->cur_frame.coded_lossless = 1; - for (i = 0; i < AV1_MAX_SEGMENTS; i++) { - int qindex; - if (header->feature_enabled[i][AV1_SEG_LVL_ALT_Q]) { - qindex = (header->base_q_idx + - header->feature_value[i][AV1_SEG_LVL_ALT_Q]); - } else { - qindex = header->base_q_idx; - } - qindex = av_clip_uintp2(qindex, 8); - - if (qindex) { - s->cur_frame.coded_lossless = 0; - return; - } - } -} - static int init_tile_data(AV1DecContext *s) { @@ -447,7 +417,6 @@ static void av1_frame_unref(AVCodecContext *avctx, AV1Frame *f) f->spatial_id = f->temporal_id = 0; memset(f->skip_mode_frame_idx, 0, 2 * sizeof(uint8_t)); - f->coded_lossless = 0; } static int av1_frame_ref(AVCodecContext *avctx, AV1Frame *dst, const AV1Frame *src) @@ -482,7 +451,6 @@ static int av1_frame_ref(AVCodecContext *avctx, AV1Frame *dst, const AV1Frame *s memcpy(dst->skip_mode_frame_idx, src->skip_mode_frame_idx, 2 * sizeof(uint8_t)); - dst->coded_lossless = src->coded_lossless; return 0; @@ -760,7 +728,6 @@ static int get_current_frame(AVCodecContext *avctx) global_motion_params(s); skip_mode_params(s); - coded_lossless_param(s); return ret; } diff --git a/libavcodec/av1dec.h b/libavcodec/av1dec.h index 4b218f64bb..bc6ae68d1a 100644 --- a/libavcodec/av1dec.h +++ b/libavcodec/av1dec.h @@ -46,8 +46,6 @@ typedef struct AV1Frame { int32_t gm_params[AV1_NUM_REF_FRAMES][6]; uint8_t skip_mode_frame_idx[2]; - - uint8_t coded_lossless; } AV1Frame; typedef struct TileGroupInfo { diff --git a/libavcodec/nvdec_av1.c b/libavcodec/nvdec_av1.c index f6267b1d96..1a553902bc 100644 --- a/libavcodec/nvdec_av1.c +++ b/libavcodec/nvdec_av1.c @@ -37,6 +37,33 @@ static int get_bit_depth_from_seq(const AV1RawSequenceHeader *seq) return 8; } +static int get_coded_lossless_param(const AV1DecContext *s) +{ + const AV1RawFrameHeader *frame_header = s->raw_frame_header; + + if (frame_header->delta_q_y_dc || frame_header->delta_q_u_ac || + frame_header->delta_q_u_dc || frame_header->delta_q_v_ac || + frame_header->delta_q_v_dc) { + return 0; + } + + for (int i = 0; i < AV1_MAX_SEGMENTS; i++) { + int qindex; + if (frame_header->feature_enabled[i][AV1_SEG_LVL_ALT_Q]) { + qindex = (frame_header->base_q_idx + + frame_header->feature_value[i][AV1_SEG_LVL_ALT_Q]); + } else { + qindex = frame_header->base_q_idx; + } + qindex = av_clip_uintp2(qindex, 8); + + if (qindex) + return 0; + } + + return 1; +} + static int nvdec_av1_start_frame(AVCodecContext *avctx, const uint8_t *buffer, uint32_t size) { const AV1DecContext *s = avctx->priv_data; @@ -119,7 +146,7 @@ static int nvdec_av1_start_frame(AVCodecContext *avctx, const uint8_t *buffer, u .delta_q_present = frame_header->delta_q_present, .delta_q_res = frame_header->delta_q_res, .using_qmatrix = frame_header->using_qmatrix, - .coded_lossless = s->cur_frame.coded_lossless, + .coded_lossless = get_coded_lossless_param(s), .use_superres = frame_header->use_superres, .tx_mode = frame_header->tx_mode, .reference_mode = frame_header->reference_select, -- 2.29.2 _______________________________________________ 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".