History

r210, r10k and avrp encoder

Paul B Mahol committed 14 years ago

Commit dd453f11 parent 807a0456 files · +132 −8Browse files

Unified · Split

6 files
  1. Changelog +2 −1
  2. doc/general.texi +3 −3
  3. libavcodec/Makefile +3 −0
  4. libavcodec/allcodecs.c +3 −3
  5. libavcodec/r210enc.c +120 −0
  6. libavcodec/version.h +1 −1
Changelog+2−1
@@ -18,7 +18,7 @@ version next: · 17 unmodified lines
1818 - Automatic thread count based on detection number of (available) CPU cores
1919 - y41p Brooktree Uncompressed 4:1:1 12-bit encoder and decoder
2020 - ffprobe -show_error option
21−- Avid 1:1 10-bit RGB Packer decoder
21+- Avid 1:1 10-bit RGB Packer codec
2222 - v308 Quicktime Uncompressed 4:4:4 encoder and decoder
2323 - yuv4 libquicktime packed 4:2:0 encoder and decoder
2424 - ffprobe -show_frames option
@@ -28,6 +28,7 @@ version next: · 3 unmodified lines
2828 - optimized iMDCT transform on x86 using SSE for for mpegaudiodec
2929 - Improved PGS subtitle decoder
3030 - dumpgraph option to lavfi device
31+- r210 and r10k encoders
3132
3233
3334 version 0.9:
doc/general.texi+3−3
@@ -440,7 +440,7 @@ following image formats are supported: · 439 unmodified lines
440440 @item Autodesk Animator Flic video @tab @tab X
441441 @item Autodesk RLE @tab @tab X
442442 @tab fourcc: AASC
443−@item Avid 1:1 10-bit RGB Packer @tab @tab X
443+@item Avid 1:1 10-bit RGB Packer @tab X @tab X
444444 @tab fourcc: AVrp
445445 @item AVS (Audio Video Standard) video @tab @tab X
446446 @tab Video encoding used by the Creature Shock game.
@@ -577,8 +577,8 @@ following image formats are supported: · 130 unmodified lines
577577 @tab fourcc: 'smc '
578578 @item QuickTime video (RPZA) @tab @tab X
579579 @tab fourcc: rpza
580−@item R10K AJA Kona 10-bit RGB Codec @tab @tab X
581−@item R210 Quicktime Uncompressed RGB 10-bit @tab @tab X
580+@item R10K AJA Kona 10-bit RGB Codec @tab X @tab X
581+@item R210 Quicktime Uncompressed RGB 10-bit @tab X @tab X
582582 @item Raw Video @tab X @tab X
583583 @item RealVideo 1.0 @tab X @tab X
584584 @item RealVideo 2.0 @tab X @tab X
libavcodec/Makefile+3−0
@@ -92,6 +92,7 @@ OBJS-$(CONFIG_ATRAC3_DECODER) += atrac3.o atrac.o · 91 unmodified lines
9292 OBJS-$(CONFIG_AURA_DECODER) += cyuv.o
9393 OBJS-$(CONFIG_AURA2_DECODER) += aura.o
9494 OBJS-$(CONFIG_AVRP_DECODER) += r210dec.o
95+OBJS-$(CONFIG_AVRP_ENCODER) += r210enc.o
9596 OBJS-$(CONFIG_AVS_DECODER) += avs.o
9697 OBJS-$(CONFIG_BETHSOFTVID_DECODER) += bethsoftvideo.o
9798 OBJS-$(CONFIG_BFI_DECODER) += bfi.o
@@ -339,7 +340,9 @@ OBJS-$(CONFIG_QPEG_DECODER) += qpeg.o · 241 unmodified lines
339340 OBJS-$(CONFIG_QTRLE_DECODER) += qtrle.o
340341 OBJS-$(CONFIG_QTRLE_ENCODER) += qtrleenc.o
341342 OBJS-$(CONFIG_R10K_DECODER) += r210dec.o
343+OBJS-$(CONFIG_R10K_ENCODER) += r210enc.o
342344 OBJS-$(CONFIG_R210_DECODER) += r210dec.o
345+OBJS-$(CONFIG_R210_ENCODER) += r210enc.o
343346 OBJS-$(CONFIG_RA_144_DECODER) += ra144dec.o ra144.o celp_filters.o
344347 OBJS-$(CONFIG_RA_144_ENCODER) += ra144enc.o ra144.o celp_filters.o
345348 OBJS-$(CONFIG_RA_288_DECODER) += ra288.o celp_math.o celp_filters.o
libavcodec/allcodecs.c+3−3
@@ -79,7 +79,7 @@ void avcodec_register_all(void) · 78 unmodified lines
7979 REGISTER_ENCDEC (ASV2, asv2);
8080 REGISTER_DECODER (AURA, aura);
8181 REGISTER_DECODER (AURA2, aura2);
82− REGISTER_DECODER (AVRP, avrp);
82+ REGISTER_ENCDEC (AVRP, avrp);
8383 REGISTER_DECODER (AVS, avs);
8484 REGISTER_DECODER (BETHSOFTVID, bethsoftvid);
8585 REGISTER_DECODER (BFI, bfi);
@@ -184,8 +184,8 @@ void avcodec_register_all(void) · 98 unmodified lines
184184 REGISTER_DECODER (QDRAW, qdraw);
185185 REGISTER_DECODER (QPEG, qpeg);
186186 REGISTER_ENCDEC (QTRLE, qtrle);
187− REGISTER_DECODER (R10K, r10k);
188− REGISTER_DECODER (R210, r210);
187+ REGISTER_ENCDEC (R10K, r10k);
188+ REGISTER_ENCDEC (R210, r210);
189189 REGISTER_ENCDEC (RAWVIDEO, rawvideo);
190190 REGISTER_DECODER (RL2, rl2);
191191 REGISTER_ENCDEC (ROQ, roq);
libavcodec/r210enc.c+120−0
@@ -0,0 +1,120 @@
1+/*
2+ * R210 encoder
3+ *
4+ * Copyright (c) 2012 Paul B Mahol
5+ *
6+ * This file is part of FFmpeg.
7+ *
8+ * FFmpeg is free software; you can redistribute it and/or
9+ * modify it under the terms of the GNU Lesser General Public
10+ * License as published by the Free Software Foundation; either
11+ * version 2.1 of the License, or (at your option) any later version.
12+ *
13+ * FFmpeg is distributed in the hope that it will be useful,
14+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16+ * Lesser General Public License for more details.
17+ *
18+ * You should have received a copy of the GNU Lesser General Public
19+ * License along with FFmpeg; if not, write to the Free Software
20+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21+ */
22+
23+#include "avcodec.h"
24+#include "bytestream.h"
25+
26+static av_cold int encode_init(AVCodecContext *avctx)
27+{
28+ avctx->coded_frame = avcodec_alloc_frame();
29+
30+ if (!avctx->coded_frame)
31+ return AVERROR(ENOMEM);
32+
33+ return 0;
34+}
35+
36+static int encode_frame(AVCodecContext *avctx, uint8_t *buf,
37+ int buf_size, void *data)
38+{
39+ AVFrame *pic = data;
40+ int i, j;
41+ int aligned_width = FFALIGN(avctx->width, 64);
42+ uint8_t *src_line;
43+ uint8_t *dst = buf;
44+
45+ if (buf_size < 4 * aligned_width * avctx->height) {
46+ av_log(avctx, AV_LOG_ERROR, "output buffer too small\n");
47+ return AVERROR(ENOMEM);
48+ }
49+
50+ avctx->coded_frame->reference = 0;
51+ avctx->coded_frame->key_frame = 1;
52+ avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
53+ src_line = pic->data[0];
54+
55+ for (i = 0; i < avctx->height; i++) {
56+ uint16_t *src = (uint16_t *)src_line;
57+ for (j = 0; j < avctx->width; j++) {
58+ uint32_t pixel;
59+ uint16_t r = *src++ >> 6;
60+ uint16_t g = *src++ >> 6;
61+ uint16_t b = *src++ >> 4;
62+ if (avctx->codec_id == CODEC_ID_R210)
63+ pixel = (r << 20) | (g << 10) | b >> 2;
64+ else
65+ pixel = (r << 22) | (g << 12) | b;
66+ if (avctx->codec_id == CODEC_ID_AVRP)
67+ bytestream_put_le32(&dst, pixel);
68+ else
69+ bytestream_put_be32(&dst, pixel);
70+ }
71+ dst += aligned_width - avctx->width;
72+ src_line += pic->linesize[0];
73+ }
74+
75+ return 4 * aligned_width * avctx->height;
76+}
77+
78+static av_cold int encode_close(AVCodecContext *avctx)
79+{
80+ av_freep(&avctx->coded_frame);
81+
82+ return 0;
83+}
84+
85+#if CONFIG_R210_ENCODER
86+AVCodec ff_r210_encoder = {
87+ .name = "r210",
88+ .type = AVMEDIA_TYPE_VIDEO,
89+ .id = CODEC_ID_R210,
90+ .init = encode_init,
91+ .encode = encode_frame,
92+ .close = encode_close,
93+ .pix_fmts = (const enum PixelFormat[]) { PIX_FMT_RGB48, PIX_FMT_NONE },
94+ .long_name = NULL_IF_CONFIG_SMALL("Uncompressed RGB 10-bit"),
95+};
96+#endif
97+#if CONFIG_R10K_ENCODER
98+AVCodec ff_r10k_encoder = {
99+ .name = "r10k",
100+ .type = AVMEDIA_TYPE_VIDEO,
101+ .id = CODEC_ID_R10K,
102+ .init = encode_init,
103+ .encode = encode_frame,
104+ .close = encode_close,
105+ .pix_fmts = (const enum PixelFormat[]) { PIX_FMT_RGB48, PIX_FMT_NONE },
106+ .long_name = NULL_IF_CONFIG_SMALL("AJA Kona 10-bit RGB Codec"),
107+};
108+#endif
109+#if CONFIG_AVRP_ENCODER
110+AVCodec ff_avrp_encoder = {
111+ .name = "avrp",
112+ .type = AVMEDIA_TYPE_VIDEO,
113+ .id = CODEC_ID_AVRP,
114+ .init = encode_init,
115+ .encode = encode_frame,
116+ .close = encode_close,
117+ .pix_fmts = (const enum PixelFormat[]) { PIX_FMT_RGB48, PIX_FMT_NONE },
118+ .long_name = NULL_IF_CONFIG_SMALL("Avid 1:1 10-bit RGB Packer"),
119+};
120+#endif
libavcodec/version.h+1−1
@@ -21,7 +21,7 @@ · 20 unmodified lines
2121 #define AVCODEC_VERSION_H
2222
2323 #define LIBAVCODEC_VERSION_MAJOR 53
24−#define LIBAVCODEC_VERSION_MINOR 59
24+#define LIBAVCODEC_VERSION_MINOR 60
2525 #define LIBAVCODEC_VERSION_MICRO 100
2626
2727 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t