[FFmpeg-devel] [PATCH]Support decoding Avid 1:1 10-bit RGB Packer
Carl Eugen Hoyos
cehoyos at ag.or.at
Wed Jan 4 03:20:08 CET 2012
On Wednesday 04 January 2012 03:01:22 am Paul B Mahol wrote:
> On 1/4/12, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
> > Attached patch allows to decode the one AVrp sample I have.
>
> Some info on net claims this packer have alpha channel.
That is very unlikely for the sample I have (although it would make sense), it
contains only "0" as alpha channel.
> It looks to me this codec is similar to r10k (AJA Kona) but in LE
> (with additional alpha).
>
> So I see no reason to put decoder in separate file.
True, thank you!
New patch attached (without Changelog, version bump and doc), Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/r210dec.c b/libavcodec/r210dec.c
index 18086c6..b3129a2 100644
--- a/libavcodec/r210dec.c
+++ b/libavcodec/r210dec.c
@@ -20,6 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "libavutil/bswap.h"
@@ -61,8 +62,13 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
for (h = 0; h < avctx->height; h++) {
uint16_t *dst = (uint16_t *)dst_line;
for (w = 0; w < avctx->width; w++) {
- uint32_t pixel = av_be2ne32(*src++);
+ uint32_t pixel;
uint16_t r, g, b;
+ if (avctx->codec_id==CODEC_ID_AVRP) {
+ pixel = AV_RL32(src++);
+ } else {
+ pixel = av_be2ne32(*src++);
+ }
if (avctx->codec_id==CODEC_ID_R210) {
b = pixel << 6;
g = (pixel >> 4) & 0xffc0;
@@ -120,3 +126,15 @@ AVCodec ff_r10k_decoder = {
.long_name = NULL_IF_CONFIG_SMALL("AJA Kona 10-bit RGB Codec"),
};
#endif
+#if CONFIG_AVRP_DECODER
+AVCodec ff_avrp_decoder = {
+ .name = "avrp",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .id = CODEC_ID_AVRP,
+ .init = decode_init,
+ .close = decode_close,
+ .decode = decode_frame,
+ .capabilities = CODEC_CAP_DR1,
+ .long_name = NULL_IF_CONFIG_SMALL("Avid 1:1 10-bit RGB Packer"),
+};
+#endif
More information about the ffmpeg-devel
mailing list