git.videolan.org
/
ffmpeg.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
341d3ee
)
avcodec/ylc: add frame threading support
author
Paul B Mahol
<onemda@gmail.com>
Mon, 26 Dec 2016 19:27:01 +0000
(20:27 +0100)
committer
Paul B Mahol
<onemda@gmail.com>
Mon, 26 Dec 2016 19:27:01 +0000
(20:27 +0100)
Signed-off-by: Paul B Mahol <onemda@gmail.com>
libavcodec/ylc.c
patch
|
blob
|
history
diff --git
a/libavcodec/ylc.c
b/libavcodec/ylc.c
index
81a5774
..
3230c56
100644
(file)
--- a/
libavcodec/ylc.c
+++ b/
libavcodec/ylc.c
@@
-31,6
+31,7
@@
#include "get_bits.h"
#include "huffyuvdsp.h"
#include "internal.h"
#include "get_bits.h"
#include "huffyuvdsp.h"
#include "internal.h"
+#include "thread.h"
#include "unary.h"
typedef struct YLCContext {
#include "unary.h"
typedef struct YLCContext {
@@
-282,6
+283,7
@@
static int decode_frame(AVCodecContext *avctx,
int TL[4] = { 128, 128, 128, 128 };
int L[4] = { 128, 128, 128, 128 };
YLCContext *s = avctx->priv_data;
int TL[4] = { 128, 128, 128, 128 };
int L[4] = { 128, 128, 128, 128 };
YLCContext *s = avctx->priv_data;
+ ThreadFrame frame = { .f = data };
const uint8_t *buf = avpkt->data;
int ret, x, y, toffset, boffset;
AVFrame * const p = data;
const uint8_t *buf = avpkt->data;
int ret, x, y, toffset, boffset;
AVFrame * const p = data;
@@
-303,7
+305,7
@@
static int decode_frame(AVCodecContext *avctx,
if (toffset >= boffset || boffset >= avpkt->size)
return AVERROR_INVALIDDATA;
if (toffset >= boffset || boffset >= avpkt->size)
return AVERROR_INVALIDDATA;
- if ((ret = ff_
get_buffer(avctx, p
, 0)) < 0)
+ if ((ret = ff_
thread_get_buffer(avctx, &frame
, 0)) < 0)
return ret;
av_fast_malloc(&s->table_bits, &s->table_bits_size,
return ret;
av_fast_malloc(&s->table_bits, &s->table_bits_size,
@@
-447,6
+449,24
@@
static int decode_frame(AVCodecContext *avctx,
return avpkt->size;
}
return avpkt->size;
}
+#if HAVE_THREADS
+static int init_thread_copy(AVCodecContext *avctx)
+{
+ YLCContext *s = avctx->priv_data;
+
+ memset(&s->vlc[0], 0, sizeof(VLC));
+ memset(&s->vlc[1], 0, sizeof(VLC));
+ memset(&s->vlc[2], 0, sizeof(VLC));
+ memset(&s->vlc[3], 0, sizeof(VLC));
+ s->table_bits = NULL;
+ s->table_bits_size = 0;
+ s->bitstream_bits = NULL;
+ s->bitstream_bits_size = 0;
+
+ return 0;
+}
+#endif
+
static av_cold int decode_end(AVCodecContext *avctx)
{
YLCContext *s = avctx->priv_data;
static av_cold int decode_end(AVCodecContext *avctx)
{
YLCContext *s = avctx->priv_data;
@@
-470,7
+490,8
@@
AVCodec ff_ylc_decoder = {
.id = AV_CODEC_ID_YLC,
.priv_data_size = sizeof(YLCContext),
.init = decode_init,
.id = AV_CODEC_ID_YLC,
.priv_data_size = sizeof(YLCContext),
.init = decode_init,
+ .init_thread_copy = ONLY_IF_THREADS_ENABLED(init_thread_copy),
.close = decode_end,
.decode = decode_frame,
.close = decode_end,
.decode = decode_frame,
- .capabilities = AV_CODEC_CAP_DR1,
+ .capabilities = AV_CODEC_CAP_DR1
| AV_CODEC_CAP_FRAME_THREADS
,
};
};