Hi,
On Wed, Apr 13, 2011 at 11:42 AM, Luca Barbato <[email protected]> wrote:
> On 04/13/2011 05:35 PM, Ronald Bultje wrote:
>> Hi,
>>
>> Tested on a Mac Pro, 2 CPUs, 2 cores each, OSX 10.6.6:
>
> Nice, to we have a fate test for it as well?
>
>> diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c
>> index d71c94f..5c7137b 100644
>> --- a/libavcodec/pthread.c
>> +++ b/libavcodec/pthread.c
>> @@ -646,6 +646,8 @@ static void frame_thread_free(AVCodecContext *avctx, int
>> thread_count)
>> pthread_mutex_unlock(&p->mutex);
>>
>> pthread_join(p->thread, NULL);
>> + if (i)
>> + update_context_from_thread(p->avctx, fctx->threads[i-1].avctx,
>> 0);
>>
>> if (codec->close)
>> codec->close(p->avctx);
>
> uhm...
Otherwise we double-free frames on close().
>> diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c
>> index de4a51d..a10f5c2 100644
>> --- a/libavcodec/vp8.c
>> +++ b/libavcodec/vp8.c
>> @@ -27,6 +27,7 @@
>> #include "vp8.h"
>> #include "vp8data.h"
>> #include "rectangle.h"
>> +#include "thread.h"
>>
>> #if ARCH_ARM
>> # include "arm/vp8.h"
>> @@ -37,9 +38,9 @@ static void vp8_decode_flush(AVCodecContext *avctx)
>> VP8Context *s = avctx->priv_data;
>> int i;
>>
>> - for (i = 0; i < 4; i++)
>> + for (i = 0; i < 5; i++)
>> if (s->frames[i].data[0])
>> - avctx->release_buffer(avctx, &s->frames[i]);
>> + ff_thread_release_buffer(avctx, &s->frames[i]);
>> memset(s->framep, 0, sizeof(s->framep));
>
> 4 and 5 don't tell me much, what's the meaning of those numbers? (Macro
> define them please)
We have 3 reference frames ("golden", "altref" and "previous"), so in
the worst case they are all different frames and thus we need 4 frames
to have a free frame available at any time.
This patch uses the "last" frame (this is generally, but not always,
same as "previous") as a reference for segmentation maps. Thus it
introduces the concept of 4 reference frames. Since we never really
need to look at the data, I didn't want to grow pointers, and thus put
it in VP56_FRAME_CURRENT at the start of the function, then leave it
as prev_frame. But it does mean I have 4 reference frames in worst
case, plus one free, thus 5 frames in total, hence the 4->5.
Ronald
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel