Commit a0ad6c85 authored by 周晓勇's avatar 周晓勇 Committed by Michael Niedermayer

avcodec: loongson optimized h264pred with mmi

Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 2c343895
...@@ -58,3 +58,4 @@ MSA-OBJS-$(CONFIG_MPEGVIDEOENC) += mips/mpegvideoencdsp_msa.o ...@@ -58,3 +58,4 @@ MSA-OBJS-$(CONFIG_MPEGVIDEOENC) += mips/mpegvideoencdsp_msa.o
MSA-OBJS-$(CONFIG_ME_CMP) += mips/me_cmp_msa.o MSA-OBJS-$(CONFIG_ME_CMP) += mips/me_cmp_msa.o
MMI-OBJS-$(CONFIG_H264DSP) += mips/h264dsp_mmi.o MMI-OBJS-$(CONFIG_H264DSP) += mips/h264dsp_mmi.o
MMI-OBJS-$(CONFIG_H264CHROMA) += mips/h264chroma_mmi.o MMI-OBJS-$(CONFIG_H264CHROMA) += mips/h264chroma_mmi.o
MMI-OBJS-$(CONFIG_H264PRED) += mips/h264pred_mmi.o
/* /*
* Copyright (c) 2015 Shivraj Patil (Shivraj.Patil@imgtec.com) * Copyright (c) 2015 Shivraj Patil (Shivraj.Patil@imgtec.com)
* Zhou Xiaoyong <zhouxiaoyong@loongson.cn>
* *
* This file is part of FFmpeg. * This file is part of FFmpeg.
* *
...@@ -20,6 +21,7 @@ ...@@ -20,6 +21,7 @@
#include "config.h" #include "config.h"
#include "h264dsp_mips.h" #include "h264dsp_mips.h"
#include "h264pred_mips.h"
#if HAVE_MSA #if HAVE_MSA
static av_cold void h264_pred_init_msa(H264PredContext *h, int codec_id, static av_cold void h264_pred_init_msa(H264PredContext *h, int codec_id,
...@@ -94,6 +96,54 @@ static av_cold void h264_pred_init_msa(H264PredContext *h, int codec_id, ...@@ -94,6 +96,54 @@ static av_cold void h264_pred_init_msa(H264PredContext *h, int codec_id,
} }
#endif // #if HAVE_MSA #endif // #if HAVE_MSA
#if HAVE_MMI
static av_cold void h264_pred_init_mmi(H264PredContext *h, int codec_id,
const int bit_depth, const int chroma_format_idc)
{
if (bit_depth == 8) {
if (chroma_format_idc == 1) {
h->pred8x8 [VERT_PRED8x8 ] = ff_pred8x8_vertical_8_mmi;
h->pred8x8 [HOR_PRED8x8 ] = ff_pred8x8_horizontal_8_mmi;
} else {
h->pred8x8 [VERT_PRED8x8 ] = ff_pred8x16_vertical_8_mmi;
h->pred8x8 [HOR_PRED8x8 ] = ff_pred8x16_horizontal_8_mmi;
}
h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_8_mmi;
h->pred16x16[VERT_PRED8x8 ] = ff_pred16x16_vertical_8_mmi;
h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_horizontal_8_mmi;
h->pred8x8l [TOP_DC_PRED ] = ff_pred8x8l_top_dc_8_mmi;
h->pred8x8l [DC_PRED ] = ff_pred8x8l_dc_8_mmi;
h->pred8x8l [HOR_PRED ] = ff_pred8x8l_horizontal_8_mmi;
switch (codec_id) {
case AV_CODEC_ID_SVQ3:
h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_svq3_8_mmi;
;
break;
case AV_CODEC_ID_RV40:
h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_rv40_8_mmi;
;
break;
case AV_CODEC_ID_VP7:
case AV_CODEC_ID_VP8:
;
break;
default:
h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_h264_8_mmi;
break;
}
if (codec_id == AV_CODEC_ID_SVQ3 || codec_id == AV_CODEC_ID_H264) {
if (chroma_format_idc == 1) {
h->pred8x8[TOP_DC_PRED8x8 ] = ff_pred8x8_top_dc_8_mmi;
h->pred8x8[DC_PRED8x8 ] = ff_pred8x8_dc_8_mmi;
}
}
}
}
#endif /* HAVE_MMI */
av_cold void ff_h264_pred_init_mips(H264PredContext *h, int codec_id, av_cold void ff_h264_pred_init_mips(H264PredContext *h, int codec_id,
int bit_depth, int bit_depth,
const int chroma_format_idc) const int chroma_format_idc)
...@@ -101,4 +151,7 @@ av_cold void ff_h264_pred_init_mips(H264PredContext *h, int codec_id, ...@@ -101,4 +151,7 @@ av_cold void ff_h264_pred_init_mips(H264PredContext *h, int codec_id,
#if HAVE_MSA #if HAVE_MSA
h264_pred_init_msa(h, codec_id, bit_depth, chroma_format_idc); h264_pred_init_msa(h, codec_id, bit_depth, chroma_format_idc);
#endif // #if HAVE_MSA #endif // #if HAVE_MSA
#if HAVE_MMI
h264_pred_init_mmi(h, codec_id, bit_depth, chroma_format_idc);
#endif /* HAVE_MMI */
} }
/*
* Copyright (c) 2015 Zhou Xiaoyong <zhouxiaoyong@loongson.cn>
*
* 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 H264_PRED_MIPS_H
#define H264_PRED_MIPS_H
#include "libavutil/attributes.h"
#include "libavutil/avassert.h"
#include "libavcodec/avcodec.h"
#include "libavcodec/h264pred.h"
#include "libavcodec/bit_depth_template.c"
void ff_pred16x16_vertical_8_mmi(uint8_t *src, ptrdiff_t stride);
void ff_pred16x16_horizontal_8_mmi(uint8_t *src, ptrdiff_t stride);
void ff_pred16x16_dc_8_mmi(uint8_t *src, ptrdiff_t stride);
void ff_pred8x8l_top_dc_8_mmi(uint8_t *src, int has_topleft, int has_topright,
ptrdiff_t stride);
void ff_pred8x8l_dc_8_mmi(uint8_t *src, int has_topleft, int has_topright,
ptrdiff_t stride);
void ff_pred8x8l_horizontal_8_mmi(uint8_t *src, int has_topleft,
int has_topright, ptrdiff_t stride);
void ff_pred8x8l_vertical_8_mmi(uint8_t *src, int has_topleft,
int has_topright, ptrdiff_t stride);
void ff_pred4x4_dc_8_mmi(uint8_t *src, const uint8_t *topright,
ptrdiff_t stride);
void ff_pred8x8_vertical_8_mmi(uint8_t *src, ptrdiff_t stride);
void ff_pred8x8_horizontal_8_mmi(uint8_t *src, ptrdiff_t stride);
void ff_pred16x16_plane_svq3_8_mmi(uint8_t *src, ptrdiff_t stride);
void ff_pred16x16_plane_rv40_8_mmi(uint8_t *src, ptrdiff_t stride);
void ff_pred16x16_plane_h264_8_mmi(uint8_t *src, ptrdiff_t stride);
void ff_pred8x8_top_dc_8_mmi(uint8_t *src, ptrdiff_t stride);
void ff_pred8x8_dc_8_mmi(uint8_t *src, ptrdiff_t stride);
void ff_pred8x16_vertical_8_mmi(uint8_t *src, ptrdiff_t stride);
void ff_pred8x16_horizontal_8_mmi(uint8_t *src, ptrdiff_t stride);
#endif /* H264_PRED_MIPS_H */
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment