mirror of
https://github.com/jellyfin/jellyfin-ffmpeg.git
synced 2024-10-07 03:13:23 +00:00
Imported Upstream version 2.4.4
This commit is contained in:
parent
b6633e6fe6
commit
9ff920c006
37
Changelog
37
Changelog
@ -3,6 +3,43 @@ releases are sorted from youngest to oldest.
|
||||
|
||||
version <next>:
|
||||
|
||||
version 2.4.4:
|
||||
- avformat: replace some odd 30-60 rates by higher less odd ones in get_std_framerate()
|
||||
- swscale: fix yuv2yuvX_8 assembly on x86
|
||||
- avcodec/hevc_ps: Check num_long_term_ref_pics_sps
|
||||
- avcodec/mjpegdec: Fix integer overflow in shift
|
||||
- avcodec/hevc_ps: Check return code from pps_range_extensions()
|
||||
- avcodec/rawdec: Check the return code of avpicture_get_size()
|
||||
- avcodec/pngdec: Check IHDR/IDAT order
|
||||
- avcodec/flacdec: Call ff_flacdsp_init() unconditionally
|
||||
- avcodec/utils: Check that the data is complete in avpriv_bprint_to_extradata()
|
||||
- avcodec/mjpegdec: Fix context fields becoming inconsistent
|
||||
- avcodec/mjpegdec: Check for pixfmtid 0x42111100 || 0x24111100 with more than 8 bits
|
||||
- swscale/x86/rgb2rgb_template: handle the first 2 lines with C in rgb24toyv12_*()
|
||||
- doc/APIchanges: Fix some wrong versions
|
||||
- avformat/hlsenc: Free context after hls_append_segment
|
||||
- avcodec/mpeg4video_parser: fix spurious extradata parse warnings
|
||||
- lavu/opt: fix av_opt_get function
|
||||
- avcodec/wmaprodec: Fix integer overflow in sfb_offsets initialization
|
||||
- avcodec/utvideodec: fix assumtation that slice_height >= 1
|
||||
- avcodec/options_table fix min of audio channels and sample rate
|
||||
- libavutil/thread.h: Support OS/2 threads
|
||||
- fix Makefile objects for pulseaudio support
|
||||
- opusdec: make sure all substreams have the same number of coded samples
|
||||
- lavu: add wrappers for the pthreads mutex API
|
||||
- avformat/avidec: fix handling dv in avi
|
||||
- avfilter/vf_lut: gammaval709()
|
||||
- cinedec: report white balance gain coefficients using metadata
|
||||
- swscale/utils: support bayer input + scaling, and bayer input + any supported output
|
||||
- swscale: support internal scaler cascades
|
||||
- avformat/dtsdec: dts_probe: check reserved bit, check lfe, check sr_code similarity
|
||||
- avformat/segment: export inner muxer timebase
|
||||
- Remove fminf() emulation, fix build issues
|
||||
- avcodec/mpegaudio_parser: fix off by 1 error in bitrate calculation
|
||||
- Use -fno-optimize-sibling-calls on parisc also for gcc 4.9.
|
||||
- ffmpeg_opt: store canvas size in decoder context
|
||||
- avcodec/mpeg12dec: do not trust AVCodecContext input dimensions
|
||||
|
||||
version 2.4.3:
|
||||
- avcodec/svq1dec: zero terminate embedded message before printing
|
||||
- avcodec/cook: check that the subpacket sizes fit in block_align
|
||||
|
7
configure
vendored
7
configure
vendored
@ -1668,7 +1668,6 @@ MATH_FUNCS="
|
||||
exp2
|
||||
exp2f
|
||||
expf
|
||||
fminf
|
||||
isinf
|
||||
isnan
|
||||
ldexpf
|
||||
@ -3934,6 +3933,9 @@ case "$arch" in
|
||||
;;
|
||||
x86)
|
||||
check_64bit x86_32 x86_64 'sizeof(void *) > 4'
|
||||
# Treat x32 as x64 for now. Note it also needs spic=$shared
|
||||
test "$subarch" = "x86_32" && check_cpp_condition stddef.h 'defined(__x86_64__)' &&
|
||||
subarch=x86_64
|
||||
if test "$subarch" = "x86_64"; then
|
||||
spic=$shared
|
||||
fi
|
||||
@ -4500,7 +4502,7 @@ elif enabled parisc; then
|
||||
|
||||
if enabled gcc; then
|
||||
case $($cc -dumpversion) in
|
||||
4.[3-8].*) check_cflags -fno-optimize-sibling-calls ;;
|
||||
4.[3-9].*) check_cflags -fno-optimize-sibling-calls ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
@ -4782,7 +4784,6 @@ disabled crystalhd || check_lib libcrystalhd/libcrystalhd_if.h DtsCrystalHDVersi
|
||||
atan2f_args=2
|
||||
ldexpf_args=2
|
||||
powf_args=2
|
||||
fminf_args=2
|
||||
|
||||
for func in $MATH_FUNCS; do
|
||||
eval check_mathfunc $func \${${func}_args:-1}
|
||||
|
@ -214,10 +214,10 @@ API changes, most recent first:
|
||||
2014-05-11 - 14aef38 / 66e6c8a - lavu 52.83.100 / 53.14.0 - pixfmt.h
|
||||
Add AV_PIX_FMT_VDA for new-style VDA acceleration.
|
||||
|
||||
2014-05-xx - xxxxxxx - lavu 52.82.0 - fifo.h
|
||||
2014-05-xx - xxxxxxx - lavu 52.82.100 - fifo.h
|
||||
Add av_fifo_freep() function.
|
||||
|
||||
2014-05-02 - ba52fb11 - lavu 52.81.0 - opt.h
|
||||
2014-05-02 - ba52fb11 - lavu 52.81.100 - opt.h
|
||||
Add av_opt_set_dict2() function.
|
||||
|
||||
2014-05-01 - e77b985 / a2941c8 - lavc 55.60.103 / 55.50.3 - avcodec.h
|
||||
|
@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg
|
||||
# This could be handy for archiving the generated documentation or
|
||||
# if some version control system is used.
|
||||
|
||||
PROJECT_NUMBER = 2.4.3
|
||||
PROJECT_NUMBER = 2.4.4
|
||||
|
||||
# With the PROJECT_LOGO tag one can specify a logo or icon that is included
|
||||
# in the documentation. The maximum height of the logo should not exceed 55
|
||||
|
@ -14,9 +14,9 @@
|
||||
# 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.
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# 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
|
||||
|
||||
|
@ -702,7 +702,7 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
|
||||
MATCH_PER_STREAM_OPT(fix_sub_duration, i, ist->fix_sub_duration, ic, st);
|
||||
MATCH_PER_STREAM_OPT(canvas_sizes, str, canvas_size, ic, st);
|
||||
if (canvas_size &&
|
||||
av_parse_video_size(&dec->width, &dec->height, canvas_size) < 0) {
|
||||
av_parse_video_size(&ist->dec_ctx->width, &ist->dec_ctx->height, canvas_size) < 0) {
|
||||
av_log(NULL, AV_LOG_FATAL, "Invalid canvas size: %s.\n", canvas_size);
|
||||
exit_program(1);
|
||||
}
|
||||
|
@ -473,10 +473,10 @@ static int decode_frame(FLACContext *s)
|
||||
ret = allocate_buffers(s);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
ff_flacdsp_init(&s->dsp, s->avctx->sample_fmt, s->bps);
|
||||
s->got_streaminfo = 1;
|
||||
dump_headers(s->avctx, (FLACStreaminfo *)s);
|
||||
}
|
||||
ff_flacdsp_init(&s->dsp, s->avctx->sample_fmt, s->bps);
|
||||
|
||||
// dump_headers(s->avctx, (FLACStreaminfo *)s);
|
||||
|
||||
|
@ -281,7 +281,7 @@ static int decode_display_orientation(H264Context *h)
|
||||
|
||||
int ff_h264_decode_sei(H264Context *h)
|
||||
{
|
||||
while (get_bits_left(&h->gb) > 16) {
|
||||
while (get_bits_left(&h->gb) > 16 && show_bits(&h->gb, 16)) {
|
||||
int type = 0;
|
||||
unsigned size = 0;
|
||||
unsigned next;
|
||||
|
@ -951,6 +951,11 @@ int ff_hevc_decode_nal_sps(HEVCContext *s)
|
||||
sps->long_term_ref_pics_present_flag = get_bits1(gb);
|
||||
if (sps->long_term_ref_pics_present_flag) {
|
||||
sps->num_long_term_ref_pics_sps = get_ue_golomb_long(gb);
|
||||
if (sps->num_long_term_ref_pics_sps > 31U) {
|
||||
av_log(0, AV_LOG_ERROR, "num_long_term_ref_pics_sps %d is out of range.\n",
|
||||
sps->num_long_term_ref_pics_sps);
|
||||
goto err;
|
||||
}
|
||||
for (i = 0; i < sps->num_long_term_ref_pics_sps; i++) {
|
||||
sps->lt_ref_pic_poc_lsb_sps[i] = get_bits(gb, sps->log2_max_poc_lsb);
|
||||
sps->used_by_curr_pic_lt_sps_flag[i] = get_bits1(gb);
|
||||
@ -1375,7 +1380,8 @@ int ff_hevc_decode_nal_pps(HEVCContext *s)
|
||||
int pps_range_extensions_flag = get_bits1(gb);
|
||||
/* int pps_extension_7bits = */ get_bits(gb, 7);
|
||||
if (sps->ptl.general_ptl.profile_idc == FF_PROFILE_HEVC_REXT && pps_range_extensions_flag) {
|
||||
pps_range_extensions(s, pps, sps);
|
||||
if ((ret = pps_range_extensions(s, pps, sps)) < 0)
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -244,7 +244,8 @@ int ff_mjpeg_decode_dht(MJpegDecodeContext *s)
|
||||
|
||||
int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
|
||||
{
|
||||
int len, nb_components, i, width, height, bits, pix_fmt_id, ret;
|
||||
int len, nb_components, i, width, height, bits, ret;
|
||||
unsigned pix_fmt_id;
|
||||
int h_count[MAX_COMPONENTS];
|
||||
int v_count[MAX_COMPONENTS];
|
||||
|
||||
@ -378,7 +379,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
|
||||
else if (!s->lossless)
|
||||
s->rgb = 0;
|
||||
/* XXX: not complete test ! */
|
||||
pix_fmt_id = (s->h_count[0] << 28) | (s->v_count[0] << 24) |
|
||||
pix_fmt_id = ((unsigned)s->h_count[0] << 28) | (s->v_count[0] << 24) |
|
||||
(s->h_count[1] << 20) | (s->v_count[1] << 16) |
|
||||
(s->h_count[2] << 12) | (s->v_count[2] << 8) |
|
||||
(s->h_count[3] << 4) | s->v_count[3];
|
||||
@ -514,6 +515,8 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
|
||||
else s->avctx->pix_fmt = AV_PIX_FMT_YUV420P16;
|
||||
s->avctx->color_range = s->cs_itu601 ? AVCOL_RANGE_MPEG : AVCOL_RANGE_JPEG;
|
||||
if (pix_fmt_id == 0x42111100) {
|
||||
if (s->bits > 8)
|
||||
goto unk_pixfmt;
|
||||
s->upscale_h = 6;
|
||||
s->chroma_height = (s->height + 1) / 2;
|
||||
}
|
||||
@ -1594,6 +1597,8 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
|
||||
}
|
||||
|
||||
if (id == AV_RB32("LJIF")) {
|
||||
int rgb = s->rgb;
|
||||
int pegasus_rct = s->pegasus_rct;
|
||||
if (s->avctx->debug & FF_DEBUG_PICT_INFO)
|
||||
av_log(s->avctx, AV_LOG_INFO,
|
||||
"Pegasus lossless jpeg header found\n");
|
||||
@ -1603,17 +1608,27 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
|
||||
skip_bits(&s->gb, 16); /* unknown always 0? */
|
||||
switch (i=get_bits(&s->gb, 8)) {
|
||||
case 1:
|
||||
s->rgb = 1;
|
||||
s->pegasus_rct = 0;
|
||||
rgb = 1;
|
||||
pegasus_rct = 0;
|
||||
break;
|
||||
case 2:
|
||||
s->rgb = 1;
|
||||
s->pegasus_rct = 1;
|
||||
rgb = 1;
|
||||
pegasus_rct = 1;
|
||||
break;
|
||||
default:
|
||||
av_log(s->avctx, AV_LOG_ERROR, "unknown colorspace %d\n", i);
|
||||
}
|
||||
|
||||
len -= 9;
|
||||
if (s->got_picture)
|
||||
if (rgb != s->rgb || pegasus_rct != s->pegasus_rct) {
|
||||
av_log(s->avctx, AV_LOG_WARNING, "Mismatching LJIF tag\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
s->rgb = rgb;
|
||||
s->pegasus_rct = pegasus_rct;
|
||||
|
||||
goto out;
|
||||
}
|
||||
if (id == AV_RL32("colr") && len > 0) {
|
||||
|
@ -1120,6 +1120,10 @@ static av_cold int mpeg_decode_init(AVCodecContext *avctx)
|
||||
MpegEncContext *s2 = &s->mpeg_enc_ctx;
|
||||
|
||||
ff_mpv_decode_defaults(s2);
|
||||
|
||||
if ( avctx->codec_tag != AV_RL32("VCR2")
|
||||
&& avctx->codec_tag != AV_RL32("BW10"))
|
||||
avctx->coded_width = avctx->coded_height = 0; // do not trust dimensions from input
|
||||
ff_mpv_decode_init(s2, avctx);
|
||||
|
||||
s->mpeg_enc_ctx.avctx = avctx;
|
||||
|
@ -88,7 +88,7 @@ static int mpeg4_decode_header(AVCodecParserContext *s1, AVCodecContext *avctx,
|
||||
if (avctx->extradata_size && pc->first_picture) {
|
||||
init_get_bits(gb, avctx->extradata, avctx->extradata_size * 8);
|
||||
ret = ff_mpeg4_decode_picture_header(dec_ctx, gb);
|
||||
if (ret < 0)
|
||||
if (ret < -1)
|
||||
av_log(avctx, AV_LOG_WARNING, "Failed to parse extradata\n");
|
||||
}
|
||||
|
||||
|
@ -73,20 +73,21 @@ static int mpegaudio_parse(AVCodecParserContext *s1,
|
||||
if (i > 4)
|
||||
s->header_count = -2;
|
||||
} else {
|
||||
int header_threshold = avctx->codec_id != AV_CODEC_ID_NONE && avctx->codec_id != codec_id;
|
||||
if((state&SAME_HEADER_MASK) != (s->header&SAME_HEADER_MASK) && s->header)
|
||||
s->header_count= -3;
|
||||
s->header= state;
|
||||
s->header_count++;
|
||||
s->frame_size = ret-4;
|
||||
|
||||
if (s->header_count > 0 + (avctx->codec_id != AV_CODEC_ID_NONE && avctx->codec_id != codec_id)) {
|
||||
if (s->header_count > header_threshold) {
|
||||
avctx->sample_rate= sr;
|
||||
avctx->channels = channels;
|
||||
s1->duration = frame_size;
|
||||
avctx->codec_id = codec_id;
|
||||
if (s->no_bitrate || !avctx->bit_rate) {
|
||||
s->no_bitrate = 1;
|
||||
avctx->bit_rate += (bit_rate - avctx->bit_rate) / s->header_count;
|
||||
avctx->bit_rate += (bit_rate - avctx->bit_rate) / (s->header_count - header_threshold);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -105,8 +105,8 @@ static const AVOption avcodec_options[] = {
|
||||
{"extradata_size", NULL, OFFSET(extradata_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
|
||||
{"time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, {.dbl = 0}, INT_MIN, INT_MAX},
|
||||
{"g", "set the group of picture (GOP) size", OFFSET(gop_size), AV_OPT_TYPE_INT, {.i64 = 12 }, INT_MIN, INT_MAX, V|E},
|
||||
{"ar", "set audio sampling rate (in Hz)", OFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|D|E},
|
||||
{"ac", "set number of audio channels", OFFSET(channels), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|D|E},
|
||||
{"ar", "set audio sampling rate (in Hz)", OFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, A|D|E},
|
||||
{"ac", "set number of audio channels", OFFSET(channels), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, A|D|E},
|
||||
{"cutoff", "set cutoff bandwidth", OFFSET(cutoff), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|E},
|
||||
{"frame_size", NULL, OFFSET(frame_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|E},
|
||||
{"frame_number", NULL, OFFSET(frame_number), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
|
||||
|
@ -499,6 +499,12 @@ static int opus_decode_packet(AVCodecContext *avctx, void *data,
|
||||
av_log(avctx, AV_LOG_ERROR, "Error parsing the packet header.\n");
|
||||
return ret;
|
||||
}
|
||||
if (coded_samples != s->packet.frame_count * s->packet.frame_duration) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Mismatching coded sample count in substream %d.\n", i);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
s->silk_samplerate = get_silk_samplerate(s->packet.config);
|
||||
}
|
||||
|
||||
|
@ -582,6 +582,12 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
case MKTAG('I', 'H', 'D', 'R'):
|
||||
if (length != 13)
|
||||
goto fail;
|
||||
|
||||
if (s->state & PNG_IDAT) {
|
||||
av_log(avctx, AV_LOG_ERROR, "IHDR after IDAT\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
s->width = bytestream2_get_be32(&s->gb);
|
||||
s->height = bytestream2_get_be32(&s->gb);
|
||||
if (av_image_check_size(s->width, s->height, 0, avctx)) {
|
||||
|
@ -172,6 +172,9 @@ static int raw_decode(AVCodecContext *avctx, void *data, int *got_frame,
|
||||
context->frame_size = avpicture_get_size(avctx->pix_fmt, avctx->width,
|
||||
avctx->height);
|
||||
}
|
||||
if (context->frame_size < 0)
|
||||
return context->frame_size;
|
||||
|
||||
need_copy = !avpkt->buf || context->is_2_4_bpp || context->is_yuv2 || context->is_lt_16bpp;
|
||||
|
||||
frame->pict_type = AV_PICTURE_TYPE_I;
|
||||
|
@ -279,7 +279,7 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
|
||||
int i;
|
||||
int w_align = 1;
|
||||
int h_align = 1;
|
||||
AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->pix_fmt);
|
||||
AVPixFmtDescriptor const *desc = av_pix_fmt_desc_get(s->pix_fmt);
|
||||
|
||||
if (desc) {
|
||||
w_align = 1 << desc->log2_chroma_w;
|
||||
@ -3610,6 +3610,11 @@ int avpriv_bprint_to_extradata(AVCodecContext *avctx, struct AVBPrint *buf)
|
||||
ret = av_bprint_finalize(buf, &str);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (!av_bprint_is_complete(buf)) {
|
||||
av_free(str);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
avctx->extradata = str;
|
||||
/* Note: the string is NUL terminated (so extradata can be read as a
|
||||
* string), but the ending character is not accounted in the size (in
|
||||
|
@ -224,7 +224,7 @@ static void restore_median(uint8_t *src, int step, int stride,
|
||||
A = bsrc[i];
|
||||
}
|
||||
bsrc += stride;
|
||||
if (slice_height == 1)
|
||||
if (slice_height <= 1)
|
||||
continue;
|
||||
// second line - first element has top prediction, the rest uses median
|
||||
C = bsrc[-stride];
|
||||
@ -284,7 +284,7 @@ static void restore_median_il(uint8_t *src, int step, int stride,
|
||||
A = bsrc[stride + i];
|
||||
}
|
||||
bsrc += stride2;
|
||||
if (slice_height == 1)
|
||||
if (slice_height <= 1)
|
||||
continue;
|
||||
// second line - first element has top prediction, the rest uses median
|
||||
C = bsrc[-stride2];
|
||||
|
@ -422,6 +422,9 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
offset &= ~3;
|
||||
if (offset > s->sfb_offsets[i][band - 1])
|
||||
s->sfb_offsets[i][band++] = offset;
|
||||
|
||||
if (offset >= subframe_len)
|
||||
break;
|
||||
}
|
||||
s->sfb_offsets[i][band - 1] = subframe_len;
|
||||
s->num_sfb[i] = band - 1;
|
||||
|
@ -34,7 +34,7 @@ OBJS-$(CONFIG_OPENGL_OUTDEV) += opengl_enc.o
|
||||
OBJS-$(CONFIG_OSS_INDEV) += oss_audio.o oss_audio_dec.o
|
||||
OBJS-$(CONFIG_OSS_OUTDEV) += oss_audio.o oss_audio_enc.o
|
||||
OBJS-$(CONFIG_PULSE_INDEV) += pulse_audio_dec.o \
|
||||
pulse_audio_common.o
|
||||
pulse_audio_common.o timefilter.o
|
||||
OBJS-$(CONFIG_PULSE_OUTDEV) += pulse_audio_enc.o \
|
||||
pulse_audio_common.o
|
||||
OBJS-$(CONFIG_QTKIT_INDEV) += qtkit.o
|
||||
|
@ -873,9 +873,6 @@ static int v4l2_read_header(AVFormatContext *ctx)
|
||||
|
||||
avpriv_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
|
||||
|
||||
if ((res = v4l2_set_parameters(ctx)) < 0)
|
||||
goto fail;
|
||||
|
||||
if (s->pixel_format) {
|
||||
AVCodec *codec = avcodec_find_decoder_by_name(s->pixel_format);
|
||||
|
||||
@ -926,6 +923,9 @@ static int v4l2_read_header(AVFormatContext *ctx)
|
||||
|
||||
s->frame_format = desired_format;
|
||||
|
||||
if ((res = v4l2_set_parameters(ctx)) < 0)
|
||||
goto fail;
|
||||
|
||||
st->codec->pix_fmt = avpriv_fmt_v4l2ff(desired_format, codec_id);
|
||||
s->frame_size =
|
||||
avpicture_get_size(st->codec->pix_fmt, s->width, s->height);
|
||||
|
@ -161,15 +161,32 @@ static double compute_gammaval(void *opaque, double gamma)
|
||||
return pow((val-minval)/(maxval-minval), gamma) * (maxval-minval)+minval;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute Rec.709 gama correction of value val
|
||||
*/
|
||||
static double compute_gammaval709(void *opaque, double gamma)
|
||||
{
|
||||
LutContext *s = opaque;
|
||||
double val = s->var_values[VAR_CLIPVAL];
|
||||
double minval = s->var_values[VAR_MINVAL];
|
||||
double maxval = s->var_values[VAR_MAXVAL];
|
||||
double level = (val - minval) / (maxval - minval);
|
||||
level = level < 0.018 ? 4.5 * level
|
||||
: 1.099 * pow(level, 1.0 / gamma) - 0.099;
|
||||
return level * (maxval - minval) + minval;
|
||||
}
|
||||
|
||||
static double (* const funcs1[])(void *, double) = {
|
||||
(void *)clip,
|
||||
(void *)compute_gammaval,
|
||||
(void *)compute_gammaval709,
|
||||
NULL
|
||||
};
|
||||
|
||||
static const char * const funcs1_names[] = {
|
||||
"clip",
|
||||
"gammaval",
|
||||
"gammaval709",
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -916,7 +916,7 @@ typedef struct AVStream {
|
||||
/**
|
||||
* Stream information used internally by av_find_stream_info()
|
||||
*/
|
||||
#define MAX_STD_TIMEBASES (60*12+6)
|
||||
#define MAX_STD_TIMEBASES (30*12+7+6)
|
||||
struct {
|
||||
int64_t last_dts;
|
||||
int64_t duration_gcd;
|
||||
|
@ -1141,7 +1141,7 @@ start_sync:
|
||||
goto start_sync;
|
||||
}
|
||||
|
||||
n = avi->dv_demux ? 0 : get_stream_idx(d);
|
||||
n = get_stream_idx(d);
|
||||
|
||||
if (!((i - avi->last_pkt_pos) & 1) &&
|
||||
get_stream_idx(d + 1) < s->nb_streams)
|
||||
@ -1153,6 +1153,9 @@ start_sync:
|
||||
goto start_sync;
|
||||
}
|
||||
|
||||
if (avi->dv_demux && n != 0)
|
||||
continue;
|
||||
|
||||
// parse ##dc/##wb
|
||||
if (n < s->nb_streams) {
|
||||
AVStream *st;
|
||||
|
@ -27,6 +27,7 @@
|
||||
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "libavcodec/bmp.h"
|
||||
#include "libavutil/intfloat.h"
|
||||
#include "avformat.h"
|
||||
#include "internal.h"
|
||||
|
||||
@ -78,6 +79,16 @@ static int set_metadata_int(AVDictionary **dict, const char *key, int value, int
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int set_metadata_float(AVDictionary **dict, const char *key, float value, int allow_zero)
|
||||
{
|
||||
if (value != 0 || allow_zero) {
|
||||
char tmp[64];
|
||||
snprintf(tmp, sizeof(tmp), "%f", value);
|
||||
return av_dict_set(dict, key, tmp, 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cine_read_header(AVFormatContext *avctx)
|
||||
{
|
||||
AVIOContext *pb = avctx->pb;
|
||||
@ -177,7 +188,10 @@ static int cine_read_header(AVFormatContext *avctx)
|
||||
set_metadata_int(&st->metadata, "contrast", avio_rl32(pb), 1);
|
||||
set_metadata_int(&st->metadata, "gamma", avio_rl32(pb), 1);
|
||||
|
||||
avio_skip(pb, 72); // Reserved1 .. WBView
|
||||
avio_skip(pb, 12 + 16); // Reserved1 .. AutoExpRect
|
||||
set_metadata_float(&st->metadata, "wbgain[0].r", av_int2float(avio_rl32(pb)), 1);
|
||||
set_metadata_float(&st->metadata, "wbgain[0].b", av_int2float(avio_rl32(pb)), 1);
|
||||
avio_skip(pb, 36); // WBGain[1].. WBView
|
||||
|
||||
st->codec->bits_per_coded_sample = avio_rl32(pb);
|
||||
|
||||
|
@ -34,7 +34,7 @@ static int dts_probe(AVProbeData *p)
|
||||
{
|
||||
const uint8_t *buf, *bufp;
|
||||
uint32_t state = -1;
|
||||
int markers[4] = {0};
|
||||
int markers[4*16] = {0};
|
||||
int sum, max, i;
|
||||
int64_t diff = 0;
|
||||
uint8_t hdr[12 + FF_INPUT_BUFFER_PADDING_SIZE] = { 0 };
|
||||
@ -43,6 +43,7 @@ static int dts_probe(AVProbeData *p)
|
||||
|
||||
for(; buf < (p->buf+p->buf_size)-2; buf+=2) {
|
||||
int marker, sample_blocks, sample_rate, sr_code, framesize;
|
||||
int lfe;
|
||||
GetBitContext gb;
|
||||
|
||||
bufp = buf;
|
||||
@ -89,13 +90,27 @@ static int dts_probe(AVProbeData *p)
|
||||
if (sample_rate == 0)
|
||||
continue;
|
||||
|
||||
get_bits(&gb, 5);
|
||||
if (get_bits(&gb, 1))
|
||||
continue;
|
||||
|
||||
skip_bits_long(&gb, 9);
|
||||
lfe = get_bits(&gb, 2);
|
||||
if (lfe > 2)
|
||||
continue;
|
||||
|
||||
marker += 4* sr_code;
|
||||
|
||||
markers[marker] ++;
|
||||
}
|
||||
sum = markers[0] + markers[1] + markers[2] + markers[3];
|
||||
max = 0;
|
||||
for (i=1; i<4; i++)
|
||||
|
||||
sum = max = 0;
|
||||
for (i=0; i<FF_ARRAY_ELEMS(markers); i++) {
|
||||
sum += markers[i];
|
||||
if (markers[max] < markers[i])
|
||||
max = i;
|
||||
}
|
||||
|
||||
if (markers[max] > 3 && p->buf_size / markers[max] < 32*1024 &&
|
||||
markers[max] * 4 > sum * 3 &&
|
||||
diff / p->buf_size > 200)
|
||||
|
@ -329,9 +329,10 @@ static int hls_write_trailer(struct AVFormatContext *s)
|
||||
|
||||
av_write_trailer(oc);
|
||||
avio_closep(&oc->pb);
|
||||
avformat_free_context(oc);
|
||||
av_free(hls->basename);
|
||||
hls_append_segment(hls, hls->duration);
|
||||
avformat_free_context(oc);
|
||||
hls->avf = NULL;
|
||||
hls_window(s, 1);
|
||||
|
||||
hls_free_segments(hls);
|
||||
|
@ -567,6 +567,7 @@ static int seg_write_header(AVFormatContext *s)
|
||||
AVFormatContext *oc = NULL;
|
||||
AVDictionary *options = NULL;
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
seg->segment_count = 0;
|
||||
if (!seg->write_header_trailer)
|
||||
@ -672,6 +673,13 @@ static int seg_write_header(AVFormatContext *s)
|
||||
}
|
||||
seg->segment_frame_count = 0;
|
||||
|
||||
av_assert0(s->nb_streams == oc->nb_streams);
|
||||
for (i = 0; i < s->nb_streams; i++) {
|
||||
AVStream *inner_st = oc->streams[i];
|
||||
AVStream *outer_st = s->streams[i];
|
||||
avpriv_set_pts_info(outer_st, inner_st->pts_wrap_bits, inner_st->time_base.num, inner_st->time_base.den);
|
||||
}
|
||||
|
||||
if (oc->avoid_negative_ts > 0 && s->avoid_negative_ts < 0)
|
||||
s->avoid_negative_ts = 1;
|
||||
|
||||
|
@ -2743,10 +2743,16 @@ static void compute_chapters_end(AVFormatContext *s)
|
||||
|
||||
static int get_std_framerate(int i)
|
||||
{
|
||||
if (i < 60 * 12)
|
||||
if (i < 30*12)
|
||||
return (i + 1) * 1001;
|
||||
else
|
||||
return ((const int[]) { 24, 30, 60, 12, 15, 48 })[i - 60 * 12] * 1000 * 12;
|
||||
i -= 30*12;
|
||||
|
||||
if (i < 7)
|
||||
return ((const int[]) { 40, 48, 50, 60, 80, 120, 240})[i] * 1001 * 12;
|
||||
|
||||
i -= 7;
|
||||
|
||||
return ((const int[]) { 24, 30, 60, 12, 15, 48 })[i] * 1000 * 12;
|
||||
}
|
||||
|
||||
/* Is the time base unreliable?
|
||||
|
@ -23,6 +23,10 @@
|
||||
#include "buffer_internal.h"
|
||||
#include "common.h"
|
||||
#include "mem.h"
|
||||
#include "thread.h"
|
||||
|
||||
//#define USE_ATOMICS !(HAVE_PTHREADS || HAVE_W32THREADS)
|
||||
#define USE_ATOMICS 1 // can be changed to the above once it received more testing in master
|
||||
|
||||
AVBufferRef *av_buffer_create(uint8_t *data, int size,
|
||||
void (*free)(void *opaque, uint8_t *data),
|
||||
@ -209,6 +213,8 @@ AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size))
|
||||
if (!pool)
|
||||
return NULL;
|
||||
|
||||
ff_mutex_init(&pool->mutex, NULL);
|
||||
|
||||
pool->size = size;
|
||||
pool->alloc = alloc ? alloc : av_buffer_alloc;
|
||||
|
||||
@ -230,6 +236,7 @@ static void buffer_pool_free(AVBufferPool *pool)
|
||||
buf->free(buf->opaque, buf->data);
|
||||
av_freep(&buf);
|
||||
}
|
||||
ff_mutex_destroy(&pool->mutex);
|
||||
av_freep(&pool);
|
||||
}
|
||||
|
||||
@ -290,7 +297,15 @@ static void pool_release_buffer(void *opaque, uint8_t *data)
|
||||
if(CONFIG_MEMORY_POISONING)
|
||||
memset(buf->data, FF_MEMORY_POISON, pool->size);
|
||||
|
||||
#if USE_ATOMICS
|
||||
add_to_pool(buf);
|
||||
#else
|
||||
ff_mutex_lock(&pool->mutex);
|
||||
buf->next = pool->pool;
|
||||
pool->pool = buf;
|
||||
ff_mutex_unlock(&pool->mutex);
|
||||
#endif
|
||||
|
||||
if (!avpriv_atomic_int_add_and_fetch(&pool->refcount, -1))
|
||||
buffer_pool_free(pool);
|
||||
}
|
||||
@ -320,8 +335,10 @@ static AVBufferRef *pool_alloc_buffer(AVBufferPool *pool)
|
||||
ret->buffer->opaque = buf;
|
||||
ret->buffer->free = pool_release_buffer;
|
||||
|
||||
#if USE_ATOMICS
|
||||
avpriv_atomic_int_add_and_fetch(&pool->refcount, 1);
|
||||
avpriv_atomic_int_add_and_fetch(&pool->nb_allocated, 1);
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -331,6 +348,7 @@ AVBufferRef *av_buffer_pool_get(AVBufferPool *pool)
|
||||
AVBufferRef *ret;
|
||||
BufferPoolEntry *buf;
|
||||
|
||||
#if USE_ATOMICS
|
||||
/* check whether the pool is empty */
|
||||
buf = get_pool(pool);
|
||||
if (!buf && pool->refcount <= pool->nb_allocated) {
|
||||
@ -352,7 +370,24 @@ AVBufferRef *av_buffer_pool_get(AVBufferPool *pool)
|
||||
add_to_pool(buf);
|
||||
return NULL;
|
||||
}
|
||||
avpriv_atomic_int_add_and_fetch(&pool->refcount, 1);
|
||||
#else
|
||||
ff_mutex_lock(&pool->mutex);
|
||||
buf = pool->pool;
|
||||
if (buf) {
|
||||
ret = av_buffer_create(buf->data, pool->size, pool_release_buffer,
|
||||
buf, 0);
|
||||
if (ret) {
|
||||
pool->pool = buf->next;
|
||||
buf->next = NULL;
|
||||
}
|
||||
} else {
|
||||
ret = pool_alloc_buffer(pool);
|
||||
}
|
||||
ff_mutex_unlock(&pool->mutex);
|
||||
#endif
|
||||
|
||||
if (ret)
|
||||
avpriv_atomic_int_add_and_fetch(&pool->refcount, 1);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include "buffer.h"
|
||||
#include "thread.h"
|
||||
|
||||
/**
|
||||
* The buffer is always treated as read-only.
|
||||
@ -72,6 +73,7 @@ typedef struct BufferPoolEntry {
|
||||
} BufferPoolEntry;
|
||||
|
||||
struct AVBufferPool {
|
||||
AVMutex mutex;
|
||||
BufferPoolEntry * volatile pool;
|
||||
|
||||
/*
|
||||
|
@ -82,16 +82,6 @@ static av_always_inline float cbrtf(float x)
|
||||
#define exp2f(x) ((float)exp2(x))
|
||||
#endif /* HAVE_EXP2F */
|
||||
|
||||
#if !HAVE_FMINF
|
||||
#undef fminf
|
||||
static av_always_inline av_const float fminf(float x, float y)
|
||||
{
|
||||
//Note, the NaN special case is needed for C spec compliance, it should be
|
||||
//optimized away if the users compiler is configured to assume no NaN
|
||||
return x > y ? y : (x == x ? x : y);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !HAVE_ISINF
|
||||
static av_always_inline av_const int isinf(float x)
|
||||
{
|
||||
|
@ -725,6 +725,10 @@ int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
|
||||
return AVERROR(EINVAL);
|
||||
if (!(*out_val = av_malloc(len*2 + 1)))
|
||||
return AVERROR(ENOMEM);
|
||||
if (!len) {
|
||||
*out_val[0] = '\0';
|
||||
return 0;
|
||||
}
|
||||
bin = *(uint8_t**)dst;
|
||||
for (i = 0; i < len; i++)
|
||||
snprintf(*out_val + i*2, 3, "%02X", bin[i]);
|
||||
@ -740,12 +744,14 @@ int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
|
||||
break;
|
||||
case AV_OPT_TYPE_DURATION:
|
||||
i64 = *(int64_t *)dst;
|
||||
ret = snprintf(buf, sizeof(buf), "%"PRIi64"d:%02d:%02d.%06d",
|
||||
ret = snprintf(buf, sizeof(buf), "%"PRIi64":%02d:%02d.%06d",
|
||||
i64 / 3600000000, (int)((i64 / 60000000) % 60),
|
||||
(int)((i64 / 1000000) % 60), (int)(i64 % 1000000));
|
||||
break;
|
||||
case AV_OPT_TYPE_COLOR:
|
||||
ret = snprintf(buf, sizeof(buf), "0x%02x%02x%02x%02x", ((int *)dst)[0], ((int *)dst)[1], ((int *)dst)[2], ((int *)dst)[3]);
|
||||
ret = snprintf(buf, sizeof(buf), "0x%02x%02x%02x%02x",
|
||||
(int)((uint8_t *)dst)[0], (int)((uint8_t *)dst)[1],
|
||||
(int)((uint8_t *)dst)[2], (int)((uint8_t *)dst)[3]);
|
||||
break;
|
||||
case AV_OPT_TYPE_CHANNEL_LAYOUT:
|
||||
i64 = *(int64_t *)dst;
|
||||
|
55
libavutil/thread.h
Normal file
55
libavutil/thread.h
Normal file
@ -0,0 +1,55 @@
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
// This header should only be used to simplify code where
|
||||
// threading is optional, not as a generic threading abstraction.
|
||||
|
||||
#ifndef AVUTIL_THREAD_H
|
||||
#define AVUTIL_THREAD_H
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if HAVE_PTHREADS || HAVE_W32THREADS || HAVE_OS2THREADS
|
||||
|
||||
#if HAVE_PTHREADS
|
||||
#include <pthread.h>
|
||||
#elif HAVE_OS2THREADS
|
||||
#include "compat/os2threads.h"
|
||||
#else
|
||||
#include "compat/w32pthreads.h"
|
||||
#endif
|
||||
|
||||
#define AVMutex pthread_mutex_t
|
||||
|
||||
#define ff_mutex_init pthread_mutex_init
|
||||
#define ff_mutex_lock pthread_mutex_lock
|
||||
#define ff_mutex_unlock pthread_mutex_unlock
|
||||
#define ff_mutex_destroy pthread_mutex_destroy
|
||||
|
||||
#else
|
||||
|
||||
#define AVMutex char
|
||||
|
||||
#define ff_mutex_init(mutex, attr) (0)
|
||||
#define ff_mutex_lock(mutex) (0)
|
||||
#define ff_mutex_unlock(mutex) (0)
|
||||
#define ff_mutex_destroy(mutex) (0)
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* AVUTIL_THREAD_H */
|
@ -27,6 +27,7 @@
|
||||
#include "libavutil/avutil.h"
|
||||
#include "libavutil/bswap.h"
|
||||
#include "libavutil/cpu.h"
|
||||
#include "libavutil/imgutils.h"
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "libavutil/mathematics.h"
|
||||
#include "libavutil/pixdesc.h"
|
||||
@ -899,6 +900,18 @@ int attribute_align_arg sws_scale(struct SwsContext *c,
|
||||
av_log(c, AV_LOG_ERROR, "One of the input parameters to sws_scale() is NULL, please check the calling code\n");
|
||||
return 0;
|
||||
}
|
||||
if (c->cascaded_context[0] && srcSliceY == 0 && srcSliceH == c->cascaded_context[0]->srcH) {
|
||||
ret = sws_scale(c->cascaded_context[0],
|
||||
srcSlice, srcStride, srcSliceY, srcSliceH,
|
||||
c->cascaded_tmp, c->cascaded_tmpStride);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
ret = sws_scale(c->cascaded_context[1],
|
||||
(const uint8_t * const * )c->cascaded_tmp, c->cascaded_tmpStride, 0, c->cascaded_context[0]->dstH,
|
||||
dst, dstStride);
|
||||
return ret;
|
||||
}
|
||||
|
||||
memcpy(src2, srcSlice, sizeof(src2));
|
||||
memcpy(dst2, dst, sizeof(dst2));
|
||||
|
||||
|
@ -61,6 +61,8 @@
|
||||
# define APCK_SIZE 16
|
||||
#endif
|
||||
|
||||
#define RETCODE_USE_CASCADE -12345
|
||||
|
||||
struct SwsContext;
|
||||
|
||||
typedef enum SwsDither {
|
||||
@ -301,6 +303,14 @@ typedef struct SwsContext {
|
||||
int sliceDir; ///< Direction that slices are fed to the scaler (1 = top-to-bottom, -1 = bottom-to-top).
|
||||
double param[2]; ///< Input parameters for scaling algorithms that need them.
|
||||
|
||||
/* The cascaded_* fields allow spliting a scaler task into multiple
|
||||
* sequential steps, this is for example used to limit the maximum
|
||||
* downscaling factor that needs to be supported in one scaler.
|
||||
*/
|
||||
struct SwsContext *cascaded_context[2];
|
||||
int cascaded_tmpStride[4];
|
||||
uint8_t *cascaded_tmp[4];
|
||||
|
||||
uint32_t pal_yuv[256];
|
||||
uint32_t pal_rgb[256];
|
||||
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "libavutil/avutil.h"
|
||||
#include "libavutil/bswap.h"
|
||||
#include "libavutil/cpu.h"
|
||||
#include "libavutil/imgutils.h"
|
||||
#include "libavutil/intreadwrite.h"
|
||||
#include "libavutil/mathematics.h"
|
||||
#include "libavutil/opt.h"
|
||||
@ -582,8 +583,7 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
|
||||
goto fail;
|
||||
if (filterSize >= MAX_FILTER_SIZE * 16 /
|
||||
((flags & SWS_ACCURATE_RND) ? APCK_SIZE : 16)) {
|
||||
av_log(NULL, AV_LOG_ERROR, "sws: filterSize %d is too large, try less extreme scaling or set --sws-max-filter-size and recompile\n",
|
||||
FF_CEIL_RSHIFT((filterSize+1) * ((flags & SWS_ACCURATE_RND) ? APCK_SIZE : 16), 4));
|
||||
ret = RETCODE_USE_CASCADE;
|
||||
goto fail;
|
||||
}
|
||||
*outFilterSize = filterSize;
|
||||
@ -675,7 +675,7 @@ static av_cold int initFilter(int16_t **outFilter, int32_t **filterPos,
|
||||
|
||||
fail:
|
||||
if(ret < 0)
|
||||
av_log(NULL, AV_LOG_ERROR, "sws: initFilter failed\n");
|
||||
av_log(NULL, ret == RETCODE_USE_CASCADE ? AV_LOG_DEBUG : AV_LOG_ERROR, "sws: initFilter failed\n");
|
||||
av_free(filter);
|
||||
av_free(filter2);
|
||||
return ret;
|
||||
@ -970,6 +970,7 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
|
||||
enum AVPixelFormat dstFormat = c->dstFormat;
|
||||
const AVPixFmtDescriptor *desc_src;
|
||||
const AVPixFmtDescriptor *desc_dst;
|
||||
int ret = 0;
|
||||
|
||||
cpu_flags = av_get_cpu_flags();
|
||||
flags = c->flags;
|
||||
@ -1227,6 +1228,31 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
|
||||
}
|
||||
}
|
||||
|
||||
if (isBayer(srcFormat)) {
|
||||
if (!unscaled ||
|
||||
(dstFormat != AV_PIX_FMT_RGB24 && dstFormat != AV_PIX_FMT_YUV420P)) {
|
||||
enum AVPixelFormat tmpFormat = AV_PIX_FMT_RGB24;
|
||||
|
||||
ret = av_image_alloc(c->cascaded_tmp, c->cascaded_tmpStride,
|
||||
srcW, srcH, tmpFormat, 64);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
c->cascaded_context[0] = sws_getContext(srcW, srcH, srcFormat,
|
||||
srcW, srcH, tmpFormat,
|
||||
flags, srcFilter, NULL, c->param);
|
||||
if (!c->cascaded_context[0])
|
||||
return -1;
|
||||
|
||||
c->cascaded_context[1] = sws_getContext(srcW, srcH, tmpFormat,
|
||||
dstW, dstH, dstFormat,
|
||||
flags, NULL, dstFilter, c->param);
|
||||
if (!c->cascaded_context[1])
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#define USE_MMAP (HAVE_MMAP && HAVE_MPROTECT && defined MAP_ANONYMOUS)
|
||||
|
||||
/* precalculate horizontal scaler filter coefficients */
|
||||
@ -1295,23 +1321,23 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
|
||||
const int filterAlign = X86_MMX(cpu_flags) ? 4 :
|
||||
PPC_ALTIVEC(cpu_flags) ? 8 : 1;
|
||||
|
||||
if (initFilter(&c->hLumFilter, &c->hLumFilterPos,
|
||||
if ((ret = initFilter(&c->hLumFilter, &c->hLumFilterPos,
|
||||
&c->hLumFilterSize, c->lumXInc,
|
||||
srcW, dstW, filterAlign, 1 << 14,
|
||||
(flags & SWS_BICUBLIN) ? (flags | SWS_BICUBIC) : flags,
|
||||
cpu_flags, srcFilter->lumH, dstFilter->lumH,
|
||||
c->param,
|
||||
get_local_pos(c, 0, 0, 0),
|
||||
get_local_pos(c, 0, 0, 0)) < 0)
|
||||
get_local_pos(c, 0, 0, 0))) < 0)
|
||||
goto fail;
|
||||
if (initFilter(&c->hChrFilter, &c->hChrFilterPos,
|
||||
if ((ret = initFilter(&c->hChrFilter, &c->hChrFilterPos,
|
||||
&c->hChrFilterSize, c->chrXInc,
|
||||
c->chrSrcW, c->chrDstW, filterAlign, 1 << 14,
|
||||
(flags & SWS_BICUBLIN) ? (flags | SWS_BILINEAR) : flags,
|
||||
cpu_flags, srcFilter->chrH, dstFilter->chrH,
|
||||
c->param,
|
||||
get_local_pos(c, c->chrSrcHSubSample, c->src_h_chr_pos, 0),
|
||||
get_local_pos(c, c->chrDstHSubSample, c->dst_h_chr_pos, 0)) < 0)
|
||||
get_local_pos(c, c->chrDstHSubSample, c->dst_h_chr_pos, 0))) < 0)
|
||||
goto fail;
|
||||
}
|
||||
} // initialize horizontal stuff
|
||||
@ -1321,22 +1347,22 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
|
||||
const int filterAlign = X86_MMX(cpu_flags) ? 2 :
|
||||
PPC_ALTIVEC(cpu_flags) ? 8 : 1;
|
||||
|
||||
if (initFilter(&c->vLumFilter, &c->vLumFilterPos, &c->vLumFilterSize,
|
||||
if ((ret = initFilter(&c->vLumFilter, &c->vLumFilterPos, &c->vLumFilterSize,
|
||||
c->lumYInc, srcH, dstH, filterAlign, (1 << 12),
|
||||
(flags & SWS_BICUBLIN) ? (flags | SWS_BICUBIC) : flags,
|
||||
cpu_flags, srcFilter->lumV, dstFilter->lumV,
|
||||
c->param,
|
||||
get_local_pos(c, 0, 0, 1),
|
||||
get_local_pos(c, 0, 0, 1)) < 0)
|
||||
get_local_pos(c, 0, 0, 1))) < 0)
|
||||
goto fail;
|
||||
if (initFilter(&c->vChrFilter, &c->vChrFilterPos, &c->vChrFilterSize,
|
||||
if ((ret = initFilter(&c->vChrFilter, &c->vChrFilterPos, &c->vChrFilterSize,
|
||||
c->chrYInc, c->chrSrcH, c->chrDstH,
|
||||
filterAlign, (1 << 12),
|
||||
(flags & SWS_BICUBLIN) ? (flags | SWS_BILINEAR) : flags,
|
||||
cpu_flags, srcFilter->chrV, dstFilter->chrV,
|
||||
c->param,
|
||||
get_local_pos(c, c->chrSrcVSubSample, c->src_v_chr_pos, 1),
|
||||
get_local_pos(c, c->chrDstVSubSample, c->dst_v_chr_pos, 1)) < 0)
|
||||
get_local_pos(c, c->chrDstVSubSample, c->dst_v_chr_pos, 1))) < 0)
|
||||
|
||||
goto fail;
|
||||
|
||||
@ -1490,6 +1516,32 @@ av_cold int sws_init_context(SwsContext *c, SwsFilter *srcFilter,
|
||||
c->swscale = ff_getSwsFunc(c);
|
||||
return 0;
|
||||
fail: // FIXME replace things by appropriate error codes
|
||||
if (ret == RETCODE_USE_CASCADE) {
|
||||
int tmpW = sqrt(srcW * (int64_t)dstW);
|
||||
int tmpH = sqrt(srcH * (int64_t)dstH);
|
||||
enum AVPixelFormat tmpFormat = AV_PIX_FMT_YUV420P;
|
||||
|
||||
if (srcW*(int64_t)srcH <= 4LL*dstW*dstH)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
ret = av_image_alloc(c->cascaded_tmp, c->cascaded_tmpStride,
|
||||
tmpW, tmpH, tmpFormat, 64);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
c->cascaded_context[0] = sws_getContext(srcW, srcH, srcFormat,
|
||||
tmpW, tmpH, tmpFormat,
|
||||
flags, srcFilter, NULL, c->param);
|
||||
if (!c->cascaded_context[0])
|
||||
return -1;
|
||||
|
||||
c->cascaded_context[1] = sws_getContext(tmpW, tmpH, tmpFormat,
|
||||
dstW, dstH, dstFormat,
|
||||
flags, NULL, dstFilter, c->param);
|
||||
if (!c->cascaded_context[1])
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -1901,6 +1953,11 @@ void sws_freeContext(SwsContext *c)
|
||||
av_freep(&c->yuvTable);
|
||||
av_freep(&c->formatConvBuffer);
|
||||
|
||||
sws_freeContext(c->cascaded_context[0]);
|
||||
sws_freeContext(c->cascaded_context[1]);
|
||||
memset(c->cascaded_context, 0, sizeof(c->cascaded_context));
|
||||
av_freep(&c->cascaded_tmp[0]);
|
||||
|
||||
av_free(c);
|
||||
}
|
||||
|
||||
|
@ -1634,6 +1634,16 @@ static inline void RENAME(rgb24toyv12)(const uint8_t *src, uint8_t *ydst, uint8_
|
||||
#define BGR2V_IDX "16*4+16*34"
|
||||
int y;
|
||||
const x86_reg chromWidth= width>>1;
|
||||
|
||||
if (height > 2) {
|
||||
ff_rgb24toyv12_c(src, ydst, udst, vdst, width, 2, lumStride, chromStride, srcStride, rgb2yuv);
|
||||
src += 2*srcStride;
|
||||
ydst += 2*lumStride;
|
||||
udst += chromStride;
|
||||
vdst += chromStride;
|
||||
height -= 2;
|
||||
}
|
||||
|
||||
for (y=0; y<height-2; y+=2) {
|
||||
int i;
|
||||
for (i=0; i<2; i++) {
|
||||
|
@ -425,7 +425,7 @@ switch(c->dstBpc){ \
|
||||
case 16: do_16_case; break; \
|
||||
case 10: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2planeX_10_ ## opt; break; \
|
||||
case 9: if (!isBE(c->dstFormat)) vscalefn = ff_yuv2planeX_9_ ## opt; break; \
|
||||
default: if (condition_8bit) /*vscalefn = ff_yuv2planeX_8_ ## opt;*/ break; \
|
||||
case 8: if ((condition_8bit) && !c->use_mmx_vfilter) vscalefn = ff_yuv2planeX_8_ ## opt; break; \
|
||||
}
|
||||
#define ASSIGN_VSCALE_FUNC(vscalefn, opt1, opt2, opt2chk) \
|
||||
switch(c->dstBpc){ \
|
||||
|
@ -1,4 +1,4 @@
|
||||
#tb 0: 12/601
|
||||
#tb 0: 1/50
|
||||
0, 0, 0, 1, 63180, 0xcda82c16
|
||||
0, 1, 1, 1, 63180, 0xa6097bf9
|
||||
0, 2, 2, 1, 63180, 0x4c2fb091
|
||||
|
@ -1,2 +1,2 @@
|
||||
#tb 0: 3/158
|
||||
#tb 0: 12/281
|
||||
0, 0, 0, 1, 67584, 0xce0cade5
|
||||
|
@ -1,4 +1,4 @@
|
||||
#tb 0: 12/601
|
||||
#tb 0: 1/50
|
||||
0, 0, 0, 1, 67584, 0x5eae629b
|
||||
0, 1, 1, 1, 67584, 0x32591227
|
||||
0, 2, 2, 1, 67584, 0x4e4424c7
|
||||
|
@ -1,4 +1,4 @@
|
||||
#tb 0: 16701/250000
|
||||
#tb 0: 1001/15000
|
||||
0, 0, 0, 1, 38016, 0x50e93e0d
|
||||
0, 1, 1, 1, 38016, 0x6ac8627d
|
||||
0, 2, 2, 1, 38016, 0x6f38661e
|
||||
|
Loading…
Reference in New Issue
Block a user