mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
Merge commit '0338c396987c82b41d322630ea9712fe5f9561d6'
* commit '0338c396987c82b41d322630ea9712fe5f9561d6': dsputil: Split off H.263 bits into their own H263DSPContext Conflicts: configure libavcodec/mpegvideo.h libavcodec/mpegvideo_enc.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
a30f7918b5
9
configure
vendored
9
configure
vendored
@ -1576,6 +1576,7 @@ CONFIG_EXTRA="
|
|||||||
gcrypt
|
gcrypt
|
||||||
golomb
|
golomb
|
||||||
gplv3
|
gplv3
|
||||||
|
h263dsp
|
||||||
h264chroma
|
h264chroma
|
||||||
h264dsp
|
h264dsp
|
||||||
h264pred
|
h264pred
|
||||||
@ -1811,8 +1812,8 @@ g2m_decoder_select="dsputil zlib"
|
|||||||
g729_decoder_select="dsputil"
|
g729_decoder_select="dsputil"
|
||||||
h261_decoder_select="error_resilience mpegvideo"
|
h261_decoder_select="error_resilience mpegvideo"
|
||||||
h261_encoder_select="aandcttables mpegvideoenc"
|
h261_encoder_select="aandcttables mpegvideoenc"
|
||||||
h263_decoder_select="error_resilience h263_parser mpegvideo"
|
h263_decoder_select="error_resilience h263_parser h263dsp mpegvideo"
|
||||||
h263_encoder_select="aandcttables mpegvideoenc"
|
h263_encoder_select="aandcttables h263dsp mpegvideoenc"
|
||||||
h263i_decoder_select="h263_decoder"
|
h263i_decoder_select="h263_decoder"
|
||||||
h263p_encoder_select="h263_encoder"
|
h263p_encoder_select="h263_encoder"
|
||||||
h264_decoder_select="golomb h264chroma h264dsp h264pred h264qpel videodsp"
|
h264_decoder_select="golomb h264chroma h264dsp h264pred h264qpel videodsp"
|
||||||
@ -1877,9 +1878,9 @@ qdm2_decoder_select="mdct rdft mpegaudiodsp"
|
|||||||
ra_144_encoder_select="audio_frame_queue lpc"
|
ra_144_encoder_select="audio_frame_queue lpc"
|
||||||
ralf_decoder_select="golomb"
|
ralf_decoder_select="golomb"
|
||||||
rtjpeg_decoder_select="dsputil"
|
rtjpeg_decoder_select="dsputil"
|
||||||
rv10_decoder_select="error_resilience h263_decoder"
|
rv10_decoder_select="error_resilience h263_decoder h263dsp"
|
||||||
rv10_encoder_select="h263_encoder"
|
rv10_encoder_select="h263_encoder"
|
||||||
rv20_decoder_select="error_resilience h263_decoder"
|
rv20_decoder_select="error_resilience h263_decoder h263dsp"
|
||||||
rv20_encoder_select="h263_encoder"
|
rv20_encoder_select="h263_encoder"
|
||||||
rv30_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpegvideo videodsp"
|
rv30_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpegvideo videodsp"
|
||||||
rv40_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpegvideo videodsp"
|
rv40_decoder_select="error_resilience golomb h264chroma h264pred h264qpel mpegvideo videodsp"
|
||||||
|
@ -50,6 +50,7 @@ OBJS-$(CONFIG_FFT) += avfft.o fft_fixed.o fft_float.o \
|
|||||||
fft_fixed_32.o fft_init_table.o \
|
fft_fixed_32.o fft_init_table.o \
|
||||||
$(FFT-OBJS-yes)
|
$(FFT-OBJS-yes)
|
||||||
OBJS-$(CONFIG_GOLOMB) += golomb.o
|
OBJS-$(CONFIG_GOLOMB) += golomb.o
|
||||||
|
OBJS-$(CONFIG_H263DSP) += h263dsp.o
|
||||||
OBJS-$(CONFIG_H264CHROMA) += h264chroma.o
|
OBJS-$(CONFIG_H264CHROMA) += h264chroma.o
|
||||||
OBJS-$(CONFIG_H264DSP) += h264dsp.o h264idct.o
|
OBJS-$(CONFIG_H264DSP) += h264dsp.o h264idct.o
|
||||||
OBJS-$(CONFIG_H264PRED) += h264pred.o
|
OBJS-$(CONFIG_H264PRED) += h264pred.o
|
||||||
|
@ -1516,80 +1516,6 @@ static void put_mspel8_mc22_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride)
|
|||||||
wmv2_mspel8_v_lowpass(dst, halfH+8, stride, 8, 8);
|
wmv2_mspel8_v_lowpass(dst, halfH+8, stride, 8, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void h263_v_loop_filter_c(uint8_t *src, int stride, int qscale){
|
|
||||||
if(CONFIG_H263_DECODER || CONFIG_H263_ENCODER) {
|
|
||||||
int x;
|
|
||||||
const int strength= ff_h263_loop_filter_strength[qscale];
|
|
||||||
|
|
||||||
for(x=0; x<8; x++){
|
|
||||||
int d1, d2, ad1;
|
|
||||||
int p0= src[x-2*stride];
|
|
||||||
int p1= src[x-1*stride];
|
|
||||||
int p2= src[x+0*stride];
|
|
||||||
int p3= src[x+1*stride];
|
|
||||||
int d = (p0 - p3 + 4*(p2 - p1)) / 8;
|
|
||||||
|
|
||||||
if (d<-2*strength) d1= 0;
|
|
||||||
else if(d<- strength) d1=-2*strength - d;
|
|
||||||
else if(d< strength) d1= d;
|
|
||||||
else if(d< 2*strength) d1= 2*strength - d;
|
|
||||||
else d1= 0;
|
|
||||||
|
|
||||||
p1 += d1;
|
|
||||||
p2 -= d1;
|
|
||||||
if(p1&256) p1= ~(p1>>31);
|
|
||||||
if(p2&256) p2= ~(p2>>31);
|
|
||||||
|
|
||||||
src[x-1*stride] = p1;
|
|
||||||
src[x+0*stride] = p2;
|
|
||||||
|
|
||||||
ad1= FFABS(d1)>>1;
|
|
||||||
|
|
||||||
d2= av_clip((p0-p3)/4, -ad1, ad1);
|
|
||||||
|
|
||||||
src[x-2*stride] = p0 - d2;
|
|
||||||
src[x+ stride] = p3 + d2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void h263_h_loop_filter_c(uint8_t *src, int stride, int qscale){
|
|
||||||
if(CONFIG_H263_DECODER || CONFIG_H263_ENCODER) {
|
|
||||||
int y;
|
|
||||||
const int strength= ff_h263_loop_filter_strength[qscale];
|
|
||||||
|
|
||||||
for(y=0; y<8; y++){
|
|
||||||
int d1, d2, ad1;
|
|
||||||
int p0= src[y*stride-2];
|
|
||||||
int p1= src[y*stride-1];
|
|
||||||
int p2= src[y*stride+0];
|
|
||||||
int p3= src[y*stride+1];
|
|
||||||
int d = (p0 - p3 + 4*(p2 - p1)) / 8;
|
|
||||||
|
|
||||||
if (d<-2*strength) d1= 0;
|
|
||||||
else if(d<- strength) d1=-2*strength - d;
|
|
||||||
else if(d< strength) d1= d;
|
|
||||||
else if(d< 2*strength) d1= 2*strength - d;
|
|
||||||
else d1= 0;
|
|
||||||
|
|
||||||
p1 += d1;
|
|
||||||
p2 -= d1;
|
|
||||||
if(p1&256) p1= ~(p1>>31);
|
|
||||||
if(p2&256) p2= ~(p2>>31);
|
|
||||||
|
|
||||||
src[y*stride-1] = p1;
|
|
||||||
src[y*stride+0] = p2;
|
|
||||||
|
|
||||||
ad1= FFABS(d1)>>1;
|
|
||||||
|
|
||||||
d2= av_clip((p0-p3)/4, -ad1, ad1);
|
|
||||||
|
|
||||||
src[y*stride-2] = p0 - d2;
|
|
||||||
src[y*stride+1] = p3 + d2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline int pix_abs16_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
|
static inline int pix_abs16_c(void *v, uint8_t *pix1, uint8_t *pix2, int line_size, int h)
|
||||||
{
|
{
|
||||||
int s, i;
|
int s, i;
|
||||||
@ -2872,11 +2798,6 @@ av_cold void ff_dsputil_init(DSPContext* c, AVCodecContext *avctx)
|
|||||||
c->bswap_buf= bswap_buf;
|
c->bswap_buf= bswap_buf;
|
||||||
c->bswap16_buf = bswap16_buf;
|
c->bswap16_buf = bswap16_buf;
|
||||||
|
|
||||||
if (CONFIG_H263_DECODER || CONFIG_H263_ENCODER) {
|
|
||||||
c->h263_h_loop_filter= h263_h_loop_filter_c;
|
|
||||||
c->h263_v_loop_filter= h263_v_loop_filter_c;
|
|
||||||
}
|
|
||||||
|
|
||||||
c->try_8x8basis= try_8x8basis_c;
|
c->try_8x8basis= try_8x8basis_c;
|
||||||
c->add_8x8basis= add_8x8basis_c;
|
c->add_8x8basis= add_8x8basis_c;
|
||||||
|
|
||||||
|
@ -205,9 +205,6 @@ typedef struct DSPContext {
|
|||||||
void (*bswap_buf)(uint32_t *dst, const uint32_t *src, int w);
|
void (*bswap_buf)(uint32_t *dst, const uint32_t *src, int w);
|
||||||
void (*bswap16_buf)(uint16_t *dst, const uint16_t *src, int len);
|
void (*bswap16_buf)(uint16_t *dst, const uint16_t *src, int len);
|
||||||
|
|
||||||
void (*h263_v_loop_filter)(uint8_t *src, int stride, int qscale);
|
|
||||||
void (*h263_h_loop_filter)(uint8_t *src, int stride, int qscale);
|
|
||||||
|
|
||||||
/* assume len is a multiple of 8, and arrays are 16-byte aligned */
|
/* assume len is a multiple of 8, and arrays are 16-byte aligned */
|
||||||
void (*vector_clipf)(float *dst /* align 16 */, const float *src /* align 16 */, float min, float max, int len /* align 16 */);
|
void (*vector_clipf)(float *dst /* align 16 */, const float *src /* align 16 */, float min, float max, int len /* align 16 */);
|
||||||
|
|
||||||
|
@ -152,8 +152,8 @@ void ff_h263_loop_filter(MpegEncContext * s){
|
|||||||
*/
|
*/
|
||||||
if (!IS_SKIP(s->current_picture.mb_type[xy])) {
|
if (!IS_SKIP(s->current_picture.mb_type[xy])) {
|
||||||
qp_c= s->qscale;
|
qp_c= s->qscale;
|
||||||
s->dsp.h263_v_loop_filter(dest_y+8*linesize , linesize, qp_c);
|
s->h263dsp.h263_v_loop_filter(dest_y + 8 * linesize, linesize, qp_c);
|
||||||
s->dsp.h263_v_loop_filter(dest_y+8*linesize+8, linesize, qp_c);
|
s->h263dsp.h263_v_loop_filter(dest_y + 8 * linesize + 8, linesize, qp_c);
|
||||||
}else
|
}else
|
||||||
qp_c= 0;
|
qp_c= 0;
|
||||||
|
|
||||||
@ -172,15 +172,15 @@ void ff_h263_loop_filter(MpegEncContext * s){
|
|||||||
|
|
||||||
if(qp_tc){
|
if(qp_tc){
|
||||||
const int chroma_qp= s->chroma_qscale_table[qp_tc];
|
const int chroma_qp= s->chroma_qscale_table[qp_tc];
|
||||||
s->dsp.h263_v_loop_filter(dest_y , linesize, qp_tc);
|
s->h263dsp.h263_v_loop_filter(dest_y, linesize, qp_tc);
|
||||||
s->dsp.h263_v_loop_filter(dest_y+8, linesize, qp_tc);
|
s->h263dsp.h263_v_loop_filter(dest_y + 8, linesize, qp_tc);
|
||||||
|
|
||||||
s->dsp.h263_v_loop_filter(dest_cb , uvlinesize, chroma_qp);
|
s->h263dsp.h263_v_loop_filter(dest_cb, uvlinesize, chroma_qp);
|
||||||
s->dsp.h263_v_loop_filter(dest_cr , uvlinesize, chroma_qp);
|
s->h263dsp.h263_v_loop_filter(dest_cr, uvlinesize, chroma_qp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(qp_tt)
|
if(qp_tt)
|
||||||
s->dsp.h263_h_loop_filter(dest_y-8*linesize+8 , linesize, qp_tt);
|
s->h263dsp.h263_h_loop_filter(dest_y - 8 * linesize + 8, linesize, qp_tt);
|
||||||
|
|
||||||
if(s->mb_x){
|
if(s->mb_x){
|
||||||
if (qp_tt || IS_SKIP(s->current_picture.mb_type[xy - 1 - s->mb_stride]))
|
if (qp_tt || IS_SKIP(s->current_picture.mb_type[xy - 1 - s->mb_stride]))
|
||||||
@ -190,17 +190,17 @@ void ff_h263_loop_filter(MpegEncContext * s){
|
|||||||
|
|
||||||
if(qp_dt){
|
if(qp_dt){
|
||||||
const int chroma_qp= s->chroma_qscale_table[qp_dt];
|
const int chroma_qp= s->chroma_qscale_table[qp_dt];
|
||||||
s->dsp.h263_h_loop_filter(dest_y -8*linesize , linesize, qp_dt);
|
s->h263dsp.h263_h_loop_filter(dest_y - 8 * linesize, linesize, qp_dt);
|
||||||
s->dsp.h263_h_loop_filter(dest_cb-8*uvlinesize, uvlinesize, chroma_qp);
|
s->h263dsp.h263_h_loop_filter(dest_cb - 8 * uvlinesize, uvlinesize, chroma_qp);
|
||||||
s->dsp.h263_h_loop_filter(dest_cr-8*uvlinesize, uvlinesize, chroma_qp);
|
s->h263dsp.h263_h_loop_filter(dest_cr - 8 * uvlinesize, uvlinesize, chroma_qp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(qp_c){
|
if(qp_c){
|
||||||
s->dsp.h263_h_loop_filter(dest_y +8, linesize, qp_c);
|
s->h263dsp.h263_h_loop_filter(dest_y + 8, linesize, qp_c);
|
||||||
if(s->mb_y + 1 == s->mb_height)
|
if(s->mb_y + 1 == s->mb_height)
|
||||||
s->dsp.h263_h_loop_filter(dest_y+8*linesize+8, linesize, qp_c);
|
s->h263dsp.h263_h_loop_filter(dest_y + 8 * linesize + 8, linesize, qp_c);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(s->mb_x){
|
if(s->mb_x){
|
||||||
@ -211,12 +211,12 @@ void ff_h263_loop_filter(MpegEncContext * s){
|
|||||||
qp_lc = s->current_picture.qscale_table[xy - 1];
|
qp_lc = s->current_picture.qscale_table[xy - 1];
|
||||||
|
|
||||||
if(qp_lc){
|
if(qp_lc){
|
||||||
s->dsp.h263_h_loop_filter(dest_y, linesize, qp_lc);
|
s->h263dsp.h263_h_loop_filter(dest_y, linesize, qp_lc);
|
||||||
if(s->mb_y + 1 == s->mb_height){
|
if(s->mb_y + 1 == s->mb_height){
|
||||||
const int chroma_qp= s->chroma_qscale_table[qp_lc];
|
const int chroma_qp= s->chroma_qscale_table[qp_lc];
|
||||||
s->dsp.h263_h_loop_filter(dest_y +8* linesize, linesize, qp_lc);
|
s->h263dsp.h263_h_loop_filter(dest_y + 8 * linesize, linesize, qp_lc);
|
||||||
s->dsp.h263_h_loop_filter(dest_cb , uvlinesize, chroma_qp);
|
s->h263dsp.h263_h_loop_filter(dest_cb, uvlinesize, chroma_qp);
|
||||||
s->dsp.h263_h_loop_filter(dest_cr , uvlinesize, chroma_qp);
|
s->h263dsp.h263_h_loop_filter(dest_cr, uvlinesize, chroma_qp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -272,11 +272,6 @@ const uint8_t ff_mba_length[7]={
|
|||||||
6, 7, 9, 11, 13, 14, 14
|
6, 7, 9, 11, 13, 14, 14
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint8_t ff_h263_loop_filter_strength[32]={
|
|
||||||
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
|
||||||
0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9,10,10,10,11,11,11,12,12,12
|
|
||||||
};
|
|
||||||
|
|
||||||
const AVRational ff_h263_pixel_aspect[16]={
|
const AVRational ff_h263_pixel_aspect[16]={
|
||||||
{0, 1},
|
{0, 1},
|
||||||
{1, 1},
|
{1, 1},
|
||||||
|
@ -124,6 +124,7 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx)
|
|||||||
if ((ret = ff_MPV_common_init(s)) < 0)
|
if ((ret = ff_MPV_common_init(s)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
ff_h263dsp_init(&s->h263dsp);
|
||||||
ff_h263_decode_init_vlc();
|
ff_h263_decode_init_vlc();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
108
libavcodec/h263dsp.c
Normal file
108
libavcodec/h263dsp.c
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "libavutil/attributes.h"
|
||||||
|
#include "libavutil/common.h"
|
||||||
|
#include "config.h"
|
||||||
|
#include "h263dsp.h"
|
||||||
|
|
||||||
|
const uint8_t ff_h263_loop_filter_strength[32]={
|
||||||
|
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
||||||
|
0, 1, 1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9,10,10,10,11,11,11,12,12,12
|
||||||
|
};
|
||||||
|
|
||||||
|
static void h263_h_loop_filter_c(uint8_t *src, int stride, int qscale){
|
||||||
|
int y;
|
||||||
|
const int strength= ff_h263_loop_filter_strength[qscale];
|
||||||
|
|
||||||
|
for(y=0; y<8; y++){
|
||||||
|
int d1, d2, ad1;
|
||||||
|
int p0= src[y*stride-2];
|
||||||
|
int p1= src[y*stride-1];
|
||||||
|
int p2= src[y*stride+0];
|
||||||
|
int p3= src[y*stride+1];
|
||||||
|
int d = (p0 - p3 + 4*(p2 - p1)) / 8;
|
||||||
|
|
||||||
|
if (d<-2*strength) d1= 0;
|
||||||
|
else if(d<- strength) d1=-2*strength - d;
|
||||||
|
else if(d< strength) d1= d;
|
||||||
|
else if(d< 2*strength) d1= 2*strength - d;
|
||||||
|
else d1= 0;
|
||||||
|
|
||||||
|
p1 += d1;
|
||||||
|
p2 -= d1;
|
||||||
|
if(p1&256) p1= ~(p1>>31);
|
||||||
|
if(p2&256) p2= ~(p2>>31);
|
||||||
|
|
||||||
|
src[y*stride-1] = p1;
|
||||||
|
src[y*stride+0] = p2;
|
||||||
|
|
||||||
|
ad1= FFABS(d1)>>1;
|
||||||
|
|
||||||
|
d2= av_clip((p0-p3)/4, -ad1, ad1);
|
||||||
|
|
||||||
|
src[y*stride-2] = p0 - d2;
|
||||||
|
src[y*stride+1] = p3 + d2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void h263_v_loop_filter_c(uint8_t *src, int stride, int qscale){
|
||||||
|
int x;
|
||||||
|
const int strength= ff_h263_loop_filter_strength[qscale];
|
||||||
|
|
||||||
|
for(x=0; x<8; x++){
|
||||||
|
int d1, d2, ad1;
|
||||||
|
int p0= src[x-2*stride];
|
||||||
|
int p1= src[x-1*stride];
|
||||||
|
int p2= src[x+0*stride];
|
||||||
|
int p3= src[x+1*stride];
|
||||||
|
int d = (p0 - p3 + 4*(p2 - p1)) / 8;
|
||||||
|
|
||||||
|
if (d<-2*strength) d1= 0;
|
||||||
|
else if(d<- strength) d1=-2*strength - d;
|
||||||
|
else if(d< strength) d1= d;
|
||||||
|
else if(d< 2*strength) d1= 2*strength - d;
|
||||||
|
else d1= 0;
|
||||||
|
|
||||||
|
p1 += d1;
|
||||||
|
p2 -= d1;
|
||||||
|
if(p1&256) p1= ~(p1>>31);
|
||||||
|
if(p2&256) p2= ~(p2>>31);
|
||||||
|
|
||||||
|
src[x-1*stride] = p1;
|
||||||
|
src[x+0*stride] = p2;
|
||||||
|
|
||||||
|
ad1= FFABS(d1)>>1;
|
||||||
|
|
||||||
|
d2= av_clip((p0-p3)/4, -ad1, ad1);
|
||||||
|
|
||||||
|
src[x-2*stride] = p0 - d2;
|
||||||
|
src[x+ stride] = p3 + d2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
av_cold void ff_h263dsp_init(H263DSPContext *ctx)
|
||||||
|
{
|
||||||
|
ctx->h263_h_loop_filter = h263_h_loop_filter_c;
|
||||||
|
ctx->h263_v_loop_filter = h263_v_loop_filter_c;
|
||||||
|
|
||||||
|
if (ARCH_X86)
|
||||||
|
ff_h263dsp_init_x86(ctx);
|
||||||
|
}
|
34
libavcodec/h263dsp.h
Normal file
34
libavcodec/h263dsp.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef AVCODEC_H263DSP_H
|
||||||
|
#define AVCODEC_H263DSP_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
extern const uint8_t ff_h263_loop_filter_strength[32];
|
||||||
|
|
||||||
|
typedef struct H263DSPContext {
|
||||||
|
void (*h263_h_loop_filter)(uint8_t *src, int stride, int qscale);
|
||||||
|
void (*h263_v_loop_filter)(uint8_t *src, int stride, int qscale);
|
||||||
|
} H263DSPContext;
|
||||||
|
|
||||||
|
void ff_h263dsp_init(H263DSPContext *ctx);
|
||||||
|
void ff_h263dsp_init_x86(H263DSPContext *ctx);
|
||||||
|
|
||||||
|
#endif /* AVCODEC_H263DSP_H */
|
@ -33,6 +33,7 @@
|
|||||||
#include "error_resilience.h"
|
#include "error_resilience.h"
|
||||||
#include "get_bits.h"
|
#include "get_bits.h"
|
||||||
#include "h264chroma.h"
|
#include "h264chroma.h"
|
||||||
|
#include "h263dsp.h"
|
||||||
#include "hpeldsp.h"
|
#include "hpeldsp.h"
|
||||||
#include "put_bits.h"
|
#include "put_bits.h"
|
||||||
#include "ratecontrol.h"
|
#include "ratecontrol.h"
|
||||||
@ -396,6 +397,7 @@ typedef struct MpegEncContext {
|
|||||||
H264ChromaContext h264chroma;
|
H264ChromaContext h264chroma;
|
||||||
HpelDSPContext hdsp;
|
HpelDSPContext hdsp;
|
||||||
VideoDSPContext vdsp;
|
VideoDSPContext vdsp;
|
||||||
|
H263DSPContext h263dsp;
|
||||||
int f_code; ///< forward MV resolution
|
int f_code; ///< forward MV resolution
|
||||||
int b_code; ///< backward MV resolution for B Frames (mpeg4)
|
int b_code; ///< backward MV resolution for B Frames (mpeg4)
|
||||||
int16_t (*p_mv_table_base)[2];
|
int16_t (*p_mv_table_base)[2];
|
||||||
@ -924,7 +926,6 @@ void ff_mpeg1_encode_slice_header(MpegEncContext *s);
|
|||||||
|
|
||||||
extern const uint8_t ff_aic_dc_scale_table[32];
|
extern const uint8_t ff_aic_dc_scale_table[32];
|
||||||
extern const uint8_t ff_h263_chroma_qscale_table[32];
|
extern const uint8_t ff_h263_chroma_qscale_table[32];
|
||||||
extern const uint8_t ff_h263_loop_filter_strength[32];
|
|
||||||
|
|
||||||
/* rv10.c */
|
/* rv10.c */
|
||||||
void ff_rv10_encode_picture_header(MpegEncContext *s, int picture_number);
|
void ff_rv10_encode_picture_header(MpegEncContext *s, int picture_number);
|
||||||
|
@ -221,6 +221,7 @@ av_cold int ff_dct_encode_init(MpegEncContext *s) {
|
|||||||
if (ARCH_X86)
|
if (ARCH_X86)
|
||||||
ff_dct_encode_init_x86(s);
|
ff_dct_encode_init_x86(s);
|
||||||
|
|
||||||
|
ff_h263dsp_init(&s->h263dsp);
|
||||||
if (!s->dct_quantize)
|
if (!s->dct_quantize)
|
||||||
s->dct_quantize = ff_dct_quantize_c;
|
s->dct_quantize = ff_dct_quantize_c;
|
||||||
if (!s->denoise_dct)
|
if (!s->denoise_dct)
|
||||||
|
@ -500,6 +500,7 @@ static av_cold int rv10_decode_init(AVCodecContext *avctx)
|
|||||||
if ((ret = ff_MPV_common_init(s)) < 0)
|
if ((ret = ff_MPV_common_init(s)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
ff_h263dsp_init(&s->h263dsp);
|
||||||
ff_h263_decode_init_vlc();
|
ff_h263_decode_init_vlc();
|
||||||
|
|
||||||
/* init rv vlc */
|
/* init rv vlc */
|
||||||
|
@ -12,6 +12,7 @@ OBJS-$(CONFIG_ENCODERS) += x86/dsputilenc_mmx.o \
|
|||||||
x86/fdct.o \
|
x86/fdct.o \
|
||||||
x86/motion_est.o
|
x86/motion_est.o
|
||||||
OBJS-$(CONFIG_FFT) += x86/fft_init.o
|
OBJS-$(CONFIG_FFT) += x86/fft_init.o
|
||||||
|
OBJS-$(CONFIG_H263DSP) += x86/h263dsp_init.o
|
||||||
OBJS-$(CONFIG_H264CHROMA) += x86/h264chroma_init.o
|
OBJS-$(CONFIG_H264CHROMA) += x86/h264chroma_init.o
|
||||||
OBJS-$(CONFIG_H264DSP) += x86/h264dsp_init.o
|
OBJS-$(CONFIG_H264DSP) += x86/h264dsp_init.o
|
||||||
OBJS-$(CONFIG_H264PRED) += x86/h264_intrapred_init.o
|
OBJS-$(CONFIG_H264PRED) += x86/h264_intrapred_init.o
|
||||||
@ -68,8 +69,7 @@ YASM-OBJS-$(CONFIG_DSPUTIL) += x86/dsputil.o \
|
|||||||
x86/qpel.o
|
x86/qpel.o
|
||||||
YASM-OBJS-$(CONFIG_ENCODERS) += x86/dsputilenc.o
|
YASM-OBJS-$(CONFIG_ENCODERS) += x86/dsputilenc.o
|
||||||
YASM-OBJS-$(CONFIG_FFT) += x86/fft.o
|
YASM-OBJS-$(CONFIG_FFT) += x86/fft.o
|
||||||
YASM-OBJS-$(CONFIG_H263_DECODER) += x86/h263_loopfilter.o
|
YASM-OBJS-$(CONFIG_H263DSP) += x86/h263_loopfilter.o
|
||||||
YASM-OBJS-$(CONFIG_H263_ENCODER) += x86/h263_loopfilter.o
|
|
||||||
YASM-OBJS-$(CONFIG_H264CHROMA) += x86/h264_chromamc.o \
|
YASM-OBJS-$(CONFIG_H264CHROMA) += x86/h264_chromamc.o \
|
||||||
x86/h264_chromamc_10bit.o
|
x86/h264_chromamc_10bit.o
|
||||||
YASM-OBJS-$(CONFIG_H264DSP) += x86/h264_deblock.o \
|
YASM-OBJS-$(CONFIG_H264DSP) += x86/h264_deblock.o \
|
||||||
|
@ -71,9 +71,6 @@ void ff_put_no_rnd_mpeg4_qpel8_v_lowpass_mmxext(uint8_t *dst, uint8_t *src,
|
|||||||
#define ff_put_no_rnd_pixels16_mmxext ff_put_pixels16_mmxext
|
#define ff_put_no_rnd_pixels16_mmxext ff_put_pixels16_mmxext
|
||||||
#define ff_put_no_rnd_pixels8_mmxext ff_put_pixels8_mmxext
|
#define ff_put_no_rnd_pixels8_mmxext ff_put_pixels8_mmxext
|
||||||
|
|
||||||
void ff_h263_v_loop_filter_mmx(uint8_t *src, int stride, int qscale);
|
|
||||||
void ff_h263_h_loop_filter_mmx(uint8_t *src, int stride, int qscale);
|
|
||||||
|
|
||||||
int32_t ff_scalarproduct_int16_mmxext(const int16_t *v1, const int16_t *v2,
|
int32_t ff_scalarproduct_int16_mmxext(const int16_t *v1, const int16_t *v2,
|
||||||
int order);
|
int order);
|
||||||
int32_t ff_scalarproduct_int16_sse2(const int16_t *v1, const int16_t *v2,
|
int32_t ff_scalarproduct_int16_sse2(const int16_t *v1, const int16_t *v2,
|
||||||
@ -556,11 +553,6 @@ static av_cold void dsputil_init_mmx(DSPContext *c, AVCodecContext *avctx,
|
|||||||
#endif /* HAVE_MMX_INLINE */
|
#endif /* HAVE_MMX_INLINE */
|
||||||
|
|
||||||
#if HAVE_MMX_EXTERNAL
|
#if HAVE_MMX_EXTERNAL
|
||||||
if (CONFIG_H263_DECODER || CONFIG_H263_ENCODER) {
|
|
||||||
c->h263_v_loop_filter = ff_h263_v_loop_filter_mmx;
|
|
||||||
c->h263_h_loop_filter = ff_h263_h_loop_filter_mmx;
|
|
||||||
}
|
|
||||||
|
|
||||||
c->vector_clip_int32 = ff_vector_clip_int32_mmx;
|
c->vector_clip_int32 = ff_vector_clip_int32_mmx;
|
||||||
#endif /* HAVE_MMX_EXTERNAL */
|
#endif /* HAVE_MMX_EXTERNAL */
|
||||||
}
|
}
|
||||||
|
39
libavcodec/x86/h263dsp_init.c
Normal file
39
libavcodec/x86/h263dsp_init.c
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2013 Diego Biurrun <diego@biurrun.de>
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "libavutil/attributes.h"
|
||||||
|
#include "libavutil/cpu.h"
|
||||||
|
#include "libavutil/x86/cpu.h"
|
||||||
|
#include "libavcodec/h263dsp.h"
|
||||||
|
|
||||||
|
void ff_h263_h_loop_filter_mmx(uint8_t *src, int stride, int qscale);
|
||||||
|
void ff_h263_v_loop_filter_mmx(uint8_t *src, int stride, int qscale);
|
||||||
|
|
||||||
|
av_cold void ff_h263dsp_init_x86(H263DSPContext *c)
|
||||||
|
{
|
||||||
|
int cpu_flags = av_get_cpu_flags();
|
||||||
|
|
||||||
|
if (EXTERNAL_MMX(cpu_flags)) {
|
||||||
|
c->h263_h_loop_filter = ff_h263_h_loop_filter_mmx;
|
||||||
|
c->h263_v_loop_filter = ff_h263_v_loop_filter_mmx;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user