summaryrefslogtreecommitdiff
path: root/libavcodec/dnxhddata.c
diff options
context:
space:
mode:
authorBaptiste Coudurier <baptiste.coudurier@gmail.com>2007-12-18 13:52:07 +0000
committerBaptiste Coudurier <baptiste.coudurier@gmail.com>2007-12-18 13:52:07 +0000
commit0c39c38b1456d4a59c4982db74facaa1722edc18 (patch)
tree2a8c45b49bc75b25a1971bf01772e6e0b9a5d850 /libavcodec/dnxhddata.c
parent86404ffba2d8795d44cffbbeee3b3c7c2cc6afcc (diff)
add bitrate helper to choose all dnxhd variants
Originally committed as revision 11260 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/dnxhddata.c')
-rw-r--r--libavcodec/dnxhddata.c43
1 files changed, 35 insertions, 8 deletions
diff --git a/libavcodec/dnxhddata.c b/libavcodec/dnxhddata.c
index f926a0b97f..fa6d13fa4a 100644
--- a/libavcodec/dnxhddata.c
+++ b/libavcodec/dnxhddata.c
@@ -19,6 +19,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "avcodec.h"
#include "dnxhddata.h"
static const uint8_t dnxhd_1237_luma_weight[] = {
@@ -361,49 +362,57 @@ const CIDEntry ff_dnxhd_cid_table[] = {
dnxhd_1237_dc_codes, dnxhd_1237_dc_bits,
dnxhd_1237_ac_codes, dnxhd_1237_ac_bits, dnxhd_1237_ac_level,
dnxhd_1237_ac_run_flag, dnxhd_1237_ac_index_flag,
- dnxhd_1237_run_codes, dnxhd_1237_run_bits, dnxhd_1237_run },
+ dnxhd_1237_run_codes, dnxhd_1237_run_bits, dnxhd_1237_run,
+ { 115, 120, 145, 240, 290 } },
{ 1238, 1920, 1080, 0, 917504, 917504, 4, 8,
dnxhd_1238_luma_weight, dnxhd_1238_chroma_weight,
dnxhd_1238_dc_codes, dnxhd_1238_dc_bits,
dnxhd_1238_ac_codes, dnxhd_1238_ac_bits, dnxhd_1238_ac_level,
dnxhd_1238_ac_run_flag, dnxhd_1238_ac_index_flag,
- dnxhd_1238_run_codes, dnxhd_1238_run_bits, dnxhd_1238_run },
+ dnxhd_1238_run_codes, dnxhd_1238_run_bits, dnxhd_1238_run,
+ { 175, 185, 220, 365, 440 } },
{ 1241, 1920, 1080, 1, 917504, 458752, 6, 10,
dnxhd_1241_luma_weight, dnxhd_1241_chroma_weight,
dnxhd_1241_dc_codes, dnxhd_1241_dc_bits,
dnxhd_1241_ac_codes, dnxhd_1241_ac_bits, dnxhd_1241_ac_level,
dnxhd_1241_ac_run_flag, dnxhd_1241_ac_index_flag,
- dnxhd_1241_run_codes, dnxhd_1241_run_bits, dnxhd_1241_run },
+ dnxhd_1241_run_codes, dnxhd_1241_run_bits, dnxhd_1241_run,
+ { 185, 220 } },
{ 1242, 1920, 1080, 1, 606208, 303104, 4, 8,
dnxhd_1242_luma_weight, dnxhd_1242_chroma_weight,
dnxhd_1237_dc_codes, dnxhd_1237_dc_bits,
dnxhd_1237_ac_codes, dnxhd_1237_ac_bits, dnxhd_1237_ac_level,
dnxhd_1237_ac_run_flag, dnxhd_1237_ac_index_flag,
- dnxhd_1237_run_codes, dnxhd_1237_run_bits, dnxhd_1237_run },
+ dnxhd_1237_run_codes, dnxhd_1237_run_bits, dnxhd_1237_run,
+ { 120, 145 } },
{ 1243, 1920, 1080, 1, 917504, 458752, 4, 8,
dnxhd_1243_luma_weight, dnxhd_1243_chroma_weight,
dnxhd_1238_dc_codes, dnxhd_1238_dc_bits,
dnxhd_1238_ac_codes, dnxhd_1238_ac_bits, dnxhd_1238_ac_level,
dnxhd_1238_ac_run_flag, dnxhd_1238_ac_index_flag,
- dnxhd_1238_run_codes, dnxhd_1238_run_bits, dnxhd_1238_run },
+ dnxhd_1238_run_codes, dnxhd_1238_run_bits, dnxhd_1238_run,
+ { 185, 220 } },
{ 1251, 1280, 720, 0, 458752, 458752, 4, 8,
dnxhd_1251_luma_weight, dnxhd_1251_chroma_weight,
dnxhd_1251_dc_codes, dnxhd_1251_dc_bits,
dnxhd_1251_ac_codes, dnxhd_1251_ac_bits, dnxhd_1251_ac_level,
dnxhd_1251_ac_run_flag, dnxhd_1251_ac_index_flag,
- dnxhd_1251_run_codes, dnxhd_1251_run_bits, dnxhd_1251_run },
+ dnxhd_1251_run_codes, dnxhd_1251_run_bits, dnxhd_1251_run,
+ { 90, 110, 175, 220 } },
{ 1252, 1280, 720, 0, 303104, 303104, 4, 8,
dnxhd_1252_luma_weight, dnxhd_1252_chroma_weight,
dnxhd_1252_dc_codes, dnxhd_1252_dc_bits,
dnxhd_1252_ac_codes, dnxhd_1252_ac_bits, dnxhd_1252_ac_level,
dnxhd_1252_ac_run_flag, dnxhd_1252_ac_index_flag,
- dnxhd_1252_run_codes, dnxhd_1252_run_bits, dnxhd_1252_run },
+ dnxhd_1252_run_codes, dnxhd_1252_run_bits, dnxhd_1252_run,
+ { 60, 75, 115, 145 } },
{ 1253, 1920, 1080, 0, 188416, 188416, 4, 8,
dnxhd_1237_luma_weight, dnxhd_1237_chroma_weight,
dnxhd_1237_dc_codes, dnxhd_1237_dc_bits,
dnxhd_1237_ac_codes, dnxhd_1237_ac_bits, dnxhd_1237_ac_level,
dnxhd_1237_ac_run_flag, dnxhd_1237_ac_index_flag,
- dnxhd_1237_run_codes, dnxhd_1237_run_bits, dnxhd_1237_run },
+ dnxhd_1237_run_codes, dnxhd_1237_run_bits, dnxhd_1237_run,
+ { 36, 45, 75, 90 } },
};
int ff_dnxhd_get_cid_table(int cid)
@@ -414,3 +423,21 @@ int ff_dnxhd_get_cid_table(int cid)
return i;
return -1;
}
+
+int ff_dnxhd_find_cid(AVCodecContext *avctx)
+{
+ int i, j;
+ int mbs = avctx->bit_rate/1000000;
+ for (i = 0; i < sizeof(ff_dnxhd_cid_table)/sizeof(CIDEntry); i++) {
+ const CIDEntry *cid = &ff_dnxhd_cid_table[i];
+ if (cid->width == avctx->width && cid->height == avctx->height &&
+ cid->interlaced == !!(avctx->flags & CODEC_FLAG_INTERLACED_DCT) &&
+ cid->bit_depth == 8) { // until 10 bit is supported
+ for (j = 0; j < sizeof(cid->bit_rates); j++) {
+ if (cid->bit_rates[j] == mbs)
+ return cid->cid;
+ }
+ }
+ }
+ return 0;
+}