icecat: add release icecat-140.10.1-1gnu1 for ecne

This commit is contained in:
Ark74 2026-05-04 16:58:41 -06:00
parent a5f93cb214
commit ff85d7c623
1256 changed files with 63469 additions and 24141 deletions

View file

@ -18,13 +18,12 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "libavutil/attributes.h"
#include "libavutil/avassert.h"
#include "libavutil/channel_layout.h"
#include "libavutil/emms.h"
#include "libavutil/frame.h"
#include "libavutil/imgutils.h"
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mem.h"
#include "libavutil/pixdesc.h"
#include "libavutil/samplefmt.h"
@ -214,21 +213,6 @@ int ff_encode_get_frame(AVCodecContext *avctx, AVFrame *frame)
av_frame_move_ref(frame, avci->buffer_frame);
#if FF_API_FRAME_KEY
FF_DISABLE_DEPRECATION_WARNINGS
if (frame->key_frame)
frame->flags |= AV_FRAME_FLAG_KEY;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
#if FF_API_INTERLACED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
if (frame->interlaced_frame)
frame->flags |= AV_FRAME_FLAG_INTERLACED;
if (frame->top_field_first)
frame->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST;
FF_ENABLE_DEPRECATION_WARNINGS
#endif
return 0;
}
@ -252,7 +236,7 @@ int ff_encode_encode_cb(AVCodecContext *avctx, AVPacket *avpkt,
int ret;
ret = codec->cb.encode(avctx, avpkt, frame, got_packet);
emms_c();
ff_assert1_fpu();
av_assert0(ret <= 0);
if (!ret && *got_packet) {
@ -333,12 +317,13 @@ static int encode_simple_internal(AVCodecContext *avctx, AVPacket *avpkt)
av_assert0(codec->cb_type == FF_CODEC_CB_TYPE_ENCODE);
if (CONFIG_FRAME_THREAD_ENCODER && avci->frame_thread_encoder)
#if CONFIG_FRAME_THREAD_ENCODER
if (avci->frame_thread_encoder)
/* This will unref frame. */
ret = ff_thread_video_encode_frame(avctx, avpkt, frame, &got_packet);
else {
else
#endif
ret = ff_encode_encode_cb(avctx, avpkt, frame, &got_packet);
}
if (avci->draining && !got_packet)
avci->draining_done = 1;
@ -372,8 +357,6 @@ static int encode_receive_packet_internal(AVCodecContext *avctx, AVPacket *avpkt
if (avctx->codec->type == AVMEDIA_TYPE_VIDEO) {
if ((avctx->flags & AV_CODEC_FLAG_PASS1) && avctx->stats_out)
avctx->stats_out[0] = '\0';
if (av_image_check_size2(avctx->width, avctx->height, avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx))
return AVERROR(EINVAL);
}
if (ffcodec(avctx->codec)->cb_type == FF_CODEC_CB_TYPE_RECEIVE_PACKET) {
@ -566,7 +549,7 @@ static int encode_preinit_video(AVCodecContext *avctx)
const enum AVPixelFormat *pix_fmts;
int ret, i, num_pix_fmts;
if (!av_get_pix_fmt_name(avctx->pix_fmt)) {
if (!pixdesc) {
av_log(avctx, AV_LOG_ERROR, "Invalid video pixel format: %d\n",
avctx->pix_fmt);
return AVERROR(EINVAL);
@ -602,6 +585,33 @@ static int encode_preinit_video(AVCodecContext *avctx)
avctx->color_range = AVCOL_RANGE_JPEG;
}
if (pixdesc->flags & AV_PIX_FMT_FLAG_ALPHA) {
const enum AVAlphaMode *alpha_modes;
int num_alpha_modes;
ret = avcodec_get_supported_config(avctx, NULL, AV_CODEC_CONFIG_ALPHA_MODE,
0, (const void **) &alpha_modes, &num_alpha_modes);
if (ret < 0)
return ret;
if (avctx->alpha_mode != AVALPHA_MODE_UNSPECIFIED && alpha_modes) {
for (i = 0; i < num_alpha_modes; i++) {
if (avctx->alpha_mode == alpha_modes[i])
break;
}
if (i == num_alpha_modes) {
av_log(avctx, AV_LOG_ERROR,
"Specified alpha mode '%s' is not supported by the %s encoder.\n",
av_alpha_mode_name(avctx->alpha_mode), c->name);
av_log(avctx, AV_LOG_ERROR, "Supported alpha modes:\n");
for (int p = 0; alpha_modes[p] != AVALPHA_MODE_UNSPECIFIED; p++) {
av_log(avctx, AV_LOG_ERROR, " %s\n",
av_alpha_mode_name(alpha_modes[p]));
}
return AVERROR(EINVAL);
}
}
}
if ( avctx->bits_per_raw_sample < 0
|| (avctx->bits_per_raw_sample > 8 && pixdesc->comp[0].depth <= 8)) {
av_log(avctx, AV_LOG_WARNING, "Specified bit depth %d not possible with the specified pixel formats depth %d\n",
@ -613,20 +623,6 @@ static int encode_preinit_video(AVCodecContext *avctx)
return AVERROR(EINVAL);
}
#if FF_API_TICKS_PER_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
if (avctx->ticks_per_frame && avctx->time_base.num &&
avctx->ticks_per_frame > INT_MAX / avctx->time_base.num) {
av_log(avctx, AV_LOG_ERROR,
"ticks_per_frame %d too large for the timebase %d/%d.",
avctx->ticks_per_frame,
avctx->time_base.num,
avctx->time_base.den);
return AVERROR(EINVAL);
}
FF_ENABLE_DEPRECATION_WARNINGS
#endif
if (avctx->hw_frames_ctx) {
AVHWFramesContext *frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data;
if (frames_ctx->format != avctx->pix_fmt) {
@ -662,11 +658,6 @@ static int encode_preinit_audio(AVCodecContext *avctx)
avctx->sample_fmt);
return AVERROR(EINVAL);
}
if (avctx->sample_rate <= 0) {
av_log(avctx, AV_LOG_ERROR, "Invalid audio sample rate: %d\n",
avctx->sample_rate);
return AVERROR(EINVAL);
}
ret = avcodec_get_supported_config(avctx, NULL, AV_CODEC_CONFIG_SAMPLE_FORMAT,
0, (const void **) &sample_fmts,
@ -835,11 +826,11 @@ int ff_encode_preinit(AVCodecContext *avctx)
memcpy(sd_packet->data, sd_frame->data, sd_frame->size);
}
if (CONFIG_FRAME_THREAD_ENCODER) {
ret = ff_frame_thread_encoder_init(avctx);
if (ret < 0)
return ret;
}
#if CONFIG_FRAME_THREAD_ENCODER
ret = ff_frame_thread_encoder_init(avctx);
if (ret < 0)
return ret;
#endif
return 0;
}
@ -848,24 +839,12 @@ int ff_encode_alloc_frame(AVCodecContext *avctx, AVFrame *frame)
{
int ret;
switch (avctx->codec->type) {
case AVMEDIA_TYPE_VIDEO:
frame->format = avctx->pix_fmt;
if (frame->width <= 0 || frame->height <= 0) {
frame->width = FFMAX(avctx->width, avctx->coded_width);
frame->height = FFMAX(avctx->height, avctx->coded_height);
}
av_assert1(avctx->codec_type == AVMEDIA_TYPE_VIDEO);
break;
case AVMEDIA_TYPE_AUDIO:
frame->sample_rate = avctx->sample_rate;
frame->format = avctx->sample_fmt;
if (!frame->ch_layout.nb_channels) {
ret = av_channel_layout_copy(&frame->ch_layout, &avctx->ch_layout);
if (ret < 0)
return ret;
}
break;
frame->format = avctx->pix_fmt;
if (frame->width <= 0 || frame->height <= 0) {
frame->width = avctx->width;
frame->height = avctx->height;
}
ret = avcodec_default_get_buffer2(avctx, frame, 0);
@ -936,3 +915,47 @@ AVCPBProperties *ff_encode_add_cpb_side_data(AVCodecContext *avctx)
return props;
}
int ff_encode_add_stats_side_data(AVPacket *pkt, int quality, const int64_t error[],
int error_count, enum AVPictureType pict_type)
{
uint8_t *side_data;
size_t side_data_size;
side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_QUALITY_STATS, &side_data_size);
if (!side_data) {
side_data_size = 4+4+8*error_count;
side_data = av_packet_new_side_data(pkt, AV_PKT_DATA_QUALITY_STATS,
side_data_size);
}
if (!side_data || side_data_size < 4+4+8*error_count)
return AVERROR(ENOMEM);
AV_WL32(side_data, quality);
side_data[4] = pict_type;
side_data[5] = error_count;
for (int i = 0; i < error_count; ++i)
AV_WL64(side_data+8 + 8*i , error[i]);
return 0;
}
int ff_check_codec_matrices(AVCodecContext *avctx, unsigned types, uint16_t min, uint16_t max)
{
uint16_t *matrices[] = {avctx->intra_matrix, avctx->inter_matrix, avctx->chroma_intra_matrix};
const char *names[] = {"Intra", "Inter", "Chroma Intra"};
static_assert(FF_ARRAY_ELEMS(matrices) == FF_ARRAY_ELEMS(names), "matrix count mismatch");
for (int m = 0; m < FF_ARRAY_ELEMS(matrices); m++) {
uint16_t *matrix = matrices[m];
if (matrix && (types & (1U << m))) {
for (int i = 0; i < 64; i++) {
if (matrix[i] < min || matrix[i] > max) {
av_log(avctx, AV_LOG_ERROR, "%s matrix[%d] is %d which is out of the allowed range [%"PRIu16"-%"PRIu16"].\n", names[m], i, matrix[i], min, max);
return AVERROR(EINVAL);
}
}
}
}
return 0;
}