Skip to content

Commit

Permalink
add fixes for HEVC 10bit HDR decoding in bsf
Browse files Browse the repository at this point in the history
  • Loading branch information
nyanmisaka committed Oct 16, 2021
1 parent 3fb7dd3 commit da8aafc
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Index: jellyfin-ffmpeg/libavcodec/hevc_mp4toannexb_bsf.c
===================================================================
--- jellyfin-ffmpeg.orig/libavcodec/hevc_mp4toannexb_bsf.c
+++ jellyfin-ffmpeg/libavcodec/hevc_mp4toannexb_bsf.c
@@ -121,7 +121,7 @@ static int hevc_mp4toannexb_filter(AVBSF
HEVCBSFContext *s = ctx->priv_data;
AVPacket *in;
GetByteContext gb;
-
+ int has_sps = 0, has_pps = 0;
int got_irap = 0;
int i, ret = 0;

@@ -155,10 +155,13 @@ static int hevc_mp4toannexb_filter(AVBSF
}

nalu_type = (bytestream2_peek_byte(&gb) >> 1) & 0x3f;
+ has_sps = (has_sps || nalu_type == HEVC_NAL_SPS);
+ has_pps = (has_pps || nalu_type == HEVC_NAL_PPS);

/* prepend extradata to IRAP frames */
is_irap = nalu_type >= 16 && nalu_type <= 23;
- add_extradata = is_irap && !got_irap;
+ /* ignore the extradata if IRAP frame has sps and pps */
+ add_extradata = is_irap && !got_irap && !(has_sps && has_pps);
extra_size = add_extradata * ctx->par_out->extradata_size;
got_irap |= is_irap;

1 change: 1 addition & 0 deletions debian/patches/series
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@
0021-add-miscellaneous-fixes-for-NV-from-upstream.patch
0022-add-qsv-dec-support-for-yuv444-8-10bit.patch
0023-add-fixes-for-warning-on-overlay-filters.patch
0024-add-fixes-for-HEVC-10-bit-HDR-decoding-in-bsf.patch

0 comments on commit da8aafc

Please sign in to comment.