Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Anton Khirnov <anton@khirnov.net>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 03/11] lavc/hevcdec: include first row in SliceHeader.offset/size
Date: Fri, 31 May 2024 19:47:41 +0200
Message-ID: <20240531174804.17572-3-anton@khirnov.net> (raw)
In-Reply-To: <20240531174804.17572-1-anton@khirnov.net>

Will be useful in the following commit.
---
 libavcodec/hevcdec.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index d3715f9de7..42fd33961b 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -975,8 +975,8 @@ static int hls_slice_header(HEVCContext *s)
             av_freep(&sh->offset);
             av_freep(&sh->size);
             sh->entry_point_offset = av_malloc_array(sh->num_entry_point_offsets, sizeof(unsigned));
-            sh->offset = av_malloc_array(sh->num_entry_point_offsets, sizeof(int));
-            sh->size = av_malloc_array(sh->num_entry_point_offsets, sizeof(int));
+            sh->offset             = av_malloc_array(sh->num_entry_point_offsets + 1, sizeof(int));
+            sh->size               = av_malloc_array(sh->num_entry_point_offsets + 1, sizeof(int));
             if (!sh->entry_point_offset || !sh->offset || !sh->size) {
                 sh->num_entry_point_offsets = 0;
                 av_log(s->avctx, AV_LOG_ERROR, "Failed to allocate memory\n");
@@ -2608,10 +2608,10 @@ static int hls_decode_entry_wpp(AVCodecContext *avctxt, void *hevc_lclist,
     int ret;
 
     if(ctb_row) {
-        ret = init_get_bits8(&lc->gb, s->data + s->sh.offset[ctb_row - 1], s->sh.size[ctb_row - 1]);
+        ret = init_get_bits8(&lc->gb, s->data + s->sh.offset[ctb_row], s->sh.size[ctb_row]);
         if (ret < 0)
             goto error;
-        ff_init_cabac_decoder(&lc->cc, s->data + s->sh.offset[(ctb_row)-1], s->sh.size[ctb_row - 1]);
+        ff_init_cabac_decoder(&lc->cc, s->data + s->sh.offset[ctb_row], s->sh.size[ctb_row]);
     }
 
     while(more_data && ctb_addr_ts < s->ps.sps->ctb_size) {
@@ -2738,8 +2738,8 @@ static int hls_slice_data_wpp(HEVCContext *s, const H2645NAL *nal)
                 cmpt++;
             }
         }
-        s->sh.size[i - 1] = s->sh.entry_point_offset[i] - cmpt;
-        s->sh.offset[i - 1] = offset;
+        s->sh.size[i]   = s->sh.entry_point_offset[i] - cmpt;
+        s->sh.offset[i] = offset;
 
     }
 
@@ -2748,8 +2748,11 @@ static int hls_slice_data_wpp(HEVCContext *s, const H2645NAL *nal)
         av_log(s->avctx, AV_LOG_ERROR, "entry_point_offset table is corrupted\n");
         return AVERROR_INVALIDDATA;
     }
-    s->sh.size[s->sh.num_entry_point_offsets - 1] = length - offset;
-    s->sh.offset[s->sh.num_entry_point_offsets - 1] = offset;
+    s->sh.size  [s->sh.num_entry_point_offsets] = length - offset;
+    s->sh.offset[s->sh.num_entry_point_offsets] = offset;
+
+    s->sh.offset[0] = s->sh.data_offset;
+    s->sh.size[0]   = s->sh.offset[1] - s->sh.offset[0];
 
     s->data = data;
 
-- 
2.43.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-request@ffmpeg.org with subject "unsubscribe".

  parent reply	other threads:[~2024-05-31 17:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-31 17:47 [FFmpeg-devel] [PATCH 01/11] lavc/hevcdec: move handling of byte alignment at the end of slice header Anton Khirnov
2024-05-31 17:47 ` [FFmpeg-devel] [PATCH 02/11] lavc/hevcdec: drop a useless condition Anton Khirnov
2024-05-31 17:47 ` Anton Khirnov [this message]
2024-05-31 17:47 ` [FFmpeg-devel] [PATCH 04/11] lavc/hevcdec: drop HEVCLocalContext.gb Anton Khirnov
2024-05-31 17:47 ` [FFmpeg-devel] [PATCH 05/11] lavc/hevcdec: drop HEVCContext.HEVClc Anton Khirnov
2024-05-31 17:47 ` [FFmpeg-devel] [PATCH 06/11] lavc/hevcdec: rename HEVCContext.ref to cur_frame Anton Khirnov
2024-05-31 17:47 ` [FFmpeg-devel] [PATCH 07/11] lavc/hevcdec: rename HEVCFrame.frame to just f Anton Khirnov
2024-05-31 17:47 ` [FFmpeg-devel] [PATCH 08/11] lavc/hevcdec: drop HEVCContext.frame Anton Khirnov
2024-05-31 17:47 ` [FFmpeg-devel] [PATCH 09/11] lavc/hevc*: move to hevc/ subdir Anton Khirnov
2024-06-02  0:39   ` James Almer
2024-06-02  6:50     ` Anton Khirnov
2024-05-31 17:47 ` [FFmpeg-devel] [PATCH 10/11] lavc/hevcdec: deduplicate calling hwaccel decode_params() Anton Khirnov
2024-05-31 17:47 ` [FFmpeg-devel] [PATCH 11/11] lavc/hevcdec: drop unused HEVCContext.width/height Anton Khirnov
2024-05-31 19:11   ` Vittorio Giovara

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240531174804.17572-3-anton@khirnov.net \
    --to=anton@khirnov.net \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git