Commit 5a284d07 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '22526c1f'

* commit '22526c1f':
  Canopus HQ/HQA decoder

Conflicts:
	Changelog
	libavcodec/version.h
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents fcca7671 22526c1f
......@@ -17,6 +17,7 @@ version <next>:
- WebM Live Chunk Muxer
- nvenc level and tier options
- chorus filter
- Canopus HQ/HQA decoder
version 2.6:
......
......@@ -254,6 +254,8 @@ library:
@item Delphine Software International CIN @tab @tab X
@tab Multimedia format used by Delphine Software games.
@item Digital Speech Standard (DSS) @tab @tab X
@item Canopus HQ @tab @tab X
@item Canopus HQA @tab @tab X
@item Canopus HQX @tab @tab X
@item CD+G @tab @tab X
@tab Video format used by CD+G karaoke disks
......
......@@ -279,6 +279,8 @@ OBJS-$(CONFIG_HEVC_DECODER) += hevc.o hevc_mvs.o hevc_ps.o hevc_sei.o
hevc_cabac.o hevc_refs.o hevcpred.o \
hevcdsp.o hevc_filter.o
OBJS-$(CONFIG_HNM4_VIDEO_DECODER) += hnm4video.o
OBJS-$(CONFIG_HQ_HQA_DECODER) += hq_hqa.o hq_hqadata.o hq_hqadsp.o \
canopus.o
OBJS-$(CONFIG_HQX_DECODER) += hqx.o hqxvlc.o hqxdsp.o canopus.o
OBJS-$(CONFIG_HUFFYUV_DECODER) += huffyuv.o huffyuvdec.o
OBJS-$(CONFIG_HUFFYUV_ENCODER) += huffyuv.o huffyuvenc.o
......
......@@ -178,6 +178,7 @@ void avcodec_register_all(void)
REGISTER_DECODER(H264_VDPAU, h264_vdpau);
REGISTER_DECODER(HEVC, hevc);
REGISTER_DECODER(HNM4_VIDEO, hnm4_video);
REGISTER_DECODER(HQ_HQA, hq_hqa);
REGISTER_DECODER(HQX, hqx);
REGISTER_ENCDEC (HUFFYUV, huffyuv);
REGISTER_DECODER(IDCIN, idcin);
......
......@@ -292,6 +292,7 @@ enum AVCodecID {
AV_CODEC_ID_MVC2_DEPRECATED,
AV_CODEC_ID_HQX,
AV_CODEC_ID_TDSC,
AV_CODEC_ID_HQ_HQA,
AV_CODEC_ID_BRENDER_PIX= MKBETAG('B','P','I','X'),
AV_CODEC_ID_Y41P = MKBETAG('Y','4','1','P'),
......
......@@ -1245,6 +1245,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
.long_name = NULL_IF_CONFIG_SMALL("Canopus HQX"),
.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
},
{
.id = AV_CODEC_ID_HQ_HQA,
.type = AVMEDIA_TYPE_VIDEO,
.name = "hq_hqa",
.long_name = NULL_IF_CONFIG_SMALL("Canopus HQ/HQA"),
.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
},
/* image codecs */
{
......
This diff is collapsed.
/*
* Canopus HQ/HQA decoder
*
* 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_HQ_HQA_H
#define AVCODEC_HQ_HQA_H
#include <stdint.h>
#include "avcodec.h"
#include "get_bits.h"
#include "bytestream.h"
#include "hq_hqadsp.h"
#define NUM_HQ_AC_ENTRIES 746
#define NUM_HQ_PROFILES 22
#define NUM_HQ_QUANTS 16
typedef struct HQContext {
AVCodecContext *avctx;
HQDSPContext hqhqadsp;
GetByteContext gbc;
VLC hq_ac_vlc;
VLC hqa_cbp_vlc;
DECLARE_ALIGNED(16, int16_t, block)[12][64];
} HQContext;
typedef struct HQProfile {
const uint8_t *perm_tab;
int width, height;
int num_slices;
int tab_w, tab_h;
} HQProfile;
extern const int32_t * const ff_hq_quants[16][2][4];
extern const HQProfile ff_hq_profile[NUM_HQ_PROFILES];
extern const uint8_t ff_hq_ac_skips[NUM_HQ_AC_ENTRIES];
extern const int16_t ff_hq_ac_syms [NUM_HQ_AC_ENTRIES];
int ff_hq_init_vlcs(HQContext *c);
#endif /* AVCODEC_HQ_HQA_H */
This diff is collapsed.
/*
* Canopus HQ/HQA decoder
*
* 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 "hq_hqadsp.h"
#define FIX_1_082 17734
#define FIX_1_847 30274
#define FIX_1_414 23170
#define FIX_2_613 21407 // divided by two to fit the range
#define IDCTMUL(a, b) ((a) * (b) >> 16)
static inline void idct_row(int16_t *blk)
{
int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, tmp9, tmpA;
int tmpB, tmpC, tmpD, tmpE, tmpF, tmp10, tmp11, tmp12, tmp13, tmp14;
tmp0 = blk[5] - blk[3];
tmp1 = blk[5] + blk[3];
tmp2 = blk[1] - blk[7];
tmp3 = blk[1] + blk[7];
tmp4 = tmp3 - tmp1;
tmp5 = IDCTMUL(tmp0 + tmp2, FIX_1_847);
tmp6 = IDCTMUL(tmp2, FIX_1_082) - tmp5;
tmp7 = tmp5 - IDCTMUL(tmp0, FIX_2_613) * 2;
tmp8 = tmp3 + tmp1;
tmp9 = tmp7 * 4 - tmp8;
tmpA = IDCTMUL(tmp4, FIX_1_414) * 4 - tmp9;
tmpB = tmp6 * 4 + tmpA;
tmpC = blk[2] + blk[6];
tmpD = blk[2] - blk[6];
tmpE = blk[0] - blk[4];
tmpF = blk[0] + blk[4];
tmp10 = IDCTMUL(tmpD, FIX_1_414) * 4 - tmpC;
tmp11 = tmpE - tmp10;
tmp12 = tmpF - tmpC;
tmp13 = tmpE + tmp10;
tmp14 = tmpF + tmpC;
blk[0] = tmp14 + tmp8;
blk[1] = tmp13 + tmp9;
blk[2] = tmp11 + tmpA;
blk[3] = tmp12 - tmpB;
blk[4] = tmp12 + tmpB;
blk[5] = tmp11 - tmpA;
blk[6] = tmp13 - tmp9;
blk[7] = tmp14 - tmp8;
}
static inline void idct_col(int16_t *blk)
{
int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, tmp9, tmpA;
int tmpB, tmpC, tmpD, tmpE, tmpF, tmp10, tmp11, tmp12, tmp13, tmp14;
tmp0 = blk[5 * 8] - blk[3 * 8];
tmp1 = blk[5 * 8] + blk[3 * 8];
tmp2 = blk[1 * 8] * 2 - (blk[7 * 8] >> 2);
tmp3 = blk[1 * 8] * 2 + (blk[7 * 8] >> 2);
tmp4 = tmp3 - tmp1;
tmp5 = IDCTMUL(tmp0 + tmp2, FIX_1_847);
tmp6 = IDCTMUL(tmp2, FIX_1_082) - tmp5;
tmp7 = tmp5 - IDCTMUL(tmp0, FIX_2_613) * 2;
tmp8 = (tmp3 + tmp1) >> 1;
tmp9 = tmp7 * 2 - tmp8;
tmpA = IDCTMUL(tmp4, FIX_1_414) * 2 - tmp9;
tmpB = tmp6 * 2 + tmpA;
tmpC = blk[2 * 8] + (blk[6 * 8] >> 1) >> 1;
tmpD = blk[2 * 8] - (blk[6 * 8] >> 1);
tmpE = (blk[0 * 8] >> 1) - (blk[4 * 8] >> 1) + 0x2020;
tmpF = (blk[0 * 8] >> 1) + (blk[4 * 8] >> 1) + 0x2020;
tmp10 = IDCTMUL(tmpD, FIX_1_414) * 2 - tmpC;
tmp11 = tmpE - tmp10;
tmp12 = tmpF - tmpC;
tmp13 = tmpE + tmp10;
tmp14 = tmpF + tmpC;
blk[0 * 8] = (tmp14 + tmp8) >> 6;
blk[1 * 8] = (tmp13 + tmp9) >> 6;
blk[2 * 8] = (tmp11 + tmpA) >> 6;
blk[3 * 8] = (tmp12 - tmpB) >> 6;
blk[4 * 8] = (tmp12 + tmpB) >> 6;
blk[5 * 8] = (tmp11 - tmpA) >> 6;
blk[6 * 8] = (tmp13 - tmp9) >> 6;
blk[7 * 8] = (tmp14 - tmp8) >> 6;
}
static void hq_idct_put(uint8_t *dst, int stride, int16_t *block)
{
int i, j;
for (i = 0; i < 8; i++)
idct_row(block + i * 8);
for (i = 0; i < 8; i++)
idct_col(block + i);
for (i = 0; i < 8; i++) {
for (j = 0; j < 8; j++)
dst[j] = av_clip_uint8(block[j + i * 8]);
dst += stride;
}
}
av_cold void ff_hqdsp_init(HQDSPContext *c)
{
c->idct_put = hq_idct_put;
}
/*
* Canopus HQ/HQA decoder
*
* 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
* HQ/HQA variant of AAN IDCT
* It differs from the standard AAN IDCT in precision and in the second stage.
*/
#ifndef AVCODEC_HQ_HQADSP_H
#define AVCODEC_HQ_HQADSP_H
#include <stdint.h>
typedef struct HQDSPContext {
void (*idct_put)(uint8_t *dst, int stride, int16_t *block);
} HQDSPContext;
void ff_hqdsp_init(HQDSPContext *c);
#endif /* AVCODEC_HQ_HQADSP_H */
......@@ -29,7 +29,7 @@
#include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 56
#define LIBAVCODEC_VERSION_MINOR 34
#define LIBAVCODEC_VERSION_MINOR 35
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
......
......@@ -366,6 +366,7 @@ const AVCodecTag ff_codec_bmp_tags[] = {
{ AV_CODEC_ID_FIC, MKTAG('F', 'I', 'C', 'V') },
{ AV_CODEC_ID_HQX, MKTAG('C', 'H', 'Q', 'X') },
{ AV_CODEC_ID_TDSC, MKTAG('T', 'D', 'S', 'C') },
{ AV_CODEC_ID_HQ_HQA, MKTAG('C', 'U', 'V', 'C') },
{ AV_CODEC_ID_NONE, 0 }
};
......
......@@ -60,6 +60,18 @@ FATE_VIDEO-$(call DEMDEC, BINK, BINK) += $(FATE_BINK_VIDEO)
FATE_VIDEO-$(call DEMDEC, BMV, BMV_VIDEO) += fate-bmv-video
fate-bmv-video: CMD = framecrc -i $(TARGET_SAMPLES)/bmv/SURFING-partial.BMV -pix_fmt rgb24 -an
FATE_CANOPUS_HQ_HQA += fate-canopus-hq_hqa-hq
fate-canopus-hq_hqa-hq: CMD = framecrc -i $(TARGET_SAMPLES)/canopus/hq.avi
FATE_CANOPUS_HQ_HQA += fate-canopus-hq_hqa-hqa
fate-canopus-hq_hqa-hqa: CMD = framecrc -i $(TARGET_SAMPLES)/canopus/hqa.avi
FATE_CANOPUS_HQ_HQA += fate-canopus-hq_hqa-inter
fate-canopus-hq_hqa-inter: CMD = framecrc -i $(TARGET_SAMPLES)/canopus/hq25i.avi
FATE_SAMPLES_AVCONV-$(call DEMDEC, AVI, HQ_HQA) += $(FATE_CANOPUS_HQ_HQA)
fate-canopus-hq_hqa: $(FATE_CANOPUS_HQ_HQA)
FATE_CANOPUS_HQX += fate-canopus-hqx422
fate-canopus-hqx422: CMD = framecrc -i $(TARGET_SAMPLES)/canopus/hqx422.avi -pix_fmt yuv422p16be -an
......
#tb 0: 1/25
0, 0, 0, 1, 829440, 0x8b6b2f6d
0, 1, 1, 1, 829440, 0x70382bf0
0, 2, 2, 1, 829440, 0xbfdf1f8d
0, 3, 3, 1, 829440, 0x27587282
0, 4, 4, 1, 829440, 0x54655f5d
0, 5, 5, 1, 829440, 0xe31bff92
0, 6, 6, 1, 829440, 0x10ec4a8b
0, 7, 7, 1, 829440, 0x0a5773e7
#tb 0: 1/25
0, 0, 0, 1, 6220800, 0x2b2b17cc
#tb 0: 1/25
0, 0, 0, 1, 4147200, 0x418ecfe5
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