[FFmpeg-devel] [PATCH 10/11] avcodec/h264_parser: Don't keep full DSP Context
Andreas Rheinhardt
andreas.rheinhardt at gmail.com
Fri Aug 16 06:05:30 EEST 2019
We only need the function to search for start codes from it.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
---
libavcodec/h264_parser.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c
index 604cddada5..68eb5939db 100644
--- a/libavcodec/h264_parser.c
+++ b/libavcodec/h264_parser.c
@@ -50,10 +50,10 @@
typedef struct H264ParseContext {
ParseContext pc;
H264ParamSets ps;
- H264DSPContext h264dsp;
H264POCContext poc;
H264SEIContext sei;
H2645RBSP rbsp;
+ int (*startcode_find_candidate)(const uint8_t *buf, int size);
int is_avc;
int nal_length_size;
int got_first;
@@ -97,7 +97,7 @@ static int h264_find_frame_end(H264ParseContext *p, const uint8_t *buf,
}
if (state == 7) {
- i += p->h264dsp.startcode_find_candidate(buf + i, next_avc - i);
+ i += p->startcode_find_candidate(buf + i, next_avc - i);
if (i < next_avc)
state = 2;
} else if (state <= 2) {
@@ -705,10 +705,13 @@ static void h264_close(AVCodecParserContext *s)
static av_cold int init(AVCodecParserContext *s)
{
H264ParseContext *p = s->priv_data;
+ H264DSPContext h264dsp;
+
+ ff_h264dsp_init(&h264dsp, 8, 1);
+ p->startcode_find_candidate = h264dsp.startcode_find_candidate;
p->reference_dts = AV_NOPTS_VALUE;
p->last_frame_num = INT_MAX;
- ff_h264dsp_init(&p->h264dsp, 8, 1);
return 0;
}
--
2.21.0
More information about the ffmpeg-devel
mailing list