2013-03-09 15:14:35 -08:00
|
|
|
/*
|
|
|
|
|
* Half-pel DSP functions.
|
|
|
|
|
* Copyright (c) 2000, 2001, 2002 Fabrice Bellard
|
|
|
|
|
* Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
|
|
|
|
|
*
|
|
|
|
|
* This file is part of FFmpeg.
|
|
|
|
|
*
|
|
|
|
|
* FFmpeg is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
|
* version 2.1 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
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Lesser 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
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @file
|
|
|
|
|
* Half-pel DSP functions.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef AVCODEC_HPELDSP_H
|
|
|
|
|
#define AVCODEC_HPELDSP_H
|
|
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
|
avcodec/hpeldsp: Fix documentation
This commit fixes two issues in the documentation:
a) The documentation for {put,avg}_pixels_tab only mentions
widths 16 and 8, although it explicitly mentions that there
are four horizontal blocksizes. This part of the patch
basically reverts e5771f4f37b67951485205e110f4da5e7e32ea74.
b) The restrictions on height don't match the reality. While
most users abide by it, some do not:
i) vp56.c copies a 16x12 block.
ii) indeo3 can copy an arbitrary multiple of four lines
for block widths 4, 8 and 16.
iii) SVQ3 can use block sizes luma block sizes 16x16, 8x16,
16x8, 8x8, 4x8, 8x4 and 4x4 and the corresponding
8x8, 4x8, 8x4, 4x4, 2x4, 4x2 and 2x2 chroma block sizes.
This implies that for widths 2 and 4 height can be two
and is guaranteed to be at least even. For all other widths,
height can be a multiple of four.
Furthermore, a comment for the SVQ3 blocksizes has been added.
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-09-21 22:51:18 +02:00
|
|
|
/**
|
|
|
|
|
* Average and put pixel
|
|
|
|
|
* Widths can be 16, 8, 4 or 2. For for widths 2 and 4, h is always a positive
|
|
|
|
|
* multiple of 2; otherwise, it is a positive multiple of 4.
|
|
|
|
|
*/
|
|
|
|
|
typedef void (*op_pixels_func)(uint8_t *block /* align width */,
|
2013-03-10 14:23:46 -07:00
|
|
|
const uint8_t *pixels /*align 1*/,
|
|
|
|
|
ptrdiff_t line_size, int h);
|
2013-03-09 15:14:35 -08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Half-pel DSP context.
|
|
|
|
|
*/
|
|
|
|
|
typedef struct HpelDSPContext {
|
|
|
|
|
/**
|
|
|
|
|
* Halfpel motion compensation with rounding (a+b+1)>>1.
|
|
|
|
|
* this is an array[4][4] of motion compensation functions for 4
|
avcodec/hpeldsp: Fix documentation
This commit fixes two issues in the documentation:
a) The documentation for {put,avg}_pixels_tab only mentions
widths 16 and 8, although it explicitly mentions that there
are four horizontal blocksizes. This part of the patch
basically reverts e5771f4f37b67951485205e110f4da5e7e32ea74.
b) The restrictions on height don't match the reality. While
most users abide by it, some do not:
i) vp56.c copies a 16x12 block.
ii) indeo3 can copy an arbitrary multiple of four lines
for block widths 4, 8 and 16.
iii) SVQ3 can use block sizes luma block sizes 16x16, 8x16,
16x8, 8x8, 4x8, 8x4 and 4x4 and the corresponding
8x8, 4x8, 8x4, 4x4, 2x4, 4x2 and 2x2 chroma block sizes.
This implies that for widths 2 and 4 height can be two
and is guaranteed to be at least even. For all other widths,
height can be a multiple of four.
Furthermore, a comment for the SVQ3 blocksizes has been added.
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-09-21 22:51:18 +02:00
|
|
|
* horizontal blocksizes (2,4,8,16) and the 4 halfpel positions<br>
|
|
|
|
|
* *pixels_tab[ 0->16xH 1->8xH 2->4xH 3->2xH ][ xhalfpel + 2*yhalfpel ]
|
2013-03-09 15:14:35 -08:00
|
|
|
* @param block destination where the result is stored
|
|
|
|
|
* @param pixels source
|
|
|
|
|
* @param line_size number of bytes in a horizontal line of block
|
|
|
|
|
* @param h height
|
|
|
|
|
*/
|
2013-03-10 14:23:46 -07:00
|
|
|
op_pixels_func put_pixels_tab[4][4];
|
2013-03-09 15:14:35 -08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Halfpel motion compensation with rounding (a+b+1)>>1.
|
|
|
|
|
* This is an array[4][4] of motion compensation functions for 4
|
avcodec/hpeldsp: Fix documentation
This commit fixes two issues in the documentation:
a) The documentation for {put,avg}_pixels_tab only mentions
widths 16 and 8, although it explicitly mentions that there
are four horizontal blocksizes. This part of the patch
basically reverts e5771f4f37b67951485205e110f4da5e7e32ea74.
b) The restrictions on height don't match the reality. While
most users abide by it, some do not:
i) vp56.c copies a 16x12 block.
ii) indeo3 can copy an arbitrary multiple of four lines
for block widths 4, 8 and 16.
iii) SVQ3 can use block sizes luma block sizes 16x16, 8x16,
16x8, 8x8, 4x8, 8x4 and 4x4 and the corresponding
8x8, 4x8, 8x4, 4x4, 2x4, 4x2 and 2x2 chroma block sizes.
This implies that for widths 2 and 4 height can be two
and is guaranteed to be at least even. For all other widths,
height can be a multiple of four.
Furthermore, a comment for the SVQ3 blocksizes has been added.
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-09-21 22:51:18 +02:00
|
|
|
* horizontal blocksizes (2,4,8,16) and the 4 halfpel positions<br>
|
|
|
|
|
* *pixels_tab[ 0->16xH 1->8xH 2->4xH 3->2xH ][ xhalfpel + 2*yhalfpel ]
|
2013-03-09 15:14:35 -08:00
|
|
|
* @param block destination into which the result is averaged (a+b+1)>>1
|
|
|
|
|
* @param pixels source
|
|
|
|
|
* @param line_size number of bytes in a horizontal line of block
|
|
|
|
|
* @param h height
|
|
|
|
|
*/
|
2013-03-10 14:23:46 -07:00
|
|
|
op_pixels_func avg_pixels_tab[4][4];
|
2013-03-09 15:14:35 -08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Halfpel motion compensation with no rounding (a+b)>>1.
|
2013-03-19 14:43:47 +01:00
|
|
|
* this is an array[4][4] of motion compensation functions for 2
|
2013-03-09 15:14:35 -08:00
|
|
|
* horizontal blocksizes (8,16) and the 4 halfpel positions<br>
|
|
|
|
|
* *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ]
|
|
|
|
|
* @param block destination where the result is stored
|
|
|
|
|
* @param pixels source
|
|
|
|
|
* @param line_size number of bytes in a horizontal line of block
|
|
|
|
|
* @param h height
|
2025-09-22 05:41:04 +02:00
|
|
|
* @note The size is kept at [3][4] to avoid out of bounds accesses
|
|
|
|
|
* in the motion estimation code.
|
2013-03-09 15:14:35 -08:00
|
|
|
*/
|
2025-09-22 05:41:04 +02:00
|
|
|
op_pixels_func put_no_rnd_pixels_tab[3][4];
|
2013-03-09 15:14:35 -08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Halfpel motion compensation with no rounding (a+b)>>1.
|
|
|
|
|
* this is an array[4] of motion compensation functions for 1
|
|
|
|
|
* horizontal blocksize (16) and the 4 halfpel positions<br>
|
avcodec/hpeldsp: Fix documentation
This commit fixes two issues in the documentation:
a) The documentation for {put,avg}_pixels_tab only mentions
widths 16 and 8, although it explicitly mentions that there
are four horizontal blocksizes. This part of the patch
basically reverts e5771f4f37b67951485205e110f4da5e7e32ea74.
b) The restrictions on height don't match the reality. While
most users abide by it, some do not:
i) vp56.c copies a 16x12 block.
ii) indeo3 can copy an arbitrary multiple of four lines
for block widths 4, 8 and 16.
iii) SVQ3 can use block sizes luma block sizes 16x16, 8x16,
16x8, 8x8, 4x8, 8x4 and 4x4 and the corresponding
8x8, 4x8, 8x4, 4x4, 2x4, 4x2 and 2x2 chroma block sizes.
This implies that for widths 2 and 4 height can be two
and is guaranteed to be at least even. For all other widths,
height can be a multiple of four.
Furthermore, a comment for the SVQ3 blocksizes has been added.
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-09-21 22:51:18 +02:00
|
|
|
* *pixels_tab[ xhalfpel + 2*yhalfpel ]
|
2013-03-09 15:14:35 -08:00
|
|
|
* @param block destination into which the result is averaged (a+b)>>1
|
|
|
|
|
* @param pixels source
|
|
|
|
|
* @param line_size number of bytes in a horizontal line of block
|
|
|
|
|
* @param h height
|
|
|
|
|
*/
|
2013-03-10 14:23:46 -07:00
|
|
|
op_pixels_func avg_no_rnd_pixels_tab[4];
|
2013-03-09 15:14:35 -08:00
|
|
|
} HpelDSPContext;
|
|
|
|
|
|
2013-03-09 15:14:35 -08:00
|
|
|
void ff_hpeldsp_init(HpelDSPContext *c, int flags);
|
2013-03-09 15:14:35 -08:00
|
|
|
|
2013-12-20 20:03:58 +01:00
|
|
|
void ff_hpeldsp_init_aarch64(HpelDSPContext *c, int flags);
|
2013-03-10 16:16:45 -07:00
|
|
|
void ff_hpeldsp_init_arm(HpelDSPContext *c, int flags);
|
2013-03-10 15:50:53 -07:00
|
|
|
void ff_hpeldsp_init_ppc(HpelDSPContext *c, int flags);
|
2013-03-10 15:37:59 -07:00
|
|
|
void ff_hpeldsp_init_x86(HpelDSPContext *c, int flags);
|
2015-06-14 23:26:24 +05:30
|
|
|
void ff_hpeldsp_init_mips(HpelDSPContext *c, int flags);
|
2021-12-29 18:18:20 +08:00
|
|
|
void ff_hpeldsp_init_loongarch(HpelDSPContext *c, int flags);
|
2013-03-09 15:14:35 -08:00
|
|
|
|
|
|
|
|
#endif /* AVCODEC_HPELDSP_H */
|