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
18- Automatic thread count based on detection number of (available) CPU cores18- Automatic thread count based on detection number of (available) CPU cores
19- y41p Brooktree Uncompressed 4:1:1 12-bit encoder and decoder19- y41p Brooktree Uncompressed 4:1:1 12-bit encoder and decoder
20- ffprobe -show_error option20- ffprobe -show_error option
21- Avid 1:1 10-bit RGB Packer decoder21- Avid 1:1 10-bit RGB Packer codec
22- v308 Quicktime Uncompressed 4:4:4 encoder and decoder22- v308 Quicktime Uncompressed 4:4:4 encoder and decoder
23- yuv4 libquicktime packed 4:2:0 encoder and decoder23- yuv4 libquicktime packed 4:2:0 encoder and decoder
24- ffprobe -show_frames option24- ffprobe -show_frames option
@@ -28,6 +28,7 @@ version next: · 3 unmodified lines
28- optimized iMDCT transform on x86 using SSE for for mpegaudiodec28- optimized iMDCT transform on x86 using SSE for for mpegaudiodec
29- Improved PGS subtitle decoder29- Improved PGS subtitle decoder
30- dumpgraph option to lavfi device30- dumpgraph option to lavfi device
31- r210 and r10k encoders
31 32
32 33
33version 0.9:34version 0.9:
doc/general.texi+3−3
@@ -440,7 +440,7 @@ following image formats are supported: · 439 unmodified lines
440@item Autodesk Animator Flic video @tab @tab X440@item Autodesk Animator Flic video @tab @tab X
441@item Autodesk RLE @tab @tab X441@item Autodesk RLE @tab @tab X
442 @tab fourcc: AASC442 @tab fourcc: AASC
443@item Avid 1:1 10-bit RGB Packer @tab @tab X443@item Avid 1:1 10-bit RGB Packer @tab X @tab X
444 @tab fourcc: AVrp444 @tab fourcc: AVrp
445@item AVS (Audio Video Standard) video @tab @tab X445@item AVS (Audio Video Standard) video @tab @tab X
446 @tab Video encoding used by the Creature Shock game.446 @tab Video encoding used by the Creature Shock game.
@@ -577,8 +577,8 @@ following image formats are supported: · 130 unmodified lines
577 @tab fourcc: 'smc '577 @tab fourcc: 'smc '
578@item QuickTime video (RPZA) @tab @tab X578@item QuickTime video (RPZA) @tab @tab X
579 @tab fourcc: rpza579 @tab fourcc: rpza
580@item R10K AJA Kona 10-bit RGB Codec @tab @tab X580@item R10K AJA Kona 10-bit RGB Codec @tab X @tab X
581@item R210 Quicktime Uncompressed RGB 10-bit @tab @tab X581@item R210 Quicktime Uncompressed RGB 10-bit @tab X @tab X
582@item Raw Video @tab X @tab X582@item Raw Video @tab X @tab X
583@item RealVideo 1.0 @tab X @tab X583@item RealVideo 1.0 @tab X @tab X
584@item RealVideo 2.0 @tab X @tab X584@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
92OBJS-$(CONFIG_AURA_DECODER) += cyuv.o92OBJS-$(CONFIG_AURA_DECODER) += cyuv.o
93OBJS-$(CONFIG_AURA2_DECODER) += aura.o93OBJS-$(CONFIG_AURA2_DECODER) += aura.o
94OBJS-$(CONFIG_AVRP_DECODER) += r210dec.o94OBJS-$(CONFIG_AVRP_DECODER) += r210dec.o
95OBJS-$(CONFIG_AVRP_ENCODER) += r210enc.o
95OBJS-$(CONFIG_AVS_DECODER) += avs.o96OBJS-$(CONFIG_AVS_DECODER) += avs.o
96OBJS-$(CONFIG_BETHSOFTVID_DECODER) += bethsoftvideo.o97OBJS-$(CONFIG_BETHSOFTVID_DECODER) += bethsoftvideo.o
97OBJS-$(CONFIG_BFI_DECODER) += bfi.o98OBJS-$(CONFIG_BFI_DECODER) += bfi.o
@@ -339,7 +340,9 @@ OBJS-$(CONFIG_QPEG_DECODER) += qpeg.o · 241 unmodified lines
339OBJS-$(CONFIG_QTRLE_DECODER) += qtrle.o340OBJS-$(CONFIG_QTRLE_DECODER) += qtrle.o
340OBJS-$(CONFIG_QTRLE_ENCODER) += qtrleenc.o341OBJS-$(CONFIG_QTRLE_ENCODER) += qtrleenc.o
341OBJS-$(CONFIG_R10K_DECODER) += r210dec.o342OBJS-$(CONFIG_R10K_DECODER) += r210dec.o
343OBJS-$(CONFIG_R10K_ENCODER) += r210enc.o
342OBJS-$(CONFIG_R210_DECODER) += r210dec.o344OBJS-$(CONFIG_R210_DECODER) += r210dec.o
345OBJS-$(CONFIG_R210_ENCODER) += r210enc.o
343OBJS-$(CONFIG_RA_144_DECODER) += ra144dec.o ra144.o celp_filters.o346OBJS-$(CONFIG_RA_144_DECODER) += ra144dec.o ra144.o celp_filters.o
344OBJS-$(CONFIG_RA_144_ENCODER) += ra144enc.o ra144.o celp_filters.o347OBJS-$(CONFIG_RA_144_ENCODER) += ra144enc.o ra144.o celp_filters.o
345OBJS-$(CONFIG_RA_288_DECODER) += ra288.o celp_math.o celp_filters.o348OBJS-$(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
79 REGISTER_ENCDEC (ASV2, asv2);79 REGISTER_ENCDEC (ASV2, asv2);
80 REGISTER_DECODER (AURA, aura);80 REGISTER_DECODER (AURA, aura);
81 REGISTER_DECODER (AURA2, aura2);81 REGISTER_DECODER (AURA2, aura2);
82 REGISTER_DECODER (AVRP, avrp);82 REGISTER_ENCDEC (AVRP, avrp);
83 REGISTER_DECODER (AVS, avs);83 REGISTER_DECODER (AVS, avs);
84 REGISTER_DECODER (BETHSOFTVID, bethsoftvid);84 REGISTER_DECODER (BETHSOFTVID, bethsoftvid);
85 REGISTER_DECODER (BFI, bfi);85 REGISTER_DECODER (BFI, bfi);
@@ -184,8 +184,8 @@ void avcodec_register_all(void) · 98 unmodified lines
184 REGISTER_DECODER (QDRAW, qdraw);184 REGISTER_DECODER (QDRAW, qdraw);
185 REGISTER_DECODER (QPEG, qpeg);185 REGISTER_DECODER (QPEG, qpeg);
186 REGISTER_ENCDEC (QTRLE, qtrle);186 REGISTER_ENCDEC (QTRLE, qtrle);
187 REGISTER_DECODER (R10K, r10k);187 REGISTER_ENCDEC (R10K, r10k);
188 REGISTER_DECODER (R210, r210);188 REGISTER_ENCDEC (R210, r210);
189 REGISTER_ENCDEC (RAWVIDEO, rawvideo);189 REGISTER_ENCDEC (RAWVIDEO, rawvideo);
190 REGISTER_DECODER (RL2, rl2);190 REGISTER_DECODER (RL2, rl2);
191 REGISTER_ENCDEC (ROQ, roq);191 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
26static 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
36static 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
78static 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
86AVCodec 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
98AVCodec 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
110AVCodec 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
21#define AVCODEC_VERSION_H21#define AVCODEC_VERSION_H
22 22
23#define LIBAVCODEC_VERSION_MAJOR 5323#define LIBAVCODEC_VERSION_MAJOR 53
24#define LIBAVCODEC_VERSION_MINOR 5924#define LIBAVCODEC_VERSION_MINOR 60
25#define LIBAVCODEC_VERSION_MICRO 10025#define LIBAVCODEC_VERSION_MICRO 100
26 26
27#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \27#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