Skip to content

Commit

Permalink
Bug 1869332 - Add an av1 encoder based on libaom to ffvpx. r=chunmin
Browse files Browse the repository at this point in the history
  • Loading branch information
padenot committed Dec 14, 2023
1 parent 362f36f commit 9556edc
Show file tree
Hide file tree
Showing 6 changed files with 1,662 additions and 1 deletion.
2 changes: 1 addition & 1 deletion media/ffvpx/config_components_audio_video.h
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@
#define CONFIG_ILBC_AT_ENCODER 0
#define CONFIG_PCM_ALAW_AT_ENCODER 0
#define CONFIG_PCM_MULAW_AT_ENCODER 0
#define CONFIG_LIBAOM_AV1_ENCODER 0
#define CONFIG_LIBAOM_AV1_ENCODER 1
#define CONFIG_LIBCODEC2_ENCODER 0
#define CONFIG_LIBFDK_AAC_ENCODER 0
#define CONFIG_LIBGSM_ENCODER 0
Expand Down
3 changes: 3 additions & 0 deletions media/ffvpx/libavcodec/codec_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,8 @@ static const FFCodec * const codec_list[] = {
#endif
#if CONFIG_LIBVPX_VP9_ENCODER
&ff_libvpx_vp9_encoder,
#endif
#if CONFIG_LIBAOM_AV1_ENCODER
&ff_libaom_av1_encoder,
#endif
NULL };
49 changes: 49 additions & 0 deletions media/ffvpx/libavcodec/libaom.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* 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
* AOM common functions
*/

#include "libavutil/pixdesc.h"
#include "libaom.h"

void ff_aom_image_copy_16_to_8(AVFrame *pic, struct aom_image *img)
{
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pic->format);
int i;

for (i = 0; i < desc->nb_components; i++) {
int w = img->d_w;
int h = img->d_h;
int x, y;

if (i) {
w = (w + img->x_chroma_shift) >> img->x_chroma_shift;
h = (h + img->y_chroma_shift) >> img->y_chroma_shift;
}

for (y = 0; y < h; y++) {
uint16_t *src = (uint16_t *)(img->planes[i] + y * img->stride[i]);
uint8_t *dst = pic->data[i] + y * pic->linesize[i];
for (x = 0; x < w; x++)
*dst++ = *src++;
}
}
}
33 changes: 33 additions & 0 deletions media/ffvpx/libavcodec/libaom.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* 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
* AOM common functions
*/

#ifndef AVCODEC_LIBAOM_H
#define AVCODEC_LIBAOM_H

#include <aom/aom_image.h>

#include "libavutil/frame.h"

void ff_aom_image_copy_16_to_8(AVFrame *pic, struct aom_image *img);

#endif /* AVCODEC_LIBAOM_H */
Loading

0 comments on commit 9556edc

Please sign in to comment.