[FFmpeg-devel] [GSOC][PATCH 2/4] FFV1 p frames
Michael Niedermayer
michael at niedermayer.cc
Thu Aug 18 04:47:02 EEST 2016
On Wed, Aug 17, 2016 at 02:07:24PM +0300, Станислав Долганов wrote:
> Hello,
>
> I'm sending the patch set with implementation of GSoC project -- FFV1 P
> frame support. The current FFV1 uses the same OBMC code as the Snow codec.
> Also new median_me_mp function has appeared.
>
> I'm attaching speed&compression report to every patch to proof effectivity
> of each implemented part.
>
> I'll appreciate feedback
>
> Best regards,
> Stanislav
> Makefile | 4
> ffv1.c | 35 ++++-
> ffv1.h | 15 ++
> ffv1dec.c | 356 +++++++++++++++++++++++++++++++++++++++++++++++++++
> ffv1enc.c | 370 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
> x86/me_cmp_init.c | 4
> 6 files changed, 768 insertions(+), 16 deletions(-)
> 02753371eb59a185eeca7189eb711c3cf0cb5dab 0002-FFV1-p-frames.patch
> From c3b0c6b53f7a558f06879938ffc22b3544a4f276 Mon Sep 17 00:00:00 2001
> From: Stanislav Dolganov <dolganov at qst.hk>
> Date: Tue, 16 Aug 2016 20:56:26 +0300
> Subject: [PATCH 2/4] FFV1 p frames
this still needs to be updated to git master HEAD
it also contains trailing whitespace
Applying: FFV1 p frames
.git/rebase-apply/patch:74: trailing whitespace.
.git/rebase-apply/patch:110: trailing whitespace.
.git/rebase-apply/patch:167: trailing whitespace.
.git/rebase-apply/patch:225: trailing whitespace.
.git/rebase-apply/patch:370: trailing whitespace.
warning: squelched 30 whitespace errors
warning: 35 lines add whitespace errors.
Using index info to reconstruct a base tree...
M libavcodec/Makefile
M libavcodec/ffv1.c
M libavcodec/ffv1.h
M libavcodec/ffv1dec.c
M libavcodec/ffv1enc.c
.git/rebase-apply/patch:74: trailing whitespace.
.git/rebase-apply/patch:110: trailing whitespace.
.git/rebase-apply/patch:167: trailing whitespace.
.git/rebase-apply/patch:225: trailing whitespace.
.git/rebase-apply/patch:370: trailing whitespace.
warning: squelched 30 whitespace errors
warning: 35 lines applied after fixing whitespace errors.
Falling back to patching base and 3-way merge...
Auto-merging libavcodec/ffv1enc.c
CONFLICT (content): Merge conflict in libavcodec/ffv1enc.c
Auto-merging libavcodec/ffv1dec.c
CONFLICT (content): Merge conflict in libavcodec/ffv1dec.c
Auto-merging libavcodec/ffv1.h
Auto-merging libavcodec/ffv1.c
Auto-merging libavcodec/Makefile
error: Failed to merge in the changes.
Patch failed at 0001 FFV1 p frames
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
[...]
> @@ -226,6 +248,11 @@ av_cold int ff_ffv1_close(AVCodecContext *avctx)
> av_freep(&fs->sample_buffer);
> }
>
> + if (s->p_image_line_buf)
> + av_freep(&s->p_image_line_buf);
> + if (s->c_image_line_buf)
> + av_freep(&s->c_image_line_buf);
> +
> av_freep(&avctx->stats_out);
> for (j = 0; j < s->quant_table_count; j++) {
> av_freep(&s->initial_states[j]);
unneeded checks, fring NULL is safe
> @@ -238,6 +265,8 @@ av_cold int ff_ffv1_close(AVCodecContext *avctx)
>
> for (i = 0; i < s->max_slice_count; i++)
> av_freep(&s->slice_context[i]);
> +
> + ff_obmc_close(&s->obmc);
>
> return 0;
> }
> diff --git a/libavcodec/ffv1.h b/libavcodec/ffv1.h
> index d9398e5..30943ee 100644
> --- a/libavcodec/ffv1.h
> +++ b/libavcodec/ffv1.h
> @@ -42,6 +42,11 @@
> #include "rangecoder.h"
> #include "thread.h"
>
> +#define FF_MPV_OFFSET(x) (offsetof(MpegEncContext, x) + offsetof(FFV1Context, obmc.m))
> +#include "obmemc.h"
> +
> +#define MID_STATE 128
> +
> #ifdef __INTEL_COMPILER
> #undef av_flatten
> #define av_flatten
> @@ -49,6 +54,7 @@
>
> #define MAX_PLANES 4
> #define CONTEXT_SIZE 32
> +#define FRAC_BITS 4
>
> #define MAX_QUANT_TABLES 8
> #define MAX_CONTEXT_INPUTS 5
> @@ -93,7 +99,7 @@ typedef struct FFV1Context {
> int flags;
> int picture_number;
> int key_frame;
> - ThreadFrame picture, last_picture;
> + ThreadFrame picture, last_picture, residual;
> struct FFV1Context *fsrc;
>
> AVFrame *cur;
> @@ -110,11 +116,14 @@ typedef struct FFV1Context {
> int colorspace;
> int16_t *sample_buffer;
>
> + uint16_t *p_image_line_buf, *c_image_line_buf;
> +
> int ec;
> int intra;
> int slice_damaged;
> int key_frame_ok;
> int context_model;
> + int p_frame;
>
> int bits_per_raw_sample;
> int packed_at_lsb;
> @@ -135,6 +144,9 @@ typedef struct FFV1Context {
> int slice_coding_mode;
> int slice_rct_by_coef;
> int slice_rct_ry_coef;
> +
> + OBMCContext obmc;
> + uint8_t block_state[128 + 32*128];
> } FFV1Context;
>
> int ff_ffv1_common_init(AVCodecContext *avctx);
> @@ -145,6 +157,7 @@ int ff_ffv1_allocate_initial_states(FFV1Context *f);
> void ff_ffv1_clear_slice_state(FFV1Context *f, FFV1Context *fs);
> int ff_ffv1_close(AVCodecContext *avctx);
>
> +
> static av_always_inline int fold(int diff, int bits)
> {
> if (bits == 8)
stray change
[...]
> @@ -921,12 +1119,15 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac
> ff_build_rac_states(c, 0.05 * (1LL << 32), 256 - 8);
>
> p->pict_type = AV_PICTURE_TYPE_I; //FIXME I vs. P
> + f->obmc.current_picture->pict_type = AV_PICTURE_TYPE_I;
> if (get_rac(c, &keystate)) {
> - p->key_frame = 1;
> + p->key_frame = 1;
another stray change
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I have often repented speaking, but never of holding my tongue.
-- Xenocrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160818/850f5f74/attachment.sig>
More information about the ffmpeg-devel
mailing list