Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* Re: [FFmpeg-devel] [PATCH] libavcodec/pthread_framec: remove duplicate pointers
       [not found] <20211215021702.84725-1-young_chelsea@163.com>
@ 2021-12-20  3:03 ` Yy
  2021-12-24  7:14   ` Yy
  2021-12-30 11:33 ` Anton Khirnov
  1 sibling, 1 reply; 3+ messages in thread
From: Yy @ 2021-12-20  3:03 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Ping for this patch.
-Yu Yang

> 2021年12月15日 上午10:17,Yu Yang <young_chelsea@163.com> 写道:
> 
> From: Yu Yang <yuyang14@kuaishou.com>
> 
> '*src' and '*avctx' point to the same memory. It is enough to keep one of them.
> 
> Signed-off-by: Yu Yang <yuyang14@kuaishou.com>
> ---
> libavcodec/pthread_frame.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
> index 73b1b7d7d9..98f88f7732 100644
> --- a/libavcodec/pthread_frame.c
> +++ b/libavcodec/pthread_frame.c
> @@ -765,14 +765,14 @@ void ff_frame_thread_free(AVCodecContext *avctx, int thread_count)
> 
> static av_cold int init_thread(PerThreadContext *p, int *threads_to_free,
>                                FrameThreadContext *fctx, AVCodecContext *avctx,
> -                               AVCodecContext *src, const AVCodec *codec, int first)
> +                                const AVCodec *codec, int first)
> {
>     AVCodecContext *copy;
>     int err;
> 
>     atomic_init(&p->state, STATE_INPUT_READY);
> 
> -    copy = av_memdup(src, sizeof(*src));
> +    copy = av_memdup(avctx, sizeof(*avctx));
>     if (!copy)
>         return AVERROR(ENOMEM);
>     copy->priv_data = NULL;
> @@ -784,7 +784,7 @@ static av_cold int init_thread(PerThreadContext *p, int *threads_to_free,
>     p->parent = fctx;
>     p->avctx  = copy;
> 
> -    copy->internal = av_memdup(src->internal, sizeof(*src->internal));
> +    copy->internal = av_memdup(avctx->internal, sizeof(*avctx->internal));
>     if (!copy->internal)
>         return AVERROR(ENOMEM);
>     copy->internal->thread_ctx = p;
> @@ -798,7 +798,7 @@ static av_cold int init_thread(PerThreadContext *p, int *threads_to_free,
> 
>         if (codec->priv_class) {
>             *(const AVClass **)copy->priv_data = codec->priv_class;
> -            err = av_opt_copy(copy->priv_data, src->priv_data);
> +            err = av_opt_copy(copy->priv_data, avctx->priv_data);
>             if (err < 0)
>                 return err;
>         }
> @@ -843,7 +843,6 @@ int ff_frame_thread_init(AVCodecContext *avctx)
> {
>     int thread_count = avctx->thread_count;
>     const AVCodec *codec = avctx->codec;
> -    AVCodecContext *src = avctx;
>     FrameThreadContext *fctx;
>     int err, i = 0;
> 
> @@ -876,7 +875,7 @@ int ff_frame_thread_init(AVCodecContext *avctx)
>     fctx->delaying = 1;
> 
>     if (codec->type == AVMEDIA_TYPE_VIDEO)
> -        avctx->delay = src->thread_count - 1;
> +        avctx->delay = avctx->thread_count - 1;
> 
>     fctx->threads = av_calloc(thread_count, sizeof(*fctx->threads));
>     if (!fctx->threads) {
> @@ -888,7 +887,7 @@ int ff_frame_thread_init(AVCodecContext *avctx)
>         PerThreadContext *p  = &fctx->threads[i];
>         int first = !i;
> 
> -        err = init_thread(p, &i, fctx, avctx, src, codec, first);
> +        err = init_thread(p, &i, fctx, avctx, codec, first);
>         if (err < 0)
>             goto error;
>     }
> -- 
> 2.33.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-request@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-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [FFmpeg-devel] [PATCH] libavcodec/pthread_framec: remove duplicate pointers
  2021-12-20  3:03 ` [FFmpeg-devel] [PATCH] libavcodec/pthread_framec: remove duplicate pointers Yy
@ 2021-12-24  7:14   ` Yy
  0 siblings, 0 replies; 3+ messages in thread
From: Yy @ 2021-12-24  7:14 UTC (permalink / raw)
  To: FFmpeg development discussions and patches

Ping for this patch. 
May be my understanding of this part is not correct enough,
Please tell me, thx
-Yu Yang

> 2021年12月20日 上午11:03,Yy <young_chelsea@163.com> 写道:
> 
> Ping for this patch.
> -Yu Yang
> 
>> 2021年12月15日 上午10:17,Yu Yang <young_chelsea@163.com> 写道:
>> 
>> From: Yu Yang <yuyang14@kuaishou.com>
>> 
>> '*src' and '*avctx' point to the same memory. It is enough to keep one of them.
>> 
>> Signed-off-by: Yu Yang <yuyang14@kuaishou.com>
>> ---
>> libavcodec/pthread_frame.c | 13 ++++++-------
>> 1 file changed, 6 insertions(+), 7 deletions(-)
>> 
>> diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
>> index 73b1b7d7d9..98f88f7732 100644
>> --- a/libavcodec/pthread_frame.c
>> +++ b/libavcodec/pthread_frame.c
>> @@ -765,14 +765,14 @@ void ff_frame_thread_free(AVCodecContext *avctx, int thread_count)
>> 
>> static av_cold int init_thread(PerThreadContext *p, int *threads_to_free,
>>                               FrameThreadContext *fctx, AVCodecContext *avctx,
>> -                               AVCodecContext *src, const AVCodec *codec, int first)
>> +                                const AVCodec *codec, int first)
>> {
>>    AVCodecContext *copy;
>>    int err;
>> 
>>    atomic_init(&p->state, STATE_INPUT_READY);
>> 
>> -    copy = av_memdup(src, sizeof(*src));
>> +    copy = av_memdup(avctx, sizeof(*avctx));
>>    if (!copy)
>>        return AVERROR(ENOMEM);
>>    copy->priv_data = NULL;
>> @@ -784,7 +784,7 @@ static av_cold int init_thread(PerThreadContext *p, int *threads_to_free,
>>    p->parent = fctx;
>>    p->avctx  = copy;
>> 
>> -    copy->internal = av_memdup(src->internal, sizeof(*src->internal));
>> +    copy->internal = av_memdup(avctx->internal, sizeof(*avctx->internal));
>>    if (!copy->internal)
>>        return AVERROR(ENOMEM);
>>    copy->internal->thread_ctx = p;
>> @@ -798,7 +798,7 @@ static av_cold int init_thread(PerThreadContext *p, int *threads_to_free,
>> 
>>        if (codec->priv_class) {
>>            *(const AVClass **)copy->priv_data = codec->priv_class;
>> -            err = av_opt_copy(copy->priv_data, src->priv_data);
>> +            err = av_opt_copy(copy->priv_data, avctx->priv_data);
>>            if (err < 0)
>>                return err;
>>        }
>> @@ -843,7 +843,6 @@ int ff_frame_thread_init(AVCodecContext *avctx)
>> {
>>    int thread_count = avctx->thread_count;
>>    const AVCodec *codec = avctx->codec;
>> -    AVCodecContext *src = avctx;
>>    FrameThreadContext *fctx;
>>    int err, i = 0;
>> 
>> @@ -876,7 +875,7 @@ int ff_frame_thread_init(AVCodecContext *avctx)
>>    fctx->delaying = 1;
>> 
>>    if (codec->type == AVMEDIA_TYPE_VIDEO)
>> -        avctx->delay = src->thread_count - 1;
>> +        avctx->delay = avctx->thread_count - 1;
>> 
>>    fctx->threads = av_calloc(thread_count, sizeof(*fctx->threads));
>>    if (!fctx->threads) {
>> @@ -888,7 +887,7 @@ int ff_frame_thread_init(AVCodecContext *avctx)
>>        PerThreadContext *p  = &fctx->threads[i];
>>        int first = !i;
>> 
>> -        err = init_thread(p, &i, fctx, avctx, src, codec, first);
>> +        err = init_thread(p, &i, fctx, avctx, codec, first);
>>        if (err < 0)
>>            goto error;
>>    }
>> -- 
>> 2.33.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-request@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-request@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-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [FFmpeg-devel] [PATCH] libavcodec/pthread_framec: remove duplicate pointers
       [not found] <20211215021702.84725-1-young_chelsea@163.com>
  2021-12-20  3:03 ` [FFmpeg-devel] [PATCH] libavcodec/pthread_framec: remove duplicate pointers Yy
@ 2021-12-30 11:33 ` Anton Khirnov
  1 sibling, 0 replies; 3+ messages in thread
From: Anton Khirnov @ 2021-12-30 11:33 UTC (permalink / raw)
  To: FFmpeg development discussions and patches; +Cc: Yu Yang

Quoting Yu Yang (2021-12-15 03:17:02)
> From: Yu Yang <yuyang14@kuaishou.com>
> 
> '*src' and '*avctx' point to the same memory. It is enough to keep one of them.
> 
> Signed-off-by: Yu Yang <yuyang14@kuaishou.com>
> ---
>  libavcodec/pthread_frame.c | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)

Looks good, will push

Thanks,
-- 
Anton Khirnov
_______________________________________________
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".

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-12-30 11:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20211215021702.84725-1-young_chelsea@163.com>
2021-12-20  3:03 ` [FFmpeg-devel] [PATCH] libavcodec/pthread_framec: remove duplicate pointers Yy
2021-12-24  7:14   ` Yy
2021-12-30 11:33 ` Anton Khirnov

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