[FFmpeg-devel] [FFmpeg-Devel] [GSoC] [PATCH 1/4] created x86 directory in libpostproc for standalone asm files

Tucker DiNapoli t.dinapoli42 at gmail.com
Sun Mar 22 20:48:12 CET 2015

From: Tucker DiNapoli <T.DiNapoli42 at gmail.com>

This patch set contains implementations of various filters from libpostproc,
translated from inline asm (in postprocess_template.c) into seperate yasm files.
In addition support for sse2 and avx2 has been added via the use of the simd
abstraction layer from x86inc.asm. There are 4 assembly files added, one is a 
file of utility macros, one defines the layout of various structs used in libpostproc
using the yasm struc directive, one implements several deinterlacing filters and 
the last implements a deblocking filter. I am used to writing x86 asm for the
gnu assembler so I'm still somewhat new at using yasm features, so any advice
on how to better use yasm, better format my assembly, or any advice on my code
in general would be appricated.

I would like to submit these patches as my qualification task for the google
summer of code. It may be hard to test the code as it can't be use with libpostproc 
as is, this is because a significant part of the summer project is to modify
the C code to support differing vector sizes. I think trying to change the
library to interface with this new code is too much to ask for a qualification task,
but if this code alone isn't enough I can work on something else if need be.

I also put one file into the directory, which just defines the layout of
the structs used in libpostproc using the struc and endstruc macros.

diff --git a/libpostproc/x86/PPContext.asm b/libpostproc/x86/PPContext.asm
new file mode 100644
index 0000000..022dddb
--- /dev/null
+++ b/libpostproc/x86/PPContext.asm
@@ -0,0 +1,70 @@
+;* Definition of the PPContext and PPMode structs in assembly
+;* Copyright (C) 2015 Tucker DiNapoli (T.Dinapoli at gmail.com)
+;* This file is part of FFmpeg.
+;* FFmpeg is free software; you can redistribute it and/or modify
+;* it under the terms of the GNU General Public License as published by
+;* the Free Software Foundation; either version 2 of the License, or
+;* (at your option) any later version.
+;* FFmpeg is distributed in the hope that it will be useful,
+;* but WITHOUT ANY WARRANTY; without even the implied warranty of
+;* GNU General Public License for more details.
+;* You should have received a copy of the GNU General Public License
+;* along with FFmpeg; if not, write to the Free Software
+;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+%if ARCH_X86_64
+%define pointer resq
+%define pointer resd
+struc PPMode
+    .lum_mode: resd 1
+    .chrom_mode: resd 1
+    .error: resd 1
+    .min_allowed_y: resd 1
+    .max_allowed_y: resd 1
+    .max_clipped_threshold: resd 1
+    .max_tmp_noise: resd 3
+    .base_dc_diff: resd 1
+    .flatness_threshold: resd 1
+    .forced_quant: resd 1
+struc PPContext
+    .av_class pointer 1
+    .temp_blocks pointer 1
+    .y_historgam pointer 1
+    alignb 8
+    .packed_yoffset resq 1
+    .packed_yscale resq 1; 8 byte aligned by default
+    .temp_blurred pointer 3
+    .temp_blurred_past pointer 3
+    .temp_dst pointer 1
+    .temp_src pointer 1
+    .deint_temp pointer 1
+    alignb 8
+    .pQPb resq 1
+    .pQPb2 resq 1
+;; These next fields & next alignment may need to be changed for 128/256 bit registers
+    alignb 8
+    .mmx_dc_offset resq 64
+    .mmx_dc_threshold resq 64
+    .std_QP_table pointer 1
+    .non_BQP_table pointer 1
+    .forced_QP_table pointer 1
+    .QP resd 1
+    .nonBQP resd 1
+    .frame_num resd 1
+    .cpu_caps resd 1
+    .qp_stride resd 1
+    .stride resd 1
+    .h_chroma_subsample resd 1
+    .v_chroma_subsample resd 1
+    .ppMode resd PPMode_size

More information about the ffmpeg-devel mailing list