[FFmpeg-devel] [RFC] cineform CFHD encoder, and decoder speedup
Paul B Mahol
onemda at gmail.com
Fri Jul 31 10:49:29 EEST 2020
On 7/30/20, James Almer <jamrial at gmail.com> wrote:
> On 7/30/2020 1:32 PM, Paul B Mahol wrote:
>> Hi,
>>
>> patches attached.
>>
>> Decoder speedup is approx %20 overall.
>
>> From 9692daafc0c4a69ce3cf7dca5b5aa90b5737e15f Mon Sep 17 00:00:00 2001
>> From: Paul B Mahol <onemda at gmail.com>
>> Date: Sat, 25 Jul 2020 18:18:18 +0200
>> Subject: [PATCH 1/2] avcodec: add CFHD encoder
>>
>> ---
>> libavcodec/Makefile | 1 +
>> libavcodec/allcodecs.c | 1 +
>> libavcodec/cfhd.c | 28 --
>> libavcodec/cfhd.h | 52 +++
>> libavcodec/cfhdenc.c | 750 +++++++++++++++++++++++++++++++++++++++++
>> 5 files changed, 804 insertions(+), 28 deletions(-)
>> create mode 100644 libavcodec/cfhdenc.c
>
> [...]
>
>> +static av_cold int cfhd_encode_init(AVCodecContext *avctx)
>> +{
>> + CFHDEncContext *s = avctx->priv_data;
>> + const int sign_mask = 256;
>> + const int twos_complement = -sign_mask;
>> + const int mag_mask = sign_mask - 1;
>> +
>> + s->planes = av_pix_fmt_count_planes(avctx->pix_fmt);
>> + if (avctx->compression_level == FF_COMPRESSION_DEFAULT)
>> + s->compression = 2;
>> + s->compression = av_clip(avctx->compression_level, 0, 9);
>> +
>> + for (int i = 0; i < s->planes; i++) {
>> + int w8, h8, w4, h4, w2, h2;
>> + int width = avctx->width;
>> + int height = avctx->height;
>> + ptrdiff_t stride = FFALIGN(width / 8, 8) * 8;
>> +
>> + s->plane[i].width = width;
>> + s->plane[i].height = height;
>> + s->plane[i].stride = stride;
>
> These three seem unused. For the first two you're always using the
> relevant s->plane[i].band[j][k] fields instead. But for stride, you're
> not even using the band one.
Removed.
>
> [...]
>
>> +
>> + bytestream2_put_be16(pby, GroupTrailer);
>> + bytestream2_put_be16(pby, 0);
>> +
>> + pkt->size = bytestream2_tell_p(pby);
>
> Use av_shrink_packet(), as it also zeroes the padding bytes.
Done.
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-devel
mailing list