diff --git a/libavcodec/apiexample.c b/libavcodec/apiexample.c
index 530ae74cd1c28e7bde7d2ac5ba58ab5fe72fd6c1..306be47f91843671f432a2c0565d50b205221843 100644
--- a/libavcodec/apiexample.c
+++ b/libavcodec/apiexample.c
@@ -413,9 +413,9 @@ int options_example(int argc, char* argv[])
 	int depth = 0;
 	for (;;) {
 	    if (!c->name) {
-		if (c->sub) {
+		if (c->help) {
 		    stack[depth++] = c;
-		    c = c->sub;
+		    c = (const AVOption*)c->help;
 		} else {
 		    if (depth == 0)
 			break; // finished
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 765bc660f4cefde0e30da961965cb0210d743d15..5395a24bf4fb613dc8fcf151d488d2f73f3eebfe 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -829,10 +829,23 @@ typedef struct AVCodecContext {
 #define FF_EC_DEBLOCK     2
 
     /**
-     * dsp_mask could be used to disable unwanted
+     * dsp_mask could be add used to disable unwanted CPU features
      * CPU features (i.e. MMX, SSE. ...)
-     */
-     unsigned dsp_mask;
+     *
+     * with FORCE flag you may instead enable given CPU features
+     * (Dangerous: usable in case of misdetection, improper usage however will
+     * result into program crash)
+     */
+    unsigned dsp_mask;
+#define FF_MM_FORCE	0x80000000 /* force usage of selected flags (OR) */
+    /* lower 16 bits - CPU features */
+#ifdef HAVE_MMX
+#define FF_MM_MMX	0x0001 /* standard MMX */
+#define FF_MM_3DNOW	0x0004 /* AMD 3DNOW */
+#define FF_MM_MMXEXT	0x0002 /* SSE integer functions or AMD MMX ext */
+#define FF_MM_SSE	0x0008 /* SSE functions */
+#define FF_MM_SSE2	0x0010 /* PIV SSE2 functions */
+#endif /* HAVE_MMX */
 
     /**
      * bits per sample/pixel from the demuxer (needed for huffyuv).
@@ -1012,7 +1025,6 @@ typedef struct AVCodecContext {
 
 } AVCodecContext;
 
-//void avcodec_getopt(AVCodecContext* avctx, const char* str, avc_config_t** config);
 
 /**
  * AVOption.
@@ -1020,8 +1032,8 @@ typedef struct AVCodecContext {
 typedef struct AVOption {
     /** options' name */
     const char *name; /* if name is NULL, it indicates a link to next */
-    /** short English text help */
-    const char *help;
+    /** short English text help or const struct AVOption* subpointer */
+    const char *help; //	const struct AVOption* sub;
     /** offset to context structure where the parsed value should be stored */
     int offset;
     /** options' type */
@@ -1046,11 +1058,18 @@ typedef struct AVOption {
      * defval might select other then first argument as default
      */
     const char *defstr;
-    const struct AVOption *sub; /* used when name is NULL */
-    /* when it's NULL return to previous level (or finish reading) */
 #define FF_OPT_MAX_DEPTH 10
 } AVOption;
 
+/**
+ * Parse option(s) and sets fields in passed structure
+ * @param strct	structure where the parsed results will be written
+ * @param list  list with AVOptions
+ * @param opts	string with options for parsing
+ */
+int avoption_parse(void* strct, const AVOption* list, const char* opts);
+
+
 /**
  * AVCodec.
  */
diff --git a/libavcodec/common.h b/libavcodec/common.h
index a8f31a4b797558038475feaa22c6e10171daf88f..f7f70e36b3e350a238b43a0ae99a0a00913f4792 100644
--- a/libavcodec/common.h
+++ b/libavcodec/common.h
@@ -57,7 +57,7 @@
     { name, help, offsetof(AVCodecContext, field), FF_OPT_TYPE_STRING, .defval = val, .defstr = str }
 #define AVOPTION_CODEC_RCOVERRIDE(name, help, field) \
     { name, help, offsetof(AVCodecContext, field), FF_OPT_TYPE_RCOVERRIDE, .defval = 0, .defstr = NULL }
-#define AVOPTION_SUB(ptr) { .name = NULL, .sub = ptr }
+#define AVOPTION_SUB(ptr) { .name = NULL, .help = (const char*)ptr }
 #define AVOPTION_END() AVOPTION_SUB(NULL)
 
 #endif /* HAVE_AV_CONFIG_H */
diff --git a/libavcodec/opts.c b/libavcodec/opts.c
index 908f27875a2817d5e8926668a4d9efcc9664c606..fc00d76393a385e8d18464f42d2fb7ebcceb1493 100644
--- a/libavcodec/opts.c
+++ b/libavcodec/opts.c
@@ -12,10 +12,22 @@
 
 #include "avcodec.h"
 
-extern const AVOption common_options[2];
-
-const AVOption common_options[2] = {
-    AVOPTION_CODEC_INT("common", "test", bit_rate, 0, 10, 0),
+#ifdef HAVE_MMX
+extern const AVOption common_options[3 + 5];
+#else
+extern const AVOption common_options[3];
+#endif
+
+const AVOption common_options[] = {
+    AVOPTION_CODEC_FLAG("bit_exact", "use only bit-exact stuff", flags, CODEC_FLAG_BITEXACT, 0),
+    AVOPTION_CODEC_FLAG("mm_force", "force mm flags", dsp_mask, FF_MM_FORCE, 0),
+#ifdef HAVE_MMX
+    AVOPTION_CODEC_FLAG("mm_mmx", "mask MMX feature", dsp_mask, FF_MM_MMX, 0),
+    AVOPTION_CODEC_FLAG("mm_3dnow", "mask 3DNow feature", dsp_mask, FF_MM_3DNOW, 0),
+    AVOPTION_CODEC_FLAG("mm_mmxext", "mask MMXEXT (MMX2) feature", dsp_mask, FF_MM_MMXEXT, 0),
+    AVOPTION_CODEC_FLAG("mm_sse", "mask SSE feature", dsp_mask, FF_MM_SSE, 0),
+    AVOPTION_CODEC_FLAG("mm_sse2", "mask SSE2 feature", dsp_mask, FF_MM_SSE2, 0),
+#endif
     AVOPTION_END()
 };
 
@@ -71,7 +83,7 @@ static int parse_int(const AVOption* c, char* s, int* var)
     return 0;
 }
 
-static int parse_string(const AVOption *c, char *s, AVCodecContext *avctx, char **var)
+static int parse_string(const AVOption *c, char *s, void* strct, char **var)
 {
     if (!s)
 	return -1;
@@ -80,6 +92,7 @@ static int parse_string(const AVOption *c, char *s, AVCodecContext *avctx, char
 	int sf, ef, qs;
 	float qf;
 	if (sscanf(s, "%d,%d,%d,%f", &sf, &ef, &qs, &qf) == 4 && sf < ef) {
+	    AVCodecContext *avctx = (AVCodecContext *) strct;
 	    RcOverride *o;
 	    avctx->rc_override = av_realloc(avctx->rc_override,
 					    sizeof(RcOverride) * (avctx->rc_override_count + 1));
@@ -98,13 +111,7 @@ static int parse_string(const AVOption *c, char *s, AVCodecContext *avctx, char
     return 0;
 }
 
-/**
- *
- * \param codec  codec for option parsing
- * \param opts   string with options for parsing
- * \param avctx  where to store parsed results
- */
-int avcodec_parse(const AVCodec *codec, const char *opts, AVCodecContext *avctx)
+int avoption_parse(void* strct, const AVOption* list, const char *opts)
 {
     int r = 0;
     char* dopts = av_strdup(opts);
@@ -113,8 +120,8 @@ int avcodec_parse(const AVCodec *codec, const char *opts, AVCodecContext *avctx)
 
 	while (str && *str && r == 0) {
 	    const AVOption *stack[FF_OPT_MAX_DEPTH];
+	    const AVOption *c = list;
 	    int depth = 0;
-	    const AVOption *c = codec->options;
 	    char* e = strchr(str, ':');
 	    char* p;
 	    if (e)
@@ -127,9 +134,9 @@ int avcodec_parse(const AVCodec *codec, const char *opts, AVCodecContext *avctx)
             // going through option structures
 	    for (;;) {
 		if (!c->name) {
-		    if (c->sub) {
+		    if (c->help) {
 			stack[depth++] = c;
-			c = c->sub;
+			c = (const AVOption*) c->help;
 			assert(depth > FF_OPT_MAX_DEPTH);
 		    } else {
 			if (depth == 0)
@@ -139,7 +146,7 @@ int avcodec_parse(const AVCodec *codec, const char *opts, AVCodecContext *avctx)
 		    }
 		} else {
 		    if (!strcmp(c->name, str)) {
-			void* ptr = (char*)avctx + c->offset;
+			void* ptr = (char*)strct + c->offset;
 
 			switch (c->type & FF_OPT_TYPE_MASK) {
 			case FF_OPT_TYPE_BOOL:
@@ -152,7 +159,7 @@ int avcodec_parse(const AVCodec *codec, const char *opts, AVCodecContext *avctx)
 			    r = parse_int(c, p, (int*)ptr);
 			    break;
 			case FF_OPT_TYPE_STRING:
-			    r = parse_string(c, p, avctx, (char**)ptr);
+			    r = parse_string(c, p, strct, (char**)ptr);
 			    break;
 			default:
 			    assert(0 == 1);